services/datareporting/modules-testing/mocks.jsm

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/services/datareporting/modules-testing/mocks.jsm	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +"use strict";
     1.9 +
    1.10 +this.EXPORTED_SYMBOLS = ["MockPolicyListener"];
    1.11 +
    1.12 +const {utils: Cu} = Components;
    1.13 +
    1.14 +Cu.import("resource://gre/modules/Log.jsm");
    1.15 +
    1.16 +
    1.17 +this.MockPolicyListener = function MockPolicyListener() {
    1.18 +  this._log = Log.repository.getLogger("Services.DataReporting.Testing.MockPolicyListener");
    1.19 +  this._log.level = Log.Level["Debug"];
    1.20 +
    1.21 +  this.requestDataUploadCount = 0;
    1.22 +  this.lastDataRequest = null;
    1.23 +
    1.24 +  this.requestRemoteDeleteCount = 0;
    1.25 +  this.lastRemoteDeleteRequest = null;
    1.26 +
    1.27 +  this.notifyUserCount = 0;
    1.28 +  this.lastNotifyRequest = null;
    1.29 +}
    1.30 +
    1.31 +MockPolicyListener.prototype = {
    1.32 +  onRequestDataUpload: function onRequestDataUpload(request) {
    1.33 +    this._log.info("onRequestDataUpload invoked.");
    1.34 +    this.requestDataUploadCount++;
    1.35 +    this.lastDataRequest = request;
    1.36 +  },
    1.37 +
    1.38 +  onRequestRemoteDelete: function onRequestRemoteDelete(request) {
    1.39 +    this._log.info("onRequestRemoteDelete invoked.");
    1.40 +    this.requestRemoteDeleteCount++;
    1.41 +    this.lastRemoteDeleteRequest = request;
    1.42 +  },
    1.43 +
    1.44 +  onNotifyDataPolicy: function onNotifyDataPolicy(request) {
    1.45 +    this._log.info("onNotifyUser invoked.");
    1.46 +    this.notifyUserCount++;
    1.47 +    this.lastNotifyRequest = request;
    1.48 +  },
    1.49 +};
    1.50 +

mercurial