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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + (26 + i
nitialDelay) * MILLIS_IN_HOUR, "lastDownload after download error"); | 507 test.equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + (26 + i
nitialDelay) * MILLIS_IN_HOUR, "lastDownload after download error"); |
508 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initialD
elay * MILLIS_IN_HOUR, "lastSuccess after download error"); | 508 test.equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + initialD
elay * MILLIS_IN_HOUR, "lastSuccess after download error"); |
509 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (27 + init
ialDelay) * MILLIS_IN_HOUR, "lastCheck after download error"); | 509 test.equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + (27 + init
ialDelay) * MILLIS_IN_HOUR, "lastCheck after download error"); |
510 test.equal(subscription.errors, 2, "errors after download error"); | 510 test.equal(subscription.errors, 2, "errors after download error"); |
511 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 511 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
512 }; | 512 }; |
513 | 513 |
514 exports.testSpecialCommentOrdering = function(test) | 514 exports.testSpecialCommentOrdering = function(test) |
515 { | 515 { |
516 let subscription = Subscription.fromURL("http://example.com/subscription"); | 516 let subscription = Subscription.fromURL("http://example.com/subscription"); |
517 FilterStorage.addSubscription(subscription); | 517 filterStorage.addSubscription(subscription); |
518 | 518 |
519 this.registerHandler("/subscription", metadata => | 519 this.registerHandler("/subscription", metadata => |
520 { | 520 { |
521 return [Cr.NS_OK, 200, "[Adblock]\n! Special Comment: x\n!foo\n! Title: foob
ar\nfoo\nbar"]; | 521 return [Cr.NS_OK, 200, "[Adblock]\n! Special Comment: x\n!foo\n! Title: foob
ar\nfoo\nbar"]; |
522 }); | 522 }); |
523 | 523 |
524 this.runScheduledTasks(1).then(() => | 524 this.runScheduledTasks(1).then(() => |
525 { | 525 { |
526 test.equal(subscription.title, "http://example.com/subscription", "make sure
title was not found"); | 526 test.equal(subscription.title, "http://example.com/subscription", "make sure
title was not found"); |
527 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 527 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
528 }; | 528 }; |
529 | 529 |
530 exports.testUnknownSpecialComments = function(test) | 530 exports.testUnknownSpecialComments = function(test) |
531 { | 531 { |
532 let subscription = Subscription.fromURL("http://example.com/subscription"); | 532 let subscription = Subscription.fromURL("http://example.com/subscription"); |
533 FilterStorage.addSubscription(subscription); | 533 filterStorage.addSubscription(subscription); |
534 | 534 |
535 this.registerHandler("/subscription", metadata => | 535 this.registerHandler("/subscription", metadata => |
536 { | 536 { |
537 // To test allowing unknown special comments like `! :`, `!!@#$%^&*() : `, a
nd `! Some Unknown Comment : ` | 537 // To test allowing unknown special comments like `! :`, `!!@#$%^&*() : `, a
nd `! Some Unknown Comment : ` |
538 return [Cr.NS_OK, 200, "[Adblock]\n! :\n! !@#$%^&*() :\n! Some Unknown Comme
nt :\n! Title: foobar\nfoo\nbar"]; | 538 return [Cr.NS_OK, 200, "[Adblock]\n! :\n! !@#$%^&*() :\n! Some Unknown Comme
nt :\n! Title: foobar\nfoo\nbar"]; |
539 }); | 539 }); |
540 | 540 |
541 this.runScheduledTasks(1).then(() => | 541 this.runScheduledTasks(1).then(() => |
542 { | 542 { |
543 test.equal(subscription.title, "foobar", "make sure title was found"); | 543 test.equal(subscription.title, "foobar", "make sure title was found"); |
544 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 544 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
545 }; | 545 }; |
OLD | NEW |