| 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 part of test_suite; | 5 part of test_suite; |
| 6 | 6 |
| 7 String getHtmlContents(String title, | 7 String getHtmlContents(String title, |
| 8 String scriptType, | 8 String scriptType, |
| 9 Path sourceScript) => | 9 Path sourceScript) => |
| 10 """ | 10 """ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 </head> | 48 </head> |
| 49 <body> | 49 <body> |
| 50 <script type="text/javascript"> | 50 <script type="text/javascript"> |
| 51 if (navigator.webkitStartDart) navigator.webkitStartDart(); | 51 if (navigator.webkitStartDart) navigator.webkitStartDart(); |
| 52 </script> | 52 </script> |
| 53 <script type="$scriptType" src="$sourceScript" defer></script> | 53 <script type="$scriptType" src="$sourceScript" defer></script> |
| 54 </body> | 54 </body> |
| 55 </html> | 55 </html> |
| 56 """; | 56 """; |
| 57 | 57 |
| 58 String dartUnittestWrapper(bool usePackageImport, String libraryPathComponent) { | |
| 59 // Tests inside "pkg" import unittest using "package:". All others use a | |
| 60 // relative path. The imports need to agree, so use a matching form here. | |
| 61 var unitTest; | |
| 62 if (usePackageImport) { | |
| 63 unitTest = 'package:unittest'; | |
| 64 } else { | |
| 65 unitTest = '/root_dart/pkg/unittest/lib'; | |
| 66 } | |
| 67 return """ | |
| 68 library test; | |
| 69 | |
| 70 import '$unitTest/unittest.dart' as unittest; | |
| 71 import '$unitTest/html_config.dart' as config; | |
| 72 import '$libraryPathComponent' as Test; | |
| 73 | |
| 74 main() { | |
| 75 config.useHtmlConfiguration(); | |
| 76 unittest.group('', Test.main); | |
| 77 } | |
| 78 """; | |
| 79 } | |
| 80 | |
| 81 String dartTestWrapper(String libraryPathComponent) { | 58 String dartTestWrapper(String libraryPathComponent) { |
| 82 return """ | 59 return """ |
| 83 import '$libraryPathComponent' as test; | 60 import '$libraryPathComponent' as test; |
| 84 | 61 |
| 85 main() { | 62 main() { |
| 86 print("dart-calling-main"); | 63 print("dart-calling-main"); |
| 87 test.main(); | 64 test.main(); |
| 88 print("dart-main-done"); | 65 print("dart-main-done"); |
| 89 } | 66 } |
| 90 """; | 67 """; |
| 91 } | 68 } |
| OLD | NEW |