| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 Cr, | 412 Cr, |
| 413 XMLHttpRequest, | 413 XMLHttpRequest, |
| 414 Date: { | 414 Date: { |
| 415 now: () => currentTime | 415 now: () => currentTime |
| 416 } | 416 } |
| 417 }; | 417 }; |
| 418 }; | 418 }; |
| 419 | 419 |
| 420 console.warn = console.log; | 420 console.warn = console.log; |
| 421 | 421 |
| 422 exports.silenceWarnOutput = function(test, msg) |
| 423 { |
| 424 let warnHandler = globals.console.warn; |
| 425 globals.console.warn = s => |
| 426 { |
| 427 if (s != msg) |
| 428 warnHandler(s); |
| 429 }; |
| 430 try |
| 431 { |
| 432 return test(); |
| 433 } |
| 434 finally |
| 435 { |
| 436 globals.console.warn = warnHandler; |
| 437 } |
| 438 }; |
| 439 |
| 422 exports.silenceAssertionOutput = function(test, msg) | 440 exports.silenceAssertionOutput = function(test, msg) |
| 423 { | 441 { |
| 424 let msgMatch = new RegExp(`^Error: ${msg}[\r\n]`); | 442 let msgMatch = new RegExp(`^Error: ${msg}[\r\n]`); |
| 425 let errorHandler = globals.console.error; | 443 let errorHandler = globals.console.error; |
| 426 globals.console.error = s => | 444 globals.console.error = s => |
| 427 { | 445 { |
| 428 if (!msgMatch.test(s)) | 446 if (!msgMatch.test(s)) |
| 429 errorHandler(s); | 447 errorHandler(s); |
| 430 }; | 448 }; |
| 431 try | 449 try |
| (...skipping 21 matching lines...) Expand all Loading... |
| 453 } | 471 } |
| 454 }) | 472 }) |
| 455 }; | 473 }; |
| 456 }; | 474 }; |
| 457 | 475 |
| 458 exports.unexpectedError = function(error) | 476 exports.unexpectedError = function(error) |
| 459 { | 477 { |
| 460 console.error(error); | 478 console.error(error); |
| 461 this.ok(false, "Unexpected error: " + error); | 479 this.ok(false, "Unexpected error: " + error); |
| 462 }; | 480 }; |
| OLD | NEW |