Chromium Code Reviews| Index: tools/testing/dart/test_suite.dart |
| diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart |
| index 54f12698ee85d277156789d3d1ffd5720376463a..cd9a22d7133605cabad65ba1444ca2b0eb0e12be 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<String> 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<String> 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,19 @@ 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) { |
| + dartTestFilename = dartTestFilename.replaceAll('\\', '/'); |
|
Bill Hesse
2012/01/03 18:29:07
Let's remove these again, since the test doesn't e
|
| + filename = filename.replaceAll('\\', '/'); |
| + 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 +383,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, " ")}'); |
| @@ -418,9 +431,10 @@ class StandardTestSuite implements TestSuite { |
| 'in any file that uses #import or #source'); |
| } |
| - String dartDir = new File('.').fullPathSync(); |
| + filename = filename.replaceAll('\\', '/'); |
| + String dartDir = new File('.').fullPathSync().replaceAll('\\', '/'); |
| String buildDir = TestUtils.buildDir(configuration); |
| - String testPath = new File(filename).fullPathSync(); |
| + String testPath = new File(filename).fullPathSync().replaceAll('\\', '/'); |
| String outputDirBase = '$dartDir/$buildDir/generated_tests/chromium'; |
| Expect.isTrue(testPath.startsWith(dartDir)); |
| @@ -435,9 +449,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 +477,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 +499,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 +588,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() { |