LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 let { | 20 let { |
21 createSandbox, setupTimerAndXMLHttp, setupRandomResult, unexpectedError, Cr | 21 createSandbox, setupTimerAndXMLHttp, setupRandomResult, unexpectedError, Cr |
22 } = require("./_common"); | 22 } = require("./_common"); |
23 | 23 |
24 let info = null; | |
25 let Prefs = null; | 24 let Prefs = null; |
26 let Notification = null; | 25 let Notification = null; |
27 | 26 |
28 exports.setUp = function(callback) | 27 exports.setUp = function(callback) |
29 { | 28 { |
30 // Inject our Array and JSON to make sure that instanceof checks on arrays | 29 // Inject our Array and JSON to make sure that instanceof checks on arrays |
31 // within the sandbox succeed even with data passed in from outside. | 30 // within the sandbox succeed even with data passed in from outside. |
32 let globals = Object.assign({Array, JSON}, | 31 let globals = Object.assign({Array, JSON}, |
33 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this)); | 32 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this)); |
34 | 33 |
35 let sandboxedRequire = createSandbox({globals}); | 34 let sandboxedRequire = createSandbox({globals}); |
36 ( | 35 ( |
37 info = sandboxedRequire("./stub-modules/info"), | |
38 {Prefs} = sandboxedRequire("./stub-modules/prefs"), | 36 {Prefs} = sandboxedRequire("./stub-modules/prefs"), |
39 {Notification} = sandboxedRequire("../lib/notification") | 37 {Notification} = sandboxedRequire("../lib/notification") |
40 ); | 38 ); |
41 | 39 |
42 callback(); | 40 callback(); |
43 }; | 41 }; |
44 | 42 |
45 function showNotifications(url) | 43 function showNotifications(url) |
46 { | 44 { |
47 let shownNotifications = []; | 45 let shownNotifications = []; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 test.done(); | 515 test.done(); |
518 }; | 516 }; |
519 | 517 |
520 exports.testMissingTranslation = function(test) | 518 exports.testMissingTranslation = function(test) |
521 { | 519 { |
522 let notification = {message: {"en-US": "en-US"}}; | 520 let notification = {message: {"en-US": "en-US"}}; |
523 let texts = Notification.getLocalizedTexts(notification, "fr"); | 521 let texts = Notification.getLocalizedTexts(notification, "fr"); |
524 test.equal(texts.message, "en-US"); | 522 test.equal(texts.message, "en-US"); |
525 test.done(); | 523 test.done(); |
526 }; | 524 }; |
LEFT | RIGHT |