| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 String GetHtmlContents(String title, | 5 String GetHtmlContents(String title, |
| 6 String controllerScript, | 6 String controllerScript, |
| 7 String scriptType, | 7 String scriptType, |
| 8 String sourceScript) => | 8 String sourceScript) => |
| 9 """ | 9 """ |
| 10 <!DOCTYPE html> | 10 <!DOCTYPE html> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 return path.replaceAll('\\', '/'); | 42 return path.replaceAll('\\', '/'); |
| 43 } | 43 } |
| 44 | 44 |
| 45 String WrapDartTestInLibrary(String test) => | 45 String WrapDartTestInLibrary(String test) => |
| 46 """ | 46 """ |
| 47 #library('libraryWrapper'); | 47 #library('libraryWrapper'); |
| 48 #source('${nativePathToUri(test)}'); | 48 #source('${nativePathToUri(test)}'); |
| 49 """; | 49 """; |
| 50 | 50 |
| 51 String DartTestWrapper(String dartHome, String library) { | 51 String DartTestWrapper(String dartHome, String library, String filter) { |
| 52 dartHome = nativePathToUri(dartHome); | 52 dartHome = nativePathToUri(dartHome); |
| 53 library = nativePathToUri(library); | 53 library = nativePathToUri(library); |
| 54 return """ | 54 return """ |
| 55 #library('test'); | 55 #library('test'); |
| 56 | 56 |
| 57 #import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest'); | 57 #import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest'); |
| 58 #import('${dartHome}/lib/unittest/html_config.dart', prefix: 'config'); | 58 #import('${dartHome}/lib/unittest/html_config.dart', prefix: 'config'); |
| 59 | 59 |
| 60 #import('${library}', prefix: "Test"); | 60 #import('${library}', prefix: "Test"); |
| 61 | 61 |
| 62 main() { | 62 main() { |
| 63 config.useHtmlConfiguration(); | 63 config.useHtmlConfiguration(); |
| 64 try { | 64 try { |
| 65 unittest.ensureInitialized(); | 65 unittest.ensureInitialized(); |
| 66 unittest.setFilter('$filter'); |
| 66 Test.main(); | 67 Test.main(); |
| 67 } catch(var e, var trace) { | 68 } catch(var e, var trace) { |
| 68 unittest.reportTestError( | 69 unittest.reportTestError( |
| 69 e.toString(), trace == null ? '' : trace.toString()); | 70 e.toString(), trace == null ? '' : trace.toString()); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 """; | 73 """; |
| 73 } | 74 } |
| OLD | NEW |