| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var childProcess = require("child_process"); | 5 var childProcess = require("child_process"); |
| 6 var fs = require("fs"); | 6 var fs = require("fs"); |
| 7 var path = require("path"); | 7 var path = require("path"); |
| 8 var shell = require("child_process").execSync; | 8 var shell = require("child_process").execSync; |
| 9 | 9 |
| 10 var utils = require("./utils"); | 10 var utils = require("./utils"); |
| 11 | 11 |
| 12 var Flags = { | 12 var Flags = { |
| 13 BUILD_ONLY: "--build-only", | 13 BUILD_ONLY: "--build-only", |
| 14 DEBUG_DEVTOOLS: "--debug-devtools", | 14 DEBUG_DEVTOOLS: "--debug-devtools", |
| 15 TEST_ONLY: "--test-only", | 15 TEST_ONLY: "--test-only", |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 var IS_DEBUG_ENABLED = utils.includes(process.argv, Flags.DEBUG_DEVTOOLS); | 18 var IS_DEBUG_ENABLED = utils.includes(process.argv, Flags.DEBUG_DEVTOOLS); |
| 19 var IS_BUILD_ONLY = utils.includes(process.argv, Flags.BUILD_ONLY); | 19 var IS_BUILD_ONLY = utils.includes(process.argv, Flags.BUILD_ONLY); |
| 20 var IS_TEST_ONLY = utils.includes(process.argv, Flags.TEST_ONLY); | 20 var IS_TEST_ONLY = utils.includes(process.argv, Flags.TEST_ONLY); |
| 21 | 21 |
| 22 var CONTENT_SHELL_ZIP = "content-shell.zip"; | 22 var CONTENT_SHELL_ZIP = "content-shell.zip"; |
| 23 var MAX_CONTENT_SHELLS = 10; | 23 var MAX_CONTENT_SHELLS = 10; |
| 24 var PLATFORM = getPlatform(); | 24 var PLATFORM = getPlatform(); |
| 25 var PYTHON = process.platform === "win32" ? "python.bat" : "python"; | 25 var PYTHON = process.platform === "win32" ? "python.bat" : "python"; |
| 26 | 26 |
| 27 var BLINK_TEST_PATH = path.resolve(__dirname, "..", "..", "..", "..", "..", "bli
nk", "tools", "run_layout_tests.py"); | 27 var TEST_SCRIPT_PATH = path.resolve(__dirname, "..", "..", "..", "Tools", "Scrip
ts", "run-inspector-tests"); |
| 28 var CACHE_PATH = path.resolve(__dirname, "..", ".test_cache"); | 28 var CACHE_PATH = path.resolve(__dirname, "..", ".test_cache"); |
| 29 var TEST_PATH = path.resolve(__dirname, "..", "layout_tests"); |
| 29 var SOURCE_PATH = path.resolve(__dirname, "..", "front_end"); | 30 var SOURCE_PATH = path.resolve(__dirname, "..", "front_end"); |
| 30 | 31 |
| 31 function main(){ | 32 function main(){ |
| 32 if (IS_TEST_ONLY) { | 33 if (IS_TEST_ONLY) { |
| 33 findPreviousUploadedPosition(findMostRecentChromiumCommit()) | 34 findPreviousUploadedPosition(findMostRecentChromiumCommit()) |
| 34 .then(commitPosition => runTests(path.resolve(CACHE_PATH, commitPosi
tion, "out"))); | 35 .then(commitPosition => runTests(path.resolve(CACHE_PATH, commitPosi
tion, "out"))); |
| 35 return; | 36 return; |
| 36 } | 37 } |
| 37 if (!utils.isDir(CACHE_PATH)) | 38 if (!utils.isDir(CACHE_PATH)) |
| 38 fs.mkdirSync(CACHE_PATH); | 39 fs.mkdirSync(CACHE_PATH); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 fs.renameSync(copiedFrontendPath, debugPath); | 219 fs.renameSync(copiedFrontendPath, debugPath); |
| 219 var inspectorBackendCommandsPath = path.resolve(devtoolsResourcesPath, "Insp
ectorBackendCommands.js"); | 220 var inspectorBackendCommandsPath = path.resolve(devtoolsResourcesPath, "Insp
ectorBackendCommands.js"); |
| 220 var supportedCSSPropertiesPath = path.resolve(devtoolsResourcesPath, "Suppor
tedCSSProperties.js"); | 221 var supportedCSSPropertiesPath = path.resolve(devtoolsResourcesPath, "Suppor
tedCSSProperties.js"); |
| 221 utils.copy(inspectorBackendCommandsPath, debugPath); | 222 utils.copy(inspectorBackendCommandsPath, debugPath); |
| 222 utils.copy(supportedCSSPropertiesPath, debugPath); | 223 utils.copy(supportedCSSPropertiesPath, debugPath); |
| 223 } | 224 } |
| 224 | 225 |
| 225 function runTests(buildDirectoryPath) | 226 function runTests(buildDirectoryPath) |
| 226 { | 227 { |
| 227 var testArgs = [ | 228 var testArgs = [ |
| 229 `--layout-tests-directory=${TEST_PATH}`, |
| 228 "--additional-drt-flag=--debug-devtools", | 230 "--additional-drt-flag=--debug-devtools", |
| 229 "--no-pixel-tests", | 231 "--no-pixel-tests", |
| 230 "--build-directory", | 232 "--build-directory", |
| 231 buildDirectoryPath, | 233 buildDirectoryPath, |
| 232 ].concat(getInspectorTests()); | 234 ].concat(getInspectorTests()); |
| 233 if (IS_DEBUG_ENABLED) { | 235 if (IS_DEBUG_ENABLED) { |
| 234 testArgs.push("--additional-drt-flag=--remote-debugging-port=9222"); | 236 testArgs.push("--additional-drt-flag=--remote-debugging-port=9222"); |
| 235 testArgs.push("--time-out-ms=6000000"); | 237 testArgs.push("--time-out-ms=6000000"); |
| 236 console.log("\n============================================="); | 238 console.log("\n============================================="); |
| 237 console.log("Go to: http://localhost:9222/"); | 239 console.log("Go to: http://localhost:9222/"); |
| 238 console.log("Click on link and in console execute: test()"); | 240 console.log("Click on link and in console execute: test()"); |
| 239 console.log("=============================================\n"); | 241 console.log("=============================================\n"); |
| 240 } | 242 } |
| 241 var args = [BLINK_TEST_PATH].concat(testArgs).concat(getTestFlags()); | 243 var args = [TEST_SCRIPT_PATH].concat(testArgs).concat(getTestFlags()); |
| 242 console.log(`Running layout tests with args: ${args}`); | 244 console.log(`Running layout tests with args: ${args}`); |
| 243 childProcess.spawn(PYTHON, args, {stdio: "inherit"}); | 245 childProcess.spawn(PYTHON, args, {stdio: "inherit"}); |
| 244 } | 246 } |
| 245 | 247 |
| 246 function getTestFlags() | 248 function getTestFlags() |
| 247 { | 249 { |
| 248 var flagValues = Object.keys(Flags).map(key => Flags[key]); | 250 var flagValues = Object.keys(Flags).map(key => Flags[key]); |
| 249 return process.argv | 251 return process.argv |
| 250 .slice(2) | 252 .slice(2) |
| 251 .filter(arg => !utils.includes(flagValues, arg) && !utils.includes(arg,
"inspector")); | 253 .filter(arg => !utils.includes(flagValues, arg) && !utils.includes(arg,
"inspector")); |
| 252 } | 254 } |
| 253 | 255 |
| 254 function getInspectorTests() | 256 function getInspectorTests() |
| 255 { | 257 { |
| 256 var specificTests = process.argv.filter(arg => utils.includes(arg, "inspecto
r")); | 258 var specificTests = process.argv.filter(arg => utils.includes(arg, "inspecto
r")); |
| 257 if (specificTests.length) | 259 if (specificTests.length) |
| 258 return specificTests; | 260 return specificTests; |
| 259 return [ | 261 return []; |
| 260 "inspector*", | 262 } |
| 261 "http/tests/inspector*", | |
| 262 ]; | |
| 263 } | |
| OLD | NEW |