| Left: | ||
| Right: | 
| 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 | 
| 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 glob = require("glob"); | 20 const glob = require("glob"); | 
| 21 const path = require("path"); | 21 const path = require("path"); | 
| 22 const {exec} = require("child_process"); | 22 const {exec} = require("child_process"); | 
| 23 | 23 | 
| 24 function getBrowserBinary(module, browser) | |
| 25 { | |
| 26 let spec = process.env[`${browser.toUpperCase()}_BINARY`]; | |
| 27 let version = module.oldestCompatibleVersion; | |
| 28 | |
| 29 if (spec) | |
| 30 { | |
| 31 if (spec == "installed") | |
| 32 return Promise.resolve(""); | |
| 33 if (spec.startswith("path:")) | |
| 34 return Promise.resolve(spec.substr(5)); | |
| 35 if (spec.startsWith("download:")) | |
| 36 version = spec.substr(9); | |
| 
 
tlucas
2018/09/26 08:20:16
Are we ok with not checking whether someone tries
 
Sebastian Noack
2018/09/26 11:00:20
I am. Since this needs to be explicitly requested,
 
 | |
| 37 } | |
| 38 | |
| 39 return module.ensureBrowser(version); | |
| 40 } | |
| 41 | |
| 24 for (let browser of glob.sync("./test/browsers/*.js")) | 42 for (let browser of glob.sync("./test/browsers/*.js")) | 
| 25 { | 43 { | 
| 26 let module = require(path.resolve(browser)); | 44 let module = require(path.resolve(browser)); | 
| 27 | 45 | 
| 28 describe(module.platform, function() | 46 describe(module.platform, function() | 
| 29 { | 47 { | 
| 30 this.timeout(0); | 48 this.timeout(0); | 
| 31 | 49 | 
| 32 before(function() | 50 before(function() | 
| 33 { | 51 { | 
| 34 return Promise.all([ | 52 return Promise.all([ | 
| 35 module.ensureBrowser(), | 53 getBrowserBinary(module, path.basename(browser, ".js")), | 
| 36 new Promise((resolve, reject) => | 54 new Promise((resolve, reject) => | 
| 37 { | 55 { | 
| 38 exec( | 56 exec( | 
| 39 `bash -c "python build.py devenv -t ${module.platform}"`, | 57 `bash -c "python build.py devenv -t ${module.platform}"`, | 
| 40 (error, stdout, stderr) => | 58 (error, stdout, stderr) => | 
| 41 { | 59 { | 
| 42 if (error) | 60 if (error) | 
| 43 { | 61 { | 
| 44 console.error(stderr); | 62 console.error(stderr); | 
| 45 reject(error); | 63 reject(error); | 
| (...skipping 28 matching lines...) Expand all Loading... | |
| 74 delete require.cache[require.resolve(modulePath)]; | 92 delete require.cache[require.resolve(modulePath)]; | 
| 75 require(modulePath); | 93 require(modulePath); | 
| 76 } | 94 } | 
| 77 | 95 | 
| 78 after(function() | 96 after(function() | 
| 79 { | 97 { | 
| 80 this.driver.quit(); | 98 this.driver.quit(); | 
| 81 }); | 99 }); | 
| 82 }); | 100 }); | 
| 83 } | 101 } | 
| OLD | NEW |