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

Delta Between Two Patch Sets: test/synchronizer.js

Issue 29375915: Issue 4878 - Start using ESLint for adblockpluscore (Closed)
Left Patch Set: Created Feb. 20, 2017, 10:02 a.m.
Right Patch Set: Removed unused imports Created March 15, 2017, 3:11 a.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/subscriptionClasses.js ('k') | test_runner.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 MILLIS_IN_SECOND, MILLIS_IN_HOUR 22 MILLIS_IN_SECOND, MILLIS_IN_HOUR
23 } = require("./_common"); 23 } = require("./_common");
24 24
25 let Filter = null; 25 let Filter = null;
26 let FilterStorage = null; 26 let FilterStorage = null;
27 let Prefs = null; 27 let Prefs = null;
28 let Subscription = null; 28 let Subscription = null;
29 let Synchronizer = null;
30 29
31 exports.setUp = function(callback) 30 exports.setUp = function(callback)
32 { 31 {
33 let globals = Object.assign({}, setupTimerAndXMLHttp.call(this), 32 let globals = Object.assign({}, setupTimerAndXMLHttp.call(this),
34 setupRandomResult.call(this)); 33 setupRandomResult.call(this));
35 34
36 let sandboxedRequire = createSandbox({globals}); 35 let sandboxedRequire = createSandbox({globals});
37 ( 36 (
38 {Filter} = sandboxedRequire("../lib/filterClasses"), 37 {Filter} = sandboxedRequire("../lib/filterClasses"),
39 {FilterStorage} = sandboxedRequire("../lib/filterStorage"), 38 {FilterStorage} = sandboxedRequire("../lib/filterStorage"),
40 {Prefs} = sandboxedRequire("./stub-modules/prefs"), 39 {Prefs} = sandboxedRequire("./stub-modules/prefs"),
41 {Subscription} = sandboxedRequire("../lib/subscriptionClasses"), 40 {Subscription} = sandboxedRequire("../lib/subscriptionClasses"),
42 {Synchronizer} = sandboxedRequire("../lib/synchronizer") 41 sandboxedRequire("../lib/synchronizer")
43 ); 42 );
44 43
45 callback(); 44 callback();
46 }; 45 };
47 46
48 function resetSubscription(subscription) 47 function resetSubscription(subscription)
49 { 48 {
50 FilterStorage.updateSubscriptionFilters(subscription, []); 49 FilterStorage.updateSubscriptionFilters(subscription, []);
51 subscription.lastCheck = subscription.lastDownload = 50 subscription.lastCheck = subscription.lastDownload =
52 subscription.version = subscription.lastSuccess = 51 subscription.version = subscription.lastSuccess =
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 return this.runScheduledTasks(24); 554 return this.runScheduledTasks(24);
556 }).then(() => 555 }).then(() =>
557 { 556 {
558 test.equal(subscription.downloadStatus, "synchronize_connection_error", "dow nloadStatus after download error"); 557 test.equal(subscription.downloadStatus, "synchronize_connection_error", "dow nloadStatus after download error");
559 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + (26 + i nitialDelay) * MILLIS_IN_HOUR, "lastDownload after download error"); 558 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + (26 + i nitialDelay) * MILLIS_IN_HOUR, "lastDownload after download error");
560 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initialD elay * MILLIS_IN_HOUR, "lastSuccess after download error"); 559 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initialD elay * MILLIS_IN_HOUR, "lastSuccess after download error");
561 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (27 + init ialDelay) * MILLIS_IN_HOUR, "lastCheck after download error"); 560 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (27 + init ialDelay) * MILLIS_IN_HOUR, "lastCheck after download error");
562 test.equal(subscription.errors, 2, "errors after download error"); 561 test.equal(subscription.errors, 2, "errors after download error");
563 }).catch(unexpectedError.bind(test)).then(() => test.done()); 562 }).catch(unexpectedError.bind(test)).then(() => test.done());
564 }; 563 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld