2012-11-08 00:09:13 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
this.EXPORTED_SYMBOLS = ["MockPolicyListener"];
|
|
|
|
|
|
|
|
const {utils: Cu} = Components;
|
|
|
|
|
2013-08-26 18:55:58 +00:00
|
|
|
Cu.import("resource://gre/modules/Log.jsm");
|
2012-11-08 00:09:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
this.MockPolicyListener = function MockPolicyListener() {
|
2013-08-26 18:55:58 +00:00
|
|
|
this._log = Log.repository.getLogger("Services.DataReporting.Testing.MockPolicyListener");
|
|
|
|
this._log.level = Log.Level["Debug"];
|
2012-11-08 00:09:13 +00:00
|
|
|
|
2012-11-09 21:59:40 +00:00
|
|
|
this.requestDataUploadCount = 0;
|
2012-11-08 00:09:13 +00:00
|
|
|
this.lastDataRequest = null;
|
|
|
|
|
2012-11-09 21:59:40 +00:00
|
|
|
this.requestRemoteDeleteCount = 0;
|
|
|
|
this.lastRemoteDeleteRequest = null;
|
|
|
|
|
2012-11-08 00:09:13 +00:00
|
|
|
this.notifyUserCount = 0;
|
|
|
|
this.lastNotifyRequest = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
MockPolicyListener.prototype = {
|
2012-11-09 21:59:40 +00:00
|
|
|
onRequestDataUpload: function onRequestDataUpload(request) {
|
|
|
|
this._log.info("onRequestDataUpload invoked.");
|
|
|
|
this.requestDataUploadCount++;
|
2012-11-08 00:09:13 +00:00
|
|
|
this.lastDataRequest = request;
|
|
|
|
},
|
|
|
|
|
2012-11-09 21:59:40 +00:00
|
|
|
onRequestRemoteDelete: function onRequestRemoteDelete(request) {
|
|
|
|
this._log.info("onRequestRemoteDelete invoked.");
|
|
|
|
this.requestRemoteDeleteCount++;
|
|
|
|
this.lastRemoteDeleteRequest = request;
|
|
|
|
},
|
|
|
|
|
2012-11-08 00:09:13 +00:00
|
|
|
onNotifyDataPolicy: function onNotifyDataPolicy(request) {
|
|
|
|
this._log.info("onNotifyUser invoked.");
|
|
|
|
this.notifyUserCount++;
|
|
|
|
this.lastNotifyRequest = request;
|
|
|
|
},
|
|
|
|
};
|
2013-01-11 21:45:22 +00:00
|
|
|
|