| LEFT | RIGHT | 
|---|
| (no file at all) |  | 
| 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 | 
| 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 const {ElemHideEmulation, setTestMode, | 20 const {ElemHideEmulation, setTestMode, | 
| 21        getTestInfo} = require("../../lib/content/elemHideEmulation"); | 21        getTestInfo} = require("../../lib/content/elemHideEmulation"); | 
|  | 22 const {timeout} = require("./_utils"); | 
| 22 | 23 | 
| 23 const REFRESH_INTERVAL = 200; | 24 const REFRESH_INTERVAL = 200; | 
| 24 | 25 | 
| 25 let testDocument = null; | 26 let testDocument = null; | 
| 26 | 27 | 
| 27 exports.setUp = function(callback) | 28 exports.setUp = function(callback) | 
| 28 { | 29 { | 
| 29   setTestMode(); | 30   setTestMode(); | 
| 30 | 31 | 
| 31   let iframe = document.createElement("iframe"); | 32   let iframe = document.createElement("iframe"); | 
| 32   document.body.appendChild(iframe); | 33   document.body.appendChild(iframe); | 
| 33   testDocument = iframe.contentDocument; | 34   testDocument = iframe.contentDocument; | 
| 34 | 35 | 
| 35   callback(); | 36   callback(); | 
| 36 }; | 37 }; | 
| 37 | 38 | 
| 38 exports.tearDown = function(callback) | 39 exports.tearDown = function(callback) | 
| 39 { | 40 { | 
| 40   let iframe = testDocument.defaultView.frameElement; | 41   let iframe = testDocument.defaultView.frameElement; | 
| 41   iframe.parentNode.removeChild(iframe); | 42   iframe.parentNode.removeChild(iframe); | 
| 42   testDocument = null; | 43   testDocument = null; | 
| 43 | 44 | 
| 44   callback(); | 45   callback(); | 
| 45 }; | 46 }; | 
| 46 |  | 
| 47 function timeout(delay) |  | 
| 48 { |  | 
| 49   return new Promise((resolve, reject) => |  | 
| 50   { |  | 
| 51     window.setTimeout(resolve, delay); |  | 
| 52   }); |  | 
| 53 } |  | 
| 54 | 47 | 
| 55 function unexpectedError(test, error) | 48 function unexpectedError(test, error) | 
| 56 { | 49 { | 
| 57   console.error(error); | 50   console.error(error); | 
| 58   test.ok(false, "Unexpected error: " + error); | 51   test.ok(false, "Unexpected error: " + error); | 
| 59 } | 52 } | 
| 60 | 53 | 
| 61 function expectHidden(test, element, id) | 54 function expectHidden(test, element, id) | 
| 62 { | 55 { | 
| 63   let withId = ""; | 56   let withId = ""; | 
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1072     { | 1065     { | 
| 1073       if (element.id == "n2" || element.id == "n2_3") | 1066       if (element.id == "n2" || element.id == "n2_3") | 
| 1074         expectProcessed(test, element, element.id); | 1067         expectProcessed(test, element, element.id); | 
| 1075       else | 1068       else | 
| 1076         expectNotProcessed(test, element, element.id); | 1069         expectNotProcessed(test, element, element.id); | 
| 1077     } | 1070     } | 
| 1078   } | 1071   } | 
| 1079 | 1072 | 
| 1080   test.done(); | 1073   test.done(); | 
| 1081 }; | 1074 }; | 
| LEFT | RIGHT | 
|---|