diff --git a/client/tests/client/samples/dartcombat/dartcombat_tests.dart b/client/tests/client/samples/dartcombat/dartcombat_tests.dart index 6f5823dfe14..ef6253f0df3 100644 --- a/client/tests/client/samples/dartcombat/dartcombat_tests.dart +++ b/client/tests/client/samples/dartcombat/dartcombat_tests.dart @@ -21,7 +21,7 @@ main() { var link = new Element.tag('link'); link.rel = 'stylesheet'; link.type = 'text/css'; - link.href = '../../samples/dartcombat/dartcombat.css'; + link.href = '../../../client/samples/dartcombat/dartcombat.css'; document.head.nodes.add(link); asyncTest('wait until setup', 1, () { diff --git a/client/tests/client/test_config.dart b/client/tests/client/test_config.dart new file mode 100644 index 00000000000..4dc50a129e1 --- /dev/null +++ b/client/tests/client/test_config.dart @@ -0,0 +1,19 @@ +// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file +// 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. + +#library("client_test_config"); + +#import("../../../tools/testing/dart/test_suite.dart"); + +class ClientTestSuite extends StandardTestSuite { + ClientTestSuite(Map configuration) + : super(configuration, + "client", + "client/tests/client", + ["client/tests/client/client.status"]); + + void isTestFile(String filename) => filename.endsWith("_tests.dart"); + + void listRecursively() => true; +} diff --git a/client/tests/dartc/dartc.status b/client/tests/dartc/dartc.status index bc562a56d48..ec7ba1ce890 100644 --- a/client/tests/dartc/dartc.status +++ b/client/tests/dartc/dartc.status @@ -4,8 +4,6 @@ prefix dartc/client -tests/dartc/test_config.dart: Skip # Not a test case. - dom/scripts/idlparser.dart: Skip # Bogus dartc error; references dart/utils/peg dom/scripts/idlparser_test.dart: Skip # Bogus dartc error; references dart/utils/peg dom/dom_frog.dart: Skip # Frog-only diff --git a/compiler/tests/dartc/dartc.status b/compiler/tests/dartc/dartc.status index 367516514f1..55b35a1a5e9 100644 --- a/compiler/tests/dartc/dartc.status +++ b/compiler/tests/dartc/dartc.status @@ -44,3 +44,7 @@ corelib/SharedTests: Skip [ $component == frogium ] *: Skip + + +[ $component == webdriver ] +*: Skip diff --git a/tools/test.dart b/tools/test.dart index c373427add3..de31ebd18b9 100755 --- a/tools/test.dart +++ b/tools/test.dart @@ -18,6 +18,7 @@ #import("../samples/tests/samples/test_config.dart"); #import("../client/tests/dartc/test_config.dart"); #import("../compiler/tests/dartc/test_config.dart"); +#import("../client/tests/client/test_config.dart"); #import("../frog/tests/frog/test_config.dart"); #import("../frog/tests/leg/test_config.dart"); #import("../frog/tests/leg_only/test_config.dart"); @@ -95,6 +96,9 @@ main() { if (selectors.containsKey('await')) { queue.addTestSuite(new AwaitTestSuite(conf)); } + if (selectors.containsKey('client')) { + queue.addTestSuite(new ClientTestSuite(conf)); + } return true; } diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart index 2a47456cd02..3dabc96c579 100644 --- a/tools/testing/dart/browser_test.dart +++ b/tools/testing/dart/browser_test.dart @@ -20,7 +20,6 @@ String GetHtmlContents(String title,

Running $title

- + """; diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart index 40095a878c0..e49d4d2bfa6 100644 --- a/tools/testing/dart/test_options.dart +++ b/tools/testing/dart/test_options.dart @@ -6,7 +6,7 @@ List defaultTestSelectors = const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', - 'isolate', 'stub-generator', 'vm']; + 'isolate', 'stub-generator', 'vm', 'client']; /** * Specification of a single test option. diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart index e7434682861..ffe10721f21 100644 --- a/tools/testing/dart/test_progress.dart +++ b/tools/testing/dart/test_progress.dart @@ -124,7 +124,7 @@ class ProgressIndicator { print('\nstderr:'); test.output.stderr.forEach((s) => print(s)); } - if (test is BrowserTestCase) { + if (test is BrowserTestCase && test.dynamic.compilerPath != null) { print('\nCompilation command: ${test.dynamic.compilerPath} ' + Strings.join(test.dynamic.compilerArguments, ' ')); } diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart index bd7218e6669..668f015d6d5 100644 --- a/tools/testing/dart/test_suite.dart +++ b/tools/testing/dart/test_suite.dart @@ -244,6 +244,11 @@ class StandardTestSuite implements TestSuite { start = filename.indexOf(directoryPath); testName = filename.substring(start + directoryPath.length + 1, filename.length); + if (configuration['component'] != 'dartc') { + if (testName.endsWith('.dart')) { + testName = testName.substring(0, testName.length - 5); + } + } } Set expectations = testExpectations.expectations(testName); if (configuration["report"]) { @@ -311,6 +316,7 @@ class StandardTestSuite implements TestSuite { // Only run the tests that match the pattern. RegExp pattern = configuration['selectors'][suiteName]; if (!pattern.hasMatch(filename)) return; + if (filename.endsWith('test_config.dart')) return; var optionsFromFile = optionsFromFile(filename); Function createTestCase = makeTestCaseCreator(optionsFromFile); @@ -326,12 +332,15 @@ class StandardTestSuite implements TestSuite { createTestCase(filename, optionsFromFile['isNegative']); } } + void enqueueDartiumTest(String filename, String testName, Map optionsFromFile, Set expectations, bool isNegative) { + // TODO(whesse): Merge with enqueueChromiumTest, using mainly + // enqueueChromiumTest's code and design. if (optionsFromFile['isMultitest']) return; bool isWebTest = optionsFromFile['containsDomImport']; bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; @@ -341,15 +350,17 @@ class StandardTestSuite implements TestSuite { } String tempDirTemplate = '${TestUtils.buildDir(configuration)}/tmp'; - if (isWebTest) tempDirTemplate = 'client/' + tempDirTemplate; Directory tempDir = new Directory(tempDirTemplate); - // TODO(whesse): When implementing client web tests, - // create directory in the client case, if it doesn't exist. tempDir.createTempSync(); String dartTestFilename = new File(filename).fullPathSync(); - String dartWrapperFilename = '${tempDir.path}/test.dart'; - if (!isWebTest) { + String dartWrapperFilename; + String scriptPath; + if (isWebTest) { + scriptPath = 'file://$dartTestFilename'; + } else { + dartWrapperFilename = '${tempDir.path}/test.dart'; + scriptPath = '../../../$dartWrapperFilename'; // test.dart will import the dart test directly, if it is a library, // or indirectly through test_as_library.dart, if it is not. String dartLibraryFilename; @@ -370,21 +381,21 @@ class StandardTestSuite implements TestSuite { '../../../tests/isolate/src/TestFramework.dart', dartLibraryFilename)); dartWrapper.closeSync(); - } else { - return; // TODO(whesse): Implement client web tests on dartium. } // Create the HTML file for the test. + // NOTE: This must be 3 directories below the dart root, due to test + // client/samples/dartcombat containing a relative path to its .css file. File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}'); RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true); htmlTest.writeStringSync(GetHtmlContents( filename, '../../../client/testing/unittest/test_controller.js', scriptType, - '../../../$dartWrapperFilename')); + scriptPath)); htmlTest.closeSync(); for (var vmOptions in optionsFromFile["vmOptions"]) { - var drtFlags = ['-no-timeout']; + var drtFlags = ['--no-timeout']; var dartFlags = ['--enable_asserts', '--enable_type_checks']; dartFlags.addAll(vmOptions); drtFlags.add('--dart-flags=${Strings.join(dartFlags, " ")}'); @@ -435,9 +446,12 @@ class StandardTestSuite implements TestSuite { testNameBase = testRelativePath.substring(start + 4, testRelativePath.length - 5); testRelativeDir = testRelativePath.substring(0, start - 1); - testRelativeDirFlattened = testRelativeDir.replaceAll(pathSeparator, '_'); + testRelativeDirFlattened = testRelativeDir.replaceAll('/', '_'); } else { - Expect.fail('Web tests not imlemented yet'); + Expect.isTrue(testRelativePath.endsWith('_tests.dart')); + start = testRelativePath.lastIndexOf(pathSeparator); + testNameBase = + testRelativePath.substring(start + 1, testRelativePath.length - 11); } if (!new Directory('$dartDir/$buildDir/generated_tests').existsSync()) { @@ -460,6 +474,7 @@ class StandardTestSuite implements TestSuite { '$dartDir/client/testing/unittest/dom_for_unittest.dart'; } + File htmlTestBase; if (!isWebTest) { // test.dart will import the dart test directly, if it is a library, // or indirectly through test_as_library.dart, if it is not. @@ -481,11 +496,15 @@ class StandardTestSuite implements TestSuite { '$dartDir/tests/isolate/src/TestFramework.dart', dartLibraryFilename)); dartWrapper.closeSync(); + htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}'); } else { - return; // TODO(whesse): Implement client web tests on dartium. + dartWrapperFilename = testPath; + // TODO(whesse): Once test.py is retired, adjust the relative path in + // the client/samples/dartcombat test to its css file, remove the + // "../../" from this path, and move this out of the isWebTest guard. + htmlTestBase = new File('${tempDir.path}/../../${getHtmlName(filename)}'); } // Create the HTML file for the test. - File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}'); RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true); htmlTest.writeStringSync(GetHtmlContents( filename, @@ -566,16 +585,7 @@ class StandardTestSuite implements TestSuite { } String getHtmlName(String filename) { - switch (configuration['component']) { - case 'dartium': - return filename.replaceAll(pathSeparator, '_') + 'dartium.html'; - case 'chromium': - case 'frogium': - return 'test.html'; - default: - Expect.fail('Unimplemented component scriptType'); - return null; - } + return filename.replaceAll('/', '_') + configuration['component'] + '.html'; } String get dumpRenderTreeFilename() { diff --git a/tools/testing/test_configuration.py b/tools/testing/test_configuration.py index 486bc488e99..ebda422cafa 100644 --- a/tools/testing/test_configuration.py +++ b/tools/testing/test_configuration.py @@ -269,7 +269,7 @@ class CompilationTestConfiguration(test.TestConfiguration): super(CompilationTestConfiguration, self).__init__(context, root) def ListTests(self, current_path, path, mode, arch, component): - """Searches for *Test.dart files and returns list of TestCases.""" + """Searches for files satisfying IsTest() and returns list of TestCases.""" tests = [] client_path = os.path.normpath(os.path.join(self.root, '..', '..'))