| LEFT | RIGHT |
| 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 /* eslint-env node */ | 18 /* eslint-env node */ |
| 19 | 19 |
| 20 "use strict"; | 20 "use strict"; |
| 21 | 21 |
| 22 const fs = require("fs"); | 22 const fs = require("fs"); |
| 23 const path = require("path"); | 23 const path = require("path"); |
| 24 | 24 |
| 25 const MemoryFS = require("memory-fs"); | 25 const MemoryFS = require("memory-fs"); |
| 26 const nodeunit = require("nodeunit"); | 26 const nodeunit = require("nodeunit"); |
| 27 const webpack = require("webpack"); | 27 const webpack = require("webpack"); |
| 28 | 28 |
| 29 const chromiumProcess = require("./chromium_process"); | 29 const chromiumRemoteProcess = require("./test/runners/chromium_remote_process"); |
| 30 const firefoxProcess = require("./firefox_process"); | 30 const chromiumProcess = require("./test/runners/chromium_process"); |
| 31 const firefoxProcess = require("./test/runners/firefox_process"); |
| 31 | 32 |
| 32 let unitFiles = []; | 33 let unitFiles = []; |
| 33 let browserFiles = []; | 34 let browserFiles = []; |
| 34 | 35 |
| 35 let runnerDefinitions = { | 36 let runnerDefinitions = { |
| 37 // Chromium with chrome-remote-interface |
| 38 chromium_remote: chromiumRemoteProcess, |
| 39 // Chromium with WebDriver (requires Chromium >= 63.0.3239) |
| 36 chromium: chromiumProcess, | 40 chromium: chromiumProcess, |
| 37 firefox: firefoxProcess | 41 firefox: firefoxProcess |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 function configureRunners() | 44 function configureRunners() |
| 41 { | 45 { |
| 42 let runners = "BROWSER_TEST_RUNNERS" in process.env ? | 46 let runners = "BROWSER_TEST_RUNNERS" in process.env ? |
| 43 process.env.BROWSER_TEST_RUNNERS.split(",") : []; | 47 process.env.BROWSER_TEST_RUNNERS.split(",") : []; |
| 44 | 48 |
| 45 // default is chromium only, for now. | |
| 46 if (runners.length == 0) | 49 if (runners.length == 0) |
| 47 return ["chromium", "firefox"]; | 50 return ["chromium_remote", "firefox"]; |
| 48 | 51 |
| 49 runners.filter(runner => runner in runnerDefinitions); | 52 return runners.filter(runner => runnerDefinitions.hasOwnProperty(runner)); |
| 50 | |
| 51 return runners; | |
| 52 } | 53 } |
| 53 | 54 |
| 54 let runnerProcesses = configureRunners(); | 55 let runnerProcesses = configureRunners(); |
| 55 | 56 |
| 56 function addTestPaths(testPaths, recurse) | 57 function addTestPaths(testPaths, recurse) |
| 57 { | 58 { |
| 58 for (let testPath of testPaths) | 59 for (let testPath of testPaths) |
| 59 { | 60 { |
| 60 let stat = fs.statSync(testPath); | 61 let stat = fs.statSync(testPath); |
| 61 if (stat.isDirectory()) | 62 if (stat.isDirectory()) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 171 |
| 171 Promise.resolve(runBrowserTests(runnerProcesses)).catch(error => | 172 Promise.resolve(runBrowserTests(runnerProcesses)).catch(error => |
| 172 { | 173 { |
| 173 console.error("Failed running browser tests"); | 174 console.error("Failed running browser tests"); |
| 174 console.error(error); | 175 console.error(error); |
| 175 }).then(() => | 176 }).then(() => |
| 176 { | 177 { |
| 177 if (unitFiles.length) | 178 if (unitFiles.length) |
| 178 nodeunit.reporters.default.run(unitFiles); | 179 nodeunit.reporters.default.run(unitFiles); |
| 179 }); | 180 }); |
| LEFT | RIGHT |