Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: tools/testing/dart/test_suite.dart

Issue 9036009: Add client/tests/client web tests to the test.dart test script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: small changes Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/testing/dart/test_suite.dart
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 93185fa1858ead9d07e7838515a9b91795fb2bbd..8d8c6ddd29fbbde00bd5727bdbe5558b1d8b8c0c 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"]) {
@@ -341,15 +346,20 @@ class StandardTestSuite implements TestSuite {
}
String tempDirTemplate = '${TestUtils.buildDir(configuration)}/tmp';
- if (isWebTest) tempDirTemplate = 'client/' + tempDirTemplate;
+ // if (isWebTest) tempDirTemplate = 'client/' + tempDirTemplate;
ahe 2012/01/02 10:42:23 Delete this line?
Bill Hesse 2012/01/02 12:50:42 Yes. But the real change should be to refactor, a
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';
ahe 2012/01/02 10:42:23 This doesn't work on Windows. Please add an abstra
Bill Hesse 2012/01/02 12:50:42 The Path and URI libraries are the next thing I wi
ahe 2012/01/02 13:00:59 SGTM, I guess a TODO would serve the same purpose.
+ } 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;
@@ -362,7 +372,7 @@ class StandardTestSuite implements TestSuite {
dartLibrary.writeStringSync(WrapDartTestInLibrary(dartTestFilename));
dartLibrary.closeSync();
}
-
+
ahe 2012/01/02 10:42:23 Trailing whitespace.
File file = new File(dartWrapperFilename);
RandomAccessFile dartWrapper = file.openSync(writable: true);
dartWrapper.writeStringSync(DartTestWrapper(
@@ -370,21 +380,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, " ")}');
@@ -437,7 +447,10 @@ class StandardTestSuite implements TestSuite {
testRelativeDir = testRelativePath.substring(0, start - 1);
testRelativeDirFlattened = testRelativeDir.replaceAll(pathSeparator, '_');
} 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 +473,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 +495,16 @@ 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)}');
+ // return; // TODO(whesse): Implement client web tests on dartium.
ahe 2012/01/02 10:42:23 Remove this line.
}
// 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,
@@ -570,8 +589,9 @@ class StandardTestSuite implements TestSuite {
case 'dartium':
return filename.replaceAll(pathSeparator, '_') + 'dartium.html';
ahe 2012/01/02 10:42:23 This doesn't work on Windows. Consider that a wind
Bill Hesse 2012/01/02 12:50:42 Aaarrrrgh.
Bill Hesse 2012/01/03 15:01:35 Now all arguments to this have only forward slashe
case 'chromium':
+ return filename.replaceAll(pathSeparator, '_') + 'chromium.html';
ahe 2012/01/02 10:42:23 Ditto.
case 'frogium':
- return 'test.html';
+ return filename.replaceAll(pathSeparator, '_') + 'frogium.html';
ahe 2012/01/02 10:42:23 Ditto.
default:
Expect.fail('Unimplemented component scriptType');
return null;

Powered by Google App Engine
This is Rietveld 408576698