services/datareporting/modules-testing/mocks.jsm

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 "use strict";
     7 this.EXPORTED_SYMBOLS = ["MockPolicyListener"];
     9 const {utils: Cu} = Components;
    11 Cu.import("resource://gre/modules/Log.jsm");
    14 this.MockPolicyListener = function MockPolicyListener() {
    15   this._log = Log.repository.getLogger("Services.DataReporting.Testing.MockPolicyListener");
    16   this._log.level = Log.Level["Debug"];
    18   this.requestDataUploadCount = 0;
    19   this.lastDataRequest = null;
    21   this.requestRemoteDeleteCount = 0;
    22   this.lastRemoteDeleteRequest = null;
    24   this.notifyUserCount = 0;
    25   this.lastNotifyRequest = null;
    26 }
    28 MockPolicyListener.prototype = {
    29   onRequestDataUpload: function onRequestDataUpload(request) {
    30     this._log.info("onRequestDataUpload invoked.");
    31     this.requestDataUploadCount++;
    32     this.lastDataRequest = request;
    33   },
    35   onRequestRemoteDelete: function onRequestRemoteDelete(request) {
    36     this._log.info("onRequestRemoteDelete invoked.");
    37     this.requestRemoteDeleteCount++;
    38     this.lastRemoteDeleteRequest = request;
    39   },
    41   onNotifyDataPolicy: function onNotifyDataPolicy(request) {
    42     this._log.info("onNotifyUser invoked.");
    43     this.notifyUserCount++;
    44     this.lastNotifyRequest = request;
    45   },
    46 };

mercurial