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 * Read the contents of a file [fileName] into a [List] of [String]s. | 6 * Read the contents of a file [fileName] into a [List] of [String]s. |
| 7 * If the file does not exist and [errorIfNoFile] is true, throw an | 7 * If the file does not exist and [errorIfNoFile] is true, throw an |
| 8 * exception, else return an empty list. | 8 * exception, else return an empty list. |
| 9 */ | 9 */ |
| 10 List<String> getFileContents(String filename, bool errorIfNoFile) { | 10 List<String> getFileContents(String filename, bool errorIfNoFile) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 print('$path does not exist.'); | 89 print('$path does not exist.'); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 if (--dirCount == 0) { | 93 if (--dirCount == 0) { |
| 94 onComplete(files); | 94 onComplete(files); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 /** Delete a file. */ | 98 /** Delete a file. */ |
| 99 void deleteFile(String fname) { | 99 bool deleteFile(String fname) { |
| 100 var f = new File(fname); | 100 var f = new File(fname); |
| 101 f.deleteSync(); | 101 try { |
| 102 f.deleteSync(); | |
| 103 } catch (e) { | |
| 104 return false; | |
| 105 } | |
| 106 return true; | |
| 102 } | 107 } |
| 103 | 108 |
| 104 /** Get the name of the layout render file for a test. */ | 109 /** |
| 105 String layoutFileName(String testname) => | 110 * Get the directory that testrunner lives in; we need it to import |
| 106 testname.replaceAll(new RegExp('\.dart\$'), '.render'); | 111 * support files into the generated scripts. |
| 112 */ | |
| 107 | 113 |
| 108 /** Check if a test is a layout render test. renders. | 114 String getRunnerDirectory() { |
|
Siggi Cherem (dart-lang)
2012/09/20 17:37:27
should this be a getter instead?
| |
| 109 */ | 115 var libDirectory = makePathAbsolute(new Options().script); |
| 110 bool isLayoutRenderTest(String testname) { | 116 return libDirectory.substring(0, |
| 111 var layoutname = layoutFileName(testname); | 117 libDirectory.lastIndexOf(Platform.pathSeparator)); |
| 112 var f = new File(layoutname); | |
| 113 return f.existsSync(); | |
| 114 } | 118 } |
| 119 | |
| OLD | NEW |