| 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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 String scriptPath = (compiler == 'none') ? | 958 String scriptPath = (compiler == 'none') ? |
| 959 dartWrapperFilename : compiledDartWrapperFilename; | 959 dartWrapperFilename : compiledDartWrapperFilename; |
| 960 scriptPath = _createUrlPathFromFile(new Path(scriptPath)); | 960 scriptPath = _createUrlPathFromFile(new Path(scriptPath)); |
| 961 | 961 |
| 962 // Create the HTML file for the test. | 962 // Create the HTML file for the test. |
| 963 RandomAccessFile htmlTest = | 963 RandomAccessFile htmlTest = |
| 964 new File(htmlPath).openSync(mode: FileMode.WRITE); | 964 new File(htmlPath).openSync(mode: FileMode.WRITE); |
| 965 String content = null; | 965 String content = null; |
| 966 Path dir = filePath.directoryPath; | 966 Path dir = filePath.directoryPath; |
| 967 String nameNoExt = filePath.filenameWithoutExtension; | 967 String nameNoExt = filePath.filenameWithoutExtension; |
| 968 |
| 968 Path pngPath = dir.append('$nameNoExt.png'); | 969 Path pngPath = dir.append('$nameNoExt.png'); |
| 969 Path txtPath = dir.append('$nameNoExt.txt'); | 970 Path txtPath = dir.append('$nameNoExt.txt'); |
| 971 Path customHtmlPath = dir.append('$nameNoExt.html'); |
| 970 Path expectedOutput = null; | 972 Path expectedOutput = null; |
| 971 if (new File(pngPath.toNativePath()).existsSync()) { | 973 |
| 972 expectedOutput = pngPath; | 974 if (new File(customHtmlPath.toNativePath()).existsSync()) { |
| 973 content = getHtmlLayoutContents(scriptType, new Path("$scriptPath")); | 975 // Use existing HTML document if available. |
| 974 } else if (new File(txtPath.toNativePath()).existsSync()) { | 976 htmlPath = customHtmlPath.toNativePath(); |
| 975 expectedOutput = txtPath; | |
| 976 content = getHtmlLayoutContents(scriptType, new Path("$scriptPath")); | |
| 977 } else { | 977 } else { |
| 978 content = getHtmlContents(filename, scriptType, | 978 if (new File(pngPath.toNativePath()).existsSync()) { |
| 979 new Path("$scriptPath")); | 979 expectedOutput = pngPath; |
| 980 content = getHtmlLayoutContents(scriptType, new Path("$scriptPath")); |
| 981 } else if (new File(txtPath.toNativePath()).existsSync()) { |
| 982 expectedOutput = txtPath; |
| 983 content = getHtmlLayoutContents(scriptType, new Path("$scriptPath")); |
| 984 } else { |
| 985 content = getHtmlContents(filename, scriptType, |
| 986 new Path("$scriptPath")); |
| 987 } |
| 988 htmlTest.writeStringSync(content); |
| 989 htmlTest.closeSync(); |
| 980 } | 990 } |
| 981 htmlTest.writeStringSync(content); | |
| 982 htmlTest.closeSync(); | |
| 983 | 991 |
| 984 // Construct the command(s) that compile all the inputs needed by the | 992 // Construct the command(s) that compile all the inputs needed by the |
| 985 // browser test. For running Dart in DRT, this will be noop commands. | 993 // browser test. For running Dart in DRT, this will be noop commands. |
| 986 List<Command> commands = []; | 994 List<Command> commands = []; |
| 987 if (compiler != 'none') { | 995 if (compiler != 'none') { |
| 988 commands.add(_compileCommand( | 996 commands.add(_compileCommand( |
| 989 dartWrapperFilename, compiledDartWrapperFilename, | 997 dartWrapperFilename, compiledDartWrapperFilename, |
| 990 compiler, tempDir, vmOptions, optionsFromFile)); | 998 compiler, tempDir, vmOptions, optionsFromFile)); |
| 991 } | 999 } |
| 992 | 1000 |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1964 * $pass tests are expected to pass | 1972 * $pass tests are expected to pass |
| 1965 * $failOk tests are expected to fail that we won't fix | 1973 * $failOk tests are expected to fail that we won't fix |
| 1966 * $fail tests are expected to fail that we should fix | 1974 * $fail tests are expected to fail that we should fix |
| 1967 * $crash tests are expected to crash that we should fix | 1975 * $crash tests are expected to crash that we should fix |
| 1968 * $timeout tests are allowed to timeout | 1976 * $timeout tests are allowed to timeout |
| 1969 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1977 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1970 """; | 1978 """; |
| 1971 print(report); | 1979 print(report); |
| 1972 } | 1980 } |
| 1973 } | 1981 } |
| OLD | NEW |