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