OLD | NEW |
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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 {Subscription} = sandboxedRequire("../lib/subscriptionClasses"), | 41 {Subscription} = sandboxedRequire("../lib/subscriptionClasses"), |
42 {Synchronizer} = sandboxedRequire("../lib/synchronizer") | 42 {Synchronizer} = sandboxedRequire("../lib/synchronizer") |
43 ); | 43 ); |
44 | 44 |
45 callback(); | 45 callback(); |
46 }; | 46 }; |
47 | 47 |
48 function resetSubscription(subscription) | 48 function resetSubscription(subscription) |
49 { | 49 { |
50 FilterStorage.updateSubscriptionFilters(subscription, []); | 50 FilterStorage.updateSubscriptionFilters(subscription, []); |
51 subscription.lastCheck = subscription.lastDownload = | 51 subscription.lastCheck = subscription.lastDownload = |
52 subscription.version = subscription.lastSuccess = | 52 subscription.version = subscription.lastSuccess = |
53 subscription.expires = subscription.softExpiration = 0; | 53 subscription.expires = subscription.softExpiration = 0; |
54 subscription.title = ""; | 54 subscription.title = ""; |
55 subscription.homepage = null; | 55 subscription.homepage = null; |
56 subscription.errors = 0; | 56 subscription.errors = 0; |
57 subscription.downloadStatus = null; | 57 subscription.downloadStatus = null; |
58 subscription.requiredVersion = null; | 58 subscription.requiredVersion = null; |
59 } | 59 } |
60 | 60 |
61 let initialDelay = 1 / 60; | 61 let initialDelay = 1 / 60; |
62 | 62 |
63 exports.testOneSubscriptionDownloads = function(test) | 63 exports.testOneSubscriptionDownloads = function(test) |
64 { | 64 { |
65 let subscription = Subscription.fromURL("http://example.com/subscription"); | 65 let subscription = Subscription.fromURL("http://example.com/subscription"); |
66 FilterStorage.addSubscription(subscription); | 66 FilterStorage.addSubscription(subscription); |
67 | 67 |
68 let requests = []; | 68 let requests = []; |
69 this.registerHandler("/subscription", metadata => | 69 this.registerHandler("/subscription", metadata => |
70 { | 70 { |
71 requests.push([this.getTimeOffset(), metadata.method, metadata.path]); | 71 requests.push([this.getTimeOffset(), metadata.method, metadata.path]); |
72 return [Cr.NS_OK, 200, "[Adblock]\n! ExPiREs: 1day\nfoo\nbar"]; | 72 return [Cr.NS_OK, 200, "[Adblock]\n! ExPiREs: 1day\nfoo\nbar"]; |
73 }); | 73 }); |
74 | 74 |
75 this.runScheduledTasks(50).then(() => | 75 this.runScheduledTasks(50).then(() => |
76 { | 76 { |
77 test.deepEqual(requests, [ | 77 test.deepEqual(requests, [ |
78 [0 + initialDelay, "GET", "/subscription"], | 78 [0 + initialDelay, "GET", "/subscription"], |
79 [24 + initialDelay, "GET", "/subscription"], | 79 [24 + initialDelay, "GET", "/subscription"], |
80 [48 + initialDelay, "GET", "/subscription"], | 80 [48 + initialDelay, "GET", "/subscription"] |
81 ], "Requests after 50 hours"); | 81 ], "Requests after 50 hours"); |
82 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 82 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
83 }; | 83 }; |
84 | 84 |
85 exports.testTwoSubscriptionsDownloads = function(test) | 85 exports.testTwoSubscriptionsDownloads = function(test) |
86 { | 86 { |
87 let subscription1 = Subscription.fromURL("http://example.com/subscription1"); | 87 let subscription1 = Subscription.fromURL("http://example.com/subscription1"); |
88 FilterStorage.addSubscription(subscription1); | 88 FilterStorage.addSubscription(subscription1); |
89 | 89 |
90 let subscription2 = Subscription.fromURL("http://example.com/subscription2"); | 90 let subscription2 = Subscription.fromURL("http://example.com/subscription2"); |
(...skipping 13 matching lines...) Expand all Loading... |
104 this.registerHandler("/subscription2", handler); | 104 this.registerHandler("/subscription2", handler); |
105 | 105 |
106 this.runScheduledTasks(55).then(() => | 106 this.runScheduledTasks(55).then(() => |
107 { | 107 { |
108 test.deepEqual(requests, [ | 108 test.deepEqual(requests, [ |
109 [0 + initialDelay, "GET", "/subscription1"], | 109 [0 + initialDelay, "GET", "/subscription1"], |
110 [2 + initialDelay, "GET", "/subscription2"], | 110 [2 + initialDelay, "GET", "/subscription2"], |
111 [24 + initialDelay, "GET", "/subscription1"], | 111 [24 + initialDelay, "GET", "/subscription1"], |
112 [26 + initialDelay, "GET", "/subscription2"], | 112 [26 + initialDelay, "GET", "/subscription2"], |
113 [48 + initialDelay, "GET", "/subscription1"], | 113 [48 + initialDelay, "GET", "/subscription1"], |
114 [50 + initialDelay, "GET", "/subscription2"], | 114 [50 + initialDelay, "GET", "/subscription2"] |
115 ], "Requests after 55 hours"); | 115 ], "Requests after 55 hours"); |
116 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 116 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
117 }; | 117 }; |
118 | 118 |
119 exports.testSubscriptionHeaders = {}; | 119 exports.testSubscriptionHeaders = {}; |
120 | 120 |
121 for (let currentTest of [ | 121 for (let currentTest of [ |
122 {header: "[Adblock]", downloadStatus: "synchronize_ok", requiredVersion: null}
, | 122 {header: "[Adblock]", downloadStatus: "synchronize_ok", requiredVersion: null}
, |
123 {header: "[Adblock Plus]", downloadStatus: "synchronize_ok", requiredVersion:
null}, | 123 {header: "[Adblock Plus]", downloadStatus: "synchronize_ok", requiredVersion:
null}, |
124 {header: "(something)[Adblock]", downloadStatus: "synchronize_ok", requiredVer
sion: null}, | 124 {header: "(something)[Adblock]", downloadStatus: "synchronize_ok", requiredVer
sion: null}, |
(...skipping 16 matching lines...) Expand all Loading... |
141 { | 141 { |
142 test.equal(subscription.downloadStatus, currentTest.downloadStatus, "Downl
oad status"); | 142 test.equal(subscription.downloadStatus, currentTest.downloadStatus, "Downl
oad status"); |
143 test.equal(subscription.requiredVersion, currentTest.requiredVersion, "Req
uired version"); | 143 test.equal(subscription.requiredVersion, currentTest.requiredVersion, "Req
uired version"); |
144 | 144 |
145 if (currentTest.downloadStatus == "synchronize_ok") | 145 if (currentTest.downloadStatus == "synchronize_ok") |
146 { | 146 { |
147 test.deepEqual(subscription.filters, [ | 147 test.deepEqual(subscription.filters, [ |
148 Filter.fromText("foo"), | 148 Filter.fromText("foo"), |
149 Filter.fromText("!bar"), | 149 Filter.fromText("!bar"), |
150 Filter.fromText("@@bas"), | 150 Filter.fromText("@@bas"), |
151 Filter.fromText("#bam"), | 151 Filter.fromText("#bam") |
152 ], "Resulting subscription filters"); | 152 ], "Resulting subscription filters"); |
153 } | 153 } |
154 else | 154 else |
155 { | 155 { |
156 test.deepEqual(subscription.filters, [ | 156 test.deepEqual(subscription.filters, [ |
157 ], "Resulting subscription filters"); | 157 ], "Resulting subscription filters"); |
158 } | 158 } |
159 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 159 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
160 }; | 160 }; |
161 } | 161 } |
162 | 162 |
163 exports.testsDisabledUpdates = function(test) | 163 exports.testsDisabledUpdates = function(test) |
164 { | 164 { |
165 Prefs.subscriptions_autoupdate = false; | 165 Prefs.subscriptions_autoupdate = false; |
166 | 166 |
167 let subscription = Subscription.fromURL("http://example.com/subscription"); | 167 let subscription = Subscription.fromURL("http://example.com/subscription"); |
168 FilterStorage.addSubscription(subscription); | 168 FilterStorage.addSubscription(subscription); |
169 | 169 |
170 let requests = 0; | 170 let requests = 0; |
171 this.registerHandler("/subscription", metadata => | 171 this.registerHandler("/subscription", metadata => |
172 { | 172 { |
173 requests++; | 173 requests++; |
174 throw new Error("Unexpected request"); | 174 throw new Error("Unexpected request"); |
175 }); | 175 }); |
176 | 176 |
177 this.runScheduledTasks(50).then(() => | 177 this.runScheduledTasks(50).then(() => |
178 { | 178 { |
179 test.equal(requests, 0, "Request count"); | 179 test.equal(requests, 0, "Request count"); |
180 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 180 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
181 }; | 181 }; |
182 | 182 |
183 exports.testExpirationTime = {}; | 183 exports.testExpirationTime = {}; |
184 | 184 |
185 for (let currentTest of [ | 185 for (let currentTest of [ |
186 { | 186 { |
187 expiration: "default", | 187 expiration: "default", |
188 randomResult: 0.5, | 188 randomResult: 0.5, |
189 requests: [0 + initialDelay, 5 * 24 + initialDelay] | 189 requests: [0 + initialDelay, 5 * 24 + initialDelay] |
190 }, | 190 }, |
191 { | 191 { |
192 expiration: "1 hours", // Minimal expiration interval | 192 expiration: "1 hours", // Minimal expiration interval |
193 randomResult: 0.5, | 193 randomResult: 0.5, |
194 requests: [0 + initialDelay, 1 + initialDelay, 2 + initialDelay, 3 + initial
Delay] | 194 requests: [0 + initialDelay, 1 + initialDelay, 2 + initialDelay, 3 + initial
Delay] |
195 }, | 195 }, |
196 { | 196 { |
197 expiration: "26 hours", | 197 expiration: "26 hours", |
198 randomResult: 0.5, | 198 randomResult: 0.5, |
199 requests: [0 + initialDelay, 26 + initialDelay] | 199 requests: [0 + initialDelay, 26 + initialDelay] |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 ["Wrong checksum", "[Adblock]\n! Checksum: wrongggny6Fn24b7JHsq/A\nfoo\nbar\n"
, false], | 280 ["Wrong checksum", "[Adblock]\n! Checksum: wrongggny6Fn24b7JHsq/A\nfoo\nbar\n"
, false], |
281 ["Empty lines ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JHsq/A\n\nfoo\
n\nbar\n\n", true], | 281 ["Empty lines ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JHsq/A\n\nfoo\
n\nbar\n\n", true], |
282 ["CR LF line breaks treated like LR", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7
JHsq/A\nfoo\r\nbar\r\n", true], | 282 ["CR LF line breaks treated like LR", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7
JHsq/A\nfoo\r\nbar\r\n", true], |
283 ["CR line breaks treated like LR", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JHs
q/A\nfoo\rbar\r", true], | 283 ["CR line breaks treated like LR", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JHs
q/A\nfoo\rbar\r", true], |
284 ["Trailing line break not ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JH
sq/A\nfoo\nbar", false], | 284 ["Trailing line break not ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JH
sq/A\nfoo\nbar", false], |
285 ["Line breaks between lines not ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn
24b7JHsq/A\nfoobar", false], | 285 ["Line breaks between lines not ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn
24b7JHsq/A\nfoobar", false], |
286 ["Lines with spaces not ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JHsq
/A\n \nfoo\n\nbar\n", false], | 286 ["Lines with spaces not ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn24b7JHsq
/A\n \nfoo\n\nbar\n", false], |
287 ["Extra content in checksum line is part of the checksum", "[Adblock]\n! Check
sum: e/JCmqXny6Fn24b7JHsq/A foobar\nfoo\nbar\n", false], | 287 ["Extra content in checksum line is part of the checksum", "[Adblock]\n! Check
sum: e/JCmqXny6Fn24b7JHsq/A foobar\nfoo\nbar\n", false], |
288 ["= symbols after checksum are ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn2
4b7JHsq/A===\nfoo\nbar\n", true], | 288 ["= symbols after checksum are ignored", "[Adblock]\n! Checksum: e/JCmqXny6Fn2
4b7JHsq/A===\nfoo\nbar\n", true], |
289 ["Header line is part of the checksum", "[Adblock Plus]\n! Checksum: e/JCmqXny
6Fn24b7JHsq/A\nfoo\nbar\n", false], | 289 ["Header line is part of the checksum", "[Adblock Plus]\n! Checksum: e/JCmqXny
6Fn24b7JHsq/A\nfoo\nbar\n", false], |
290 ["Special comments are part of the checksum", "[Adblock]\n! Checksum: e/JCmqXn
y6Fn24b7JHsq/A\n! Expires: 1\nfoo\nbar\n", false], | 290 ["Special comments are part of the checksum", "[Adblock]\n! Checksum: e/JCmqXn
y6Fn24b7JHsq/A\n! Expires: 1\nfoo\nbar\n", false] |
291 ]) | 291 ]) |
292 { | 292 { |
293 exports.testChecksumVerification[testName] = function(test) | 293 exports.testChecksumVerification[testName] = function(test) |
294 { | 294 { |
295 let subscription = Subscription.fromURL("http://example.com/subscription"); | 295 let subscription = Subscription.fromURL("http://example.com/subscription"); |
296 FilterStorage.addSubscription(subscription); | 296 FilterStorage.addSubscription(subscription); |
297 | 297 |
298 this.registerHandler("/subscription", metadata => | 298 this.registerHandler("/subscription", metadata => |
299 { | 299 { |
300 return [Cr.NS_OK, 200, subscriptionBody]; | 300 return [Cr.NS_OK, 200, subscriptionBody]; |
(...skipping 11 matching lines...) Expand all Loading... |
312 for (let [comment, check] of [ | 312 for (let [comment, check] of [ |
313 ["! Homepage: http://example.com/", (test, subscription) => | 313 ["! Homepage: http://example.com/", (test, subscription) => |
314 { | 314 { |
315 test.equal(subscription.homepage, "http://example.com/", "Valid homepage com
ment"); | 315 test.equal(subscription.homepage, "http://example.com/", "Valid homepage com
ment"); |
316 }], | 316 }], |
317 ["! Homepage: ssh://example.com/", (test, subscription) => | 317 ["! Homepage: ssh://example.com/", (test, subscription) => |
318 { | 318 { |
319 test.equal(subscription.homepage, null, "Invalid homepage comment"); | 319 test.equal(subscription.homepage, null, "Invalid homepage comment"); |
320 }], | 320 }], |
321 ["! Title: foo", (test, subscription) => | 321 ["! Title: foo", (test, subscription) => |
322 { | 322 { |
323 test.equal(subscription.title, "foo", "Title comment"); | 323 test.equal(subscription.title, "foo", "Title comment"); |
324 test.equal(subscription.fixedTitle, true, "Fixed title"); | 324 test.equal(subscription.fixedTitle, true, "Fixed title"); |
325 }], | 325 }], |
326 ["! Version: 1234", (test, subscription) => | 326 ["! Version: 1234", (test, subscription) => |
327 { | 327 { |
328 test.equal(subscription.version, 1234, "Version comment"); | 328 test.equal(subscription.version, 1234, "Version comment"); |
329 }] | 329 }] |
330 ]) | 330 ]) |
331 { | 331 { |
332 exports.testSpecialComments[comment] = function(test) | 332 exports.testSpecialComments[comment] = function(test) |
333 { | 333 { |
334 let subscription = Subscription.fromURL("http://example.com/subscription"); | 334 let subscription = Subscription.fromURL("http://example.com/subscription"); |
335 FilterStorage.addSubscription(subscription); | 335 FilterStorage.addSubscription(subscription); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 resetSubscription(subscription); | 376 resetSubscription(subscription); |
377 return this.runScheduledTasks(15); | 377 return this.runScheduledTasks(15); |
378 }).then(() => | 378 }).then(() => |
379 { | 379 { |
380 test.equal(FilterStorage.subscriptions[0].url, "http://example.com/redirecte
d", "Redirect followed"); | 380 test.equal(FilterStorage.subscriptions[0].url, "http://example.com/redirecte
d", "Redirect followed"); |
381 test.deepEqual(requests, [0 + initialDelay, 8 + initialDelay], "Resulting re
quests"); | 381 test.deepEqual(requests, [0 + initialDelay, 8 + initialDelay], "Resulting re
quests"); |
382 | 382 |
383 this.registerHandler("/redirected", metadata => | 383 this.registerHandler("/redirected", metadata => |
384 { | 384 { |
385 return [Cr.NS_OK, 200, "[Adblock]\nfoo\n!Redirect: http://example.com/subs
cription\nbar"]; | 385 return [Cr.NS_OK, 200, "[Adblock]\nfoo\n!Redirect: http://example.com/subs
cription\nbar"]; |
386 }) | 386 }); |
387 | 387 |
388 subscription = Subscription.fromURL("http://example.com/subscription"); | 388 subscription = Subscription.fromURL("http://example.com/subscription"); |
389 resetSubscription(subscription); | 389 resetSubscription(subscription); |
390 FilterStorage.removeSubscription(FilterStorage.subscriptions[0]); | 390 FilterStorage.removeSubscription(FilterStorage.subscriptions[0]); |
391 FilterStorage.addSubscription(subscription); | 391 FilterStorage.addSubscription(subscription); |
392 | 392 |
393 return this.runScheduledTasks(2); | 393 return this.runScheduledTasks(2); |
394 }).then(() => | 394 }).then(() => |
395 { | 395 { |
396 test.equal(FilterStorage.subscriptions[0], subscription, "Redirect not follo
wed on redirect loop"); | 396 test.equal(FilterStorage.subscriptions[0], subscription, "Redirect not follo
wed on redirect loop"); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 521 |
522 this.registerHandler("/subscription", metadata => | 522 this.registerHandler("/subscription", metadata => |
523 { | 523 { |
524 return [Cr.NS_OK, 200, "[Adblock]\n! Expires: 2 hours\nfoo\nbar"]; | 524 return [Cr.NS_OK, 200, "[Adblock]\n! Expires: 2 hours\nfoo\nbar"]; |
525 }); | 525 }); |
526 | 526 |
527 let startTime = this.currentTime; | 527 let startTime = this.currentTime; |
528 this.runScheduledTasks(2).then(() => | 528 this.runScheduledTasks(2).then(() => |
529 { | 529 { |
530 test.equal(subscription.downloadStatus, "synchronize_ok", "downloadStatus af
ter successful download"); | 530 test.equal(subscription.downloadStatus, "synchronize_ok", "downloadStatus af
ter successful download"); |
531 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + initia
lDelay * MILLIS_IN_HOUR, "lastDownload after successful download"); | 531 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + initial
Delay * MILLIS_IN_HOUR, "lastDownload after successful download"); |
532 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initial
Delay * MILLIS_IN_HOUR, "lastSuccess after successful download"); | 532 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initialD
elay * MILLIS_IN_HOUR, "lastSuccess after successful download"); |
533 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (1 + init
ialDelay) * MILLIS_IN_HOUR, "lastCheck after successful download"); | 533 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (1 + initi
alDelay) * MILLIS_IN_HOUR, "lastCheck after successful download"); |
534 test.equal(subscription.errors, 0, "errors after successful download"); | 534 test.equal(subscription.errors, 0, "errors after successful download"); |
535 | 535 |
536 this.registerHandler("/subscription", metadata => | 536 this.registerHandler("/subscription", metadata => |
537 { | 537 { |
538 return [Cr.NS_ERROR_FAILURE, 0, ""]; | 538 return [Cr.NS_ERROR_FAILURE, 0, ""]; |
539 }); | 539 }); |
540 | 540 |
541 return this.runScheduledTasks(2); | 541 return this.runScheduledTasks(2); |
542 }).then(() => | 542 }).then(() => |
543 { | 543 { |
544 test.equal(subscription.downloadStatus, "synchronize_connection_error", "dow
nloadStatus after connection error"); | 544 test.equal(subscription.downloadStatus, "synchronize_connection_error", "dow
nloadStatus after connection error"); |
545 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + (2 + i
nitialDelay) * MILLIS_IN_HOUR, "lastDownload after connection error"); | 545 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + (2 + in
itialDelay) * MILLIS_IN_HOUR, "lastDownload after connection error"); |
546 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initialD
elay * MILLIS_IN_HOUR, "lastSuccess after connection error"); | 546 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initialD
elay * MILLIS_IN_HOUR, "lastSuccess after connection error"); |
547 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (3 + initi
alDelay) * MILLIS_IN_HOUR, "lastCheck after connection error"); | 547 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (3 + initi
alDelay) * MILLIS_IN_HOUR, "lastCheck after connection error"); |
548 test.equal(subscription.errors, 1, "errors after connection error"); | 548 test.equal(subscription.errors, 1, "errors after connection error"); |
549 | 549 |
550 this.registerHandler("/subscription", metadata => | 550 this.registerHandler("/subscription", metadata => |
551 { | 551 { |
552 return [Cr.NS_OK, 404, ""]; | 552 return [Cr.NS_OK, 404, ""]; |
553 }); | 553 }); |
554 | 554 |
555 return this.runScheduledTasks(24); | 555 return this.runScheduledTasks(24); |
556 }).then(() => | 556 }).then(() => |
557 { | 557 { |
558 test.equal(subscription.downloadStatus, "synchronize_connection_error", "dow
nloadStatus after download error"); | 558 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"); | 559 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"); | 560 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"); | 561 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"); | 562 test.equal(subscription.errors, 2, "errors after download error"); |
563 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 563 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
564 }; | 564 }; |
OLD | NEW |