diff --git a/tests/html/html.status b/tests/html/html.status index a4d38d6a48b..485bb40889e 100644 --- a/tests/html/html.status +++ b/tests/html/html.status @@ -2,9 +2,6 @@ # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. -no_linked_scripts_htmltest: Skip # HTML tests are under development -scripts_htmltest: Skip # HTML tests are under development - event_test: Skip # Issue 1996 interactive_test: Skip # Must be run manually. dromaeo_smoke_test: Skip # Issue 14521, 8257 @@ -124,6 +121,8 @@ serialized_script_value_test: Fail websocket_test/websocket: Fail # TODO(efortuna): Issue 7875. canvasrenderingcontext2d_test/drawImage_video_element: Fail # IE does not support drawImage w/ video element canvasrenderingcontext2d_test/drawImage_video_element_dataUrl: Fail # IE does not support drawImage w/ video element +no_linked_scripts_htmltest: Skip # Times out on IE. Issue 21537 +scripts_htmltest: Skip # Times out on IE. Issue 21537 [$runtime == ie10 ] # IE10 Feature support statuses- diff --git a/tests/html/no_linked_scripts_htmltest.html b/tests/html/no_linked_scripts_htmltest.html index ac66485ffed..3ec0861117a 100644 --- a/tests/html/no_linked_scripts_htmltest.html +++ b/tests/html/no_linked_scripts_htmltest.html @@ -27,7 +27,7 @@ END_HTML_DART_TEST parent.postMessage('ko', '*'); window.postMessage('hest', '*'); } - setTimeout(delayed, 5000); + setTimeout(delayed, 500); diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart index 01df915b9e5..41221ac32ba 100644 --- a/tools/testing/dart/test_suite.dart +++ b/tools/testing/dart/test_suite.dart @@ -841,9 +841,7 @@ class StandardTestSuite extends TestSuite { info.optionsFromFile['isMultitest'] ? info.multitestKey : ""); Set expectations = testExpectations.expectations(testName); if (info is HtmlTestInformation) { - if (TestUtils.isBrowserRuntime(configuration['runtime'])) { - enqueueBrowserTest([], null, info, testName, expectations); - } + enqueueHtmlTest(info, testName, expectations); return; } var filePath = info.filePath; @@ -1151,257 +1149,317 @@ class StandardTestSuite extends TestSuite { * subTestName, Set> if we are running a browser multi-test (one * compilation and many browser runs). */ - void enqueueBrowserTest(List baseCommands, - Path packageRoot, - TestInformation info, - String testName, - expectations) { + void enqueueBrowserTest( + List baseCommands, + Path packageRoot, + TestInformation info, + String testName, + expectations) { + RegExp badChars = new RegExp('[-=/]'); + List VmOptionsList = getVmOptions(info.optionsFromFile); + bool multipleOptions = VmOptionsList.length > 1; + for (var vmOptions in VmOptionsList) { + String optionsName = + multipleOptions ? vmOptions.join('-').replaceAll(badChars, '') : ''; + String tempDir = createOutputDirectory(info.filePath, optionsName); + enqueueBrowserTestWithOptions( + baseCommands, + packageRoot, + info, + testName, + expectations, + vmOptions, + tempDir); + } + } + + + void enqueueBrowserTestWithOptions( + List baseCommands, + Path packageRoot, + TestInformation info, + String testName, + expectations, + List vmOptions, + String tempDir) { // TODO(Issue 14651): If we're on dartium, we need to pass [packageRoot] // on to the browser (it may be test specific). - // TODO(kustermann/ricow): This method should be refactored. - Map optionsFromFile = info.optionsFromFile; Path filePath = info.filePath; String filename = filePath.toString(); final String compiler = configuration['compiler']; final String runtime = configuration['runtime']; + final Map optionsFromFile = info.optionsFromFile; - if (info is HtmlTestInformation) { - final String tempDir = createOutputDirectory(info.filePath, ''); - final Uri tempUri = new Uri.file('$tempDir/'); - final Uri htmlFile = tempUri.resolve(filePath.filename); - new File.fromUri(htmlFile).writeAsStringSync(htmlTest.getContents(info)); + final String compilationTempDir = + createCompilationOutputDirectory(info.filePath); - void createFailingTest(String message) { - var msg = "$message: ${info.filePath}"; - DebugLogger.warning(msg); - new File.fromUri(htmlFile).writeAsStringSync( - htmlTest.makeFailingHtmlFile(msg)); - } - if (info.scripts.length > 0) { - Uri testUri = new Uri.file(filePath.toNativePath()); - for (String scriptPath in info.scripts) { - if (!scriptPath.endsWith('.dart') && !scriptPath.endsWith('.js')) { - createFailingTest( - 'HTML test scripts must be dart or javascript: $scriptPath'); - break; - } - Uri uri = Uri.parse(scriptPath); - if (uri.isAbsolute) { - createFailingTest( - 'HTML test scripts must have relative paths: $scriptPath'); - break; - } - if (uri.pathSegments.length > 1) { - createFailingTest( - 'HTML test scripts must be in test directory: $scriptPath'); - break; - } - Uri script = testUri.resolveUri(uri); - if (compiler == 'none' || scriptPath.endsWith('.js')) { - Uri copiedScript = tempUri.resolveUri(uri); - new File.fromUri(copiedScript).writeAsStringSync( - new File.fromUri(script).readAsStringSync()); - } else { - // TODO(21514): Compile scripts into output directory. - createFailingTest('HTML test scripts don\'t support dart2js yet'); - break; - } - } - } + String dartWrapperFilename = '$tempDir/test.dart'; + String compiledDartWrapperFilename = '$compilationTempDir/test.js'; - String testDisplayName = '$suiteName/$testName'; - var htmlPath = _createUrlPathFromFile(new Path(htmlFile.toFilePath())); - var fullHtmlPath = _getUriForBrowserTest(info, htmlPath, - null, null); - var commands = [CommandBuilder.instance.getBrowserHtmlTestCommand( - runtime, fullHtmlPath, configuration, info.expectedMessages)]; - var testCase = new BrowserTestCase(testDisplayName, - commands, configuration, expectations, - info, isNegative(info), fullHtmlPath); - enqueueNewTestCase(testCase); - return; - } + String content = null; + Path dir = filePath.directoryPath; + String nameNoExt = filePath.filenameWithoutExtension; - for (var vmOptions in getVmOptions(optionsFromFile)) { - // Create a unique temporary directory for each set of vmOptions. - // TODO(dart:429): Replace separate replaceAlls with a RegExp when - // replaceAll(RegExp, String) is implemented. - String optionsName = ''; - if (getVmOptions(optionsFromFile).length > 1) { - optionsName = vmOptions.join('-').replaceAll('-','') - .replaceAll('=','') - .replaceAll('/',''); - } - final String compilationTempDir = - createCompilationOutputDirectory(info.filePath); - final String tempDir = createOutputDirectory(info.filePath, optionsName); + Path pngPath = dir.append('$nameNoExt.png'); + Path txtPath = dir.append('$nameNoExt.txt'); + String customHtmlPath = dir.append('$nameNoExt.html').toNativePath(); + File customHtml = new File(customHtmlPath); - String dartWrapperFilename = '$tempDir/test.dart'; - String compiledDartWrapperFilename = '$compilationTempDir/test.js'; + // Construct the command(s) that compile all the inputs needed by the + // browser test. For running Dart in DRT, this will be noop commands. + List commands = []..addAll(baseCommands); - String content = null; - Path dir = filePath.directoryPath; - String nameNoExt = filePath.filenameWithoutExtension; + // Use existing HTML document if available. + String htmlPath; + if (customHtml.existsSync()) { + // If necessary, run the Polymer deploy steps. + // TODO(jmesserly): this should be generalized for any tests that + // require Pub deploy, not just polymer. + if (customHtml.readAsStringSync().contains('