Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/notification.js

Issue 29356001: Issue 4223 - Adapt notification tests to work in adblockpluscore repository (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Created Oct. 5, 2016, 12:32 p.m.
Right Patch Set: Addressed comments Created Oct. 5, 2016, 12:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/_common.js ('k') | test/stub-modules/info.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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; 24 let info = null;
25 let sandboxedJSON = JSON;
kzar 2016/10/05 12:46:30 This variable doesn't seem to be used?
Wladimir Palant 2016/10/05 12:50:42 Right, a left-over from a previous attempt at fixi
26 let Prefs = null; 25 let Prefs = null;
27 let Notification = null; 26 let Notification = null;
28 27
29 exports.setUp = function(callback) 28 exports.setUp = function(callback)
30 { 29 {
30 // 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.
31 let globals = Object.assign({Array, JSON}, 32 let globals = Object.assign({Array, JSON},
32 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this)); 33 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this));
33 34
34 let sandboxedRequire = createSandbox({globals}); 35 let sandboxedRequire = createSandbox({globals});
35
kzar 2016/10/05 12:46:30 Nit: This newline is inconsistent with the other t
Wladimir Palant 2016/10/05 12:50:42 Done.
36 ( 36 (
37 info = sandboxedRequire("./stub-modules/info"), 37 info = sandboxedRequire("./stub-modules/info"),
38 {Prefs} = sandboxedRequire("./stub-modules/prefs"), 38 {Prefs} = sandboxedRequire("./stub-modules/prefs"),
39 {Notification} = sandboxedRequire("../lib/notification") 39 {Notification} = sandboxedRequire("../lib/notification")
40 ); 40 );
41 41
42 callback(); 42 callback();
43 }; 43 };
44 44
45 function showNotifications(url) 45 function showNotifications(url)
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 test.done(); 449 test.done();
450 }; 450 };
451 451
452 exports.testMissingTranslation = function(test) 452 exports.testMissingTranslation = function(test)
453 { 453 {
454 let notification = {message: {"en-US": "en-US"}}; 454 let notification = {message: {"en-US": "en-US"}};
455 let texts = Notification.getLocalizedTexts(notification, "fr"); 455 let texts = Notification.getLocalizedTexts(notification, "fr");
456 test.equal(texts.message, "en-US"); 456 test.equal(texts.message, "en-US");
457 test.done(); 457 test.done();
458 }; 458 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld