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 import 'utils.dart'; | 5 import 'utils.dart'; |
6 | 6 |
7 String getHtmlContents(String title, String scriptType, String scriptPath) { | 7 String dart2jsHtml(String title, String scriptPath) { |
8 return """ | 8 return """ |
9 <!DOCTYPE html> | 9 <!DOCTYPE html> |
10 <html> | 10 <html> |
11 <head> | 11 <head> |
12 <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 12 <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
13 <meta name="dart.unittest" content="full-stack-traces"> | 13 <meta name="dart.unittest" content="full-stack-traces"> |
14 <title> Test $title </title> | 14 <title> Test $title </title> |
15 <style> | 15 <style> |
16 .unittest-table { font-family:monospace; border:1px; } | 16 .unittest-table { font-family:monospace; border:1px; } |
17 .unittest-pass { background: #6b3;} | 17 .unittest-pass { background: #6b3;} |
18 .unittest-fail { background: #d55;} | 18 .unittest-fail { background: #d55;} |
19 .unittest-error { background: #a11;} | 19 .unittest-error { background: #a11;} |
20 </style> | 20 </style> |
21 </head> | 21 </head> |
22 <body> | 22 <body> |
23 <h1> Running $title </h1> | 23 <h1> Running $title </h1> |
24 <script type="text/javascript" | 24 <script type="text/javascript" |
25 src="/root_dart/tools/testing/dart/test_controller.js"> | 25 src="/root_dart/tools/testing/dart/test_controller.js"> |
26 </script> | 26 </script> |
27 <script type="$scriptType" src="$scriptPath" | 27 <script type="text/javascript" src="$scriptPath" |
28 onerror="scriptTagOnErrorCallback(null)" | 28 onerror="scriptTagOnErrorCallback(null)" |
29 defer> | 29 defer> |
30 </script> | 30 </script> |
31 <script type="text/javascript" | 31 <script type="text/javascript" |
32 src="/root_dart/pkg/browser/lib/dart.js"></script> | 32 src="/root_dart/pkg/browser/lib/dart.js"></script> |
33 </body> | 33 </body> |
34 </html>"""; | 34 </html>"""; |
35 } | 35 } |
36 | 36 |
37 /// Generates the HTML template file needed to load and run a dartdevc test in | 37 /// Generates the HTML template file needed to load and run a dartdevc test in |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 async_helper.async_helper.asyncTestInitialize(finish); | 94 async_helper.async_helper.asyncTestInitialize(finish); |
95 | 95 |
96 dart_sdk._isolate_helper.startRootIsolate(function() {}, []); | 96 dart_sdk._isolate_helper.startRootIsolate(function() {}, []); |
97 dartMainRunner($testName.$testName.main); | 97 dartMainRunner($testName.$testName.main); |
98 }); | 98 }); |
99 </script> | 99 </script> |
100 </body> | 100 </body> |
101 </html> | 101 </html> |
102 """; | 102 """; |
103 } | 103 } |
104 | |
105 String dartTestWrapper(String libraryPathComponent) { | |
106 return """ | |
107 import '$libraryPathComponent' as test; | |
108 | |
109 main() { | |
110 print("dart-calling-main"); | |
111 test.main(); | |
112 print("dart-main-done"); | |
113 } | |
114 """; | |
115 } | |
OLD | NEW |