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

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 705733003: Support dart and js scripts in HTML tests, on dartium. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/html_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 1159
1160 // TODO(kustermann/ricow): This method should be refactored. 1160 // TODO(kustermann/ricow): This method should be refactored.
1161 Map optionsFromFile = info.optionsFromFile; 1161 Map optionsFromFile = info.optionsFromFile;
1162 Path filePath = info.filePath; 1162 Path filePath = info.filePath;
1163 String filename = filePath.toString(); 1163 String filename = filePath.toString();
1164 1164
1165 final String compiler = configuration['compiler']; 1165 final String compiler = configuration['compiler'];
1166 final String runtime = configuration['runtime']; 1166 final String runtime = configuration['runtime'];
1167 1167
1168 if (info is HtmlTestInformation) { 1168 if (info is HtmlTestInformation) {
1169 if (compiler != 'none' || runtime != 'dartium') { 1169 final String tempDir = createOutputDirectory(info.filePath, '');
1170 // TODO(whesse): Enable compilation of scripts to dart2js, and 1170 final Uri tempUri = new Uri.file('$tempDir/');
1171 // rewriting of script links in html file. Currently unimplemented. 1171 final Uri htmlFile = tempUri.resolve(filePath.filename);
1172 return; 1172 new File.fromUri(htmlFile).writeAsStringSync(htmlTest.getContents(info));
1173
1174 void createFailingTest(String message) {
1175 var msg = "$message: ${info.filePath}";
1176 DebugLogger.warning(msg);
1177 new File.fromUri(htmlFile).writeAsStringSync(
1178 htmlTest.makeFailingHtmlFile(msg));
1173 } 1179 }
1174 if (info.scripts.length > 0) { 1180 if (info.scripts.length > 0) {
1175 // TODO(whesse): Copy scripts into output directory. 1181 Uri testUri = new Uri.file(filePath.toNativePath());
1176 return; 1182 for (String scriptPath in info.scripts) {
1183 if (!scriptPath.endsWith('.dart') && !scriptPath.endsWith('.js')) {
1184 createFailingTest(
1185 'HTML test scripts must be dart or javascript: $scriptPath');
1186 break;
1187 }
1188 Uri uri = Uri.parse(scriptPath);
1189 if (uri.isAbsolute) {
1190 createFailingTest(
1191 'HTML test scripts must have relative paths: $scriptPath');
1192 break;
1193 }
1194 if (uri.pathSegments.length > 1) {
1195 createFailingTest(
1196 'HTML test scripts must be in test directory: $scriptPath');
1197 break;
1198 }
1199 Uri script = testUri.resolveUri(uri);
1200 if (compiler == 'none' || scriptPath.endsWith('.js')) {
1201 Uri copiedScript = tempUri.resolveUri(uri);
1202 new File.fromUri(copiedScript).writeAsStringSync(
1203 new File.fromUri(script).readAsStringSync());
1204 } else {
1205 // TODO(21514): Compile scripts into output directory.
1206 createFailingTest('HTML test scripts don\'t support dart2js yet');
1207 break;
1208 }
1209 }
1177 } 1210 }
1178 final String tempDir = createOutputDirectory(info.filePath, '');
1179 final String htmlFile = '$tempDir/${filePath.filename}';
1180 new File(htmlFile).writeAsStringSync(htmlTest.getContents(info));
1181 1211
1182 String testDisplayName = '$suiteName/$testName'; 1212 String testDisplayName = '$suiteName/$testName';
1183 var htmlPath = _createUrlPathFromFile(new Path(htmlFile)); 1213 var htmlPath = _createUrlPathFromFile(new Path(htmlFile.toFilePath()));
1184 var fullHtmlPath = _getUriForBrowserTest(info, htmlPath, 1214 var fullHtmlPath = _getUriForBrowserTest(info, htmlPath,
1185 null, null); 1215 null, null);
1186 var commands = [CommandBuilder.instance.getBrowserHtmlTestCommand( 1216 var commands = [CommandBuilder.instance.getBrowserHtmlTestCommand(
1187 runtime, fullHtmlPath, configuration, info.expectedMessages)]; 1217 runtime, fullHtmlPath, configuration, info.expectedMessages)];
1188 var testCase = new BrowserTestCase(testDisplayName, 1218 var testCase = new BrowserTestCase(testDisplayName,
1189 commands, configuration, expectations, 1219 commands, configuration, expectations,
1190 info, isNegative(info), fullHtmlPath); 1220 info, isNegative(info), fullHtmlPath);
1191 enqueueNewTestCase(testCase); 1221 enqueueNewTestCase(testCase);
1192 return; 1222 return;
1193 } 1223 }
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 * $pass tests are expected to pass 2431 * $pass tests are expected to pass
2402 * $failOk tests are expected to fail that we won't fix 2432 * $failOk tests are expected to fail that we won't fix
2403 * $fail tests are expected to fail that we should fix 2433 * $fail tests are expected to fail that we should fix
2404 * $crash tests are expected to crash that we should fix 2434 * $crash tests are expected to crash that we should fix
2405 * $timeout tests are allowed to timeout 2435 * $timeout tests are allowed to timeout
2406 * $compileErrorSkip tests are skipped on browsers due to compile-time error 2436 * $compileErrorSkip tests are skipped on browsers due to compile-time error
2407 """; 2437 """;
2408 print(report); 2438 print(report);
2409 } 2439 }
2410 } 2440 }
OLDNEW
« no previous file with comments | « tools/testing/dart/html_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698