|
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/. */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
7 this.EXPORTED_SYMBOLS = ["MockPolicyListener"]; |
|
8 |
|
9 const {utils: Cu} = Components; |
|
10 |
|
11 Cu.import("resource://gre/modules/Log.jsm"); |
|
12 |
|
13 |
|
14 this.MockPolicyListener = function MockPolicyListener() { |
|
15 this._log = Log.repository.getLogger("Services.DataReporting.Testing.MockPolicyListener"); |
|
16 this._log.level = Log.Level["Debug"]; |
|
17 |
|
18 this.requestDataUploadCount = 0; |
|
19 this.lastDataRequest = null; |
|
20 |
|
21 this.requestRemoteDeleteCount = 0; |
|
22 this.lastRemoteDeleteRequest = null; |
|
23 |
|
24 this.notifyUserCount = 0; |
|
25 this.lastNotifyRequest = null; |
|
26 } |
|
27 |
|
28 MockPolicyListener.prototype = { |
|
29 onRequestDataUpload: function onRequestDataUpload(request) { |
|
30 this._log.info("onRequestDataUpload invoked."); |
|
31 this.requestDataUploadCount++; |
|
32 this.lastDataRequest = request; |
|
33 }, |
|
34 |
|
35 onRequestRemoteDelete: function onRequestRemoteDelete(request) { |
|
36 this._log.info("onRequestRemoteDelete invoked."); |
|
37 this.requestRemoteDeleteCount++; |
|
38 this.lastRemoteDeleteRequest = request; |
|
39 }, |
|
40 |
|
41 onNotifyDataPolicy: function onNotifyDataPolicy(request) { |
|
42 this._log.info("onNotifyUser invoked."); |
|
43 this.notifyUserCount++; |
|
44 this.lastNotifyRequest = request; |
|
45 }, |
|
46 }; |
|
47 |