Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 if (compiler != 'none' || runtime != 'dartium') { |
| 1170 // TODO(whesse): Enable compilation of scripts to dart2js, and | 1170 // TODO(whesse): Enable compilation of scripts to dart2js, and |
| 1171 // rewriting of script links in html file. Currently unimplemented. | 1171 // rewriting of script links in html file. Currently unimplemented. |
| 1172 return; | 1172 return; |
| 1173 } | 1173 } |
| 1174 final String tempDir = createOutputDirectory(info.filePath, ''); | |
| 1175 final Uri tempUri = new Uri.file('$tempDir/'); | |
| 1176 final Uri htmlFile = tempUri.resolve(filePath.filename); | |
| 1177 new File.fromUri(htmlFile).writeAsStringSync(htmlTest.getContents(info)); | |
| 1174 if (info.scripts.length > 0) { | 1178 if (info.scripts.length > 0) { |
| 1175 // TODO(whesse): Copy scripts into output directory. | 1179 Uri testUri = new Uri.file(filePath.toNativePath()); |
| 1176 return; | 1180 for (String scriptPath in info.scripts) { |
| 1181 if (!scriptPath.endsWith('.dart') && !scriptPath.endsWith('.js')) { | |
| 1182 DebugLogger.warning('HTML test scripts must be dart or javascript: ' | |
|
ricow1
2014/11/05 10:59:54
fail the test?
Bill Hesse
2014/11/05 12:51:51
Done.
| |
| 1183 '${info.filePath}'); | |
| 1184 return; | |
| 1185 | |
| 1186 } | |
| 1187 Uri uri = Uri.parse(scriptPath); | |
| 1188 if (uri.isAbsolute) { | |
| 1189 DebugLogger.warning('HTML test scripts must have relative paths: ' | |
|
ricow1
2014/11/05 10:59:55
fail the test?
Bill Hesse
2014/11/05 12:51:51
Done.
| |
| 1190 '${info.filePath}'); | |
| 1191 return; | |
| 1192 } | |
| 1193 if (uri.pathSegments.length > 1) { | |
| 1194 DebugLogger.warning('HTML test scripts must be in test directory: ' | |
|
ricow1
2014/11/05 10:59:55
fail the test?
Bill Hesse
2014/11/05 12:51:51
Done.
| |
| 1195 '${info.filePath}'); | |
| 1196 return; | |
| 1197 } | |
| 1198 Uri script = testUri.resolveUri(uri); | |
| 1199 if (compiler == 'none') { | |
| 1200 Uri copiedScript = tempUri.resolveUri(uri); | |
| 1201 new File.fromUri(copiedScript).writeAsStringSync( | |
| 1202 new File.fromUri(script).readAsStringSync()); | |
| 1203 } else { | |
| 1204 // TODO(whesse): Compile scripts into output directory. | |
| 1205 DebugLogger.error('HTML test scripts don\'t support dart2js yet: ' | |
|
ricow1
2014/11/05 10:59:55
so can you even land this?
Bill Hesse
2014/11/05 12:51:51
line 1169 skipped all platforms without compiler =
| |
| 1206 '${info.filePath}'); | |
| 1207 exit(1); | |
| 1208 } | |
| 1209 } | |
| 1177 } | 1210 } |
| 1178 final String tempDir = createOutputDirectory(info.filePath, ''); | 1211 new File.fromUri(htmlFile).writeAsStringSync(htmlTest.getContents(info)); |
| 1179 final String htmlFile = '$tempDir/${filePath.filename}'; | |
| 1180 new File(htmlFile).writeAsStringSync(htmlTest.getContents(info)); | |
| 1181 | 1212 |
| 1182 String testDisplayName = '$suiteName/$testName'; | 1213 String testDisplayName = '$suiteName/$testName'; |
| 1183 var htmlPath = _createUrlPathFromFile(new Path(htmlFile)); | 1214 var htmlPath = _createUrlPathFromFile(new Path(htmlFile.toFilePath())); |
| 1184 var fullHtmlPath = _getUriForBrowserTest(info, htmlPath, | 1215 var fullHtmlPath = _getUriForBrowserTest(info, htmlPath, |
| 1185 null, null); | 1216 null, null); |
| 1186 var commands = [CommandBuilder.instance.getBrowserHtmlTestCommand( | 1217 var commands = [CommandBuilder.instance.getBrowserHtmlTestCommand( |
| 1187 runtime, fullHtmlPath, configuration, info.expectedMessages)]; | 1218 runtime, fullHtmlPath, configuration, info.expectedMessages)]; |
| 1188 var testCase = new BrowserTestCase(testDisplayName, | 1219 var testCase = new BrowserTestCase(testDisplayName, |
| 1189 commands, configuration, expectations, | 1220 commands, configuration, expectations, |
| 1190 info, isNegative(info), fullHtmlPath); | 1221 info, isNegative(info), fullHtmlPath); |
| 1191 enqueueNewTestCase(testCase); | 1222 enqueueNewTestCase(testCase); |
| 1192 return; | 1223 return; |
| 1193 } | 1224 } |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2401 * $pass tests are expected to pass | 2432 * $pass tests are expected to pass |
| 2402 * $failOk tests are expected to fail that we won't fix | 2433 * $failOk tests are expected to fail that we won't fix |
| 2403 * $fail tests are expected to fail that we should fix | 2434 * $fail tests are expected to fail that we should fix |
| 2404 * $crash tests are expected to crash that we should fix | 2435 * $crash tests are expected to crash that we should fix |
| 2405 * $timeout tests are allowed to timeout | 2436 * $timeout tests are allowed to timeout |
| 2406 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2437 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2407 """; | 2438 """; |
| 2408 print(report); | 2439 print(report); |
| 2409 } | 2440 } |
| 2410 } | 2441 } |
| OLD | NEW |