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 """ |
11 <!DOCTYPE html> | 11 <!DOCTYPE html> |
12 <html> | 12 <html> |
13 <head> | 13 <head> |
14 <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 14 <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
15 <title> Test $title </title> | 15 <title> Test $title </title> |
16 <style> | 16 <style> |
17 .unittest-table { font-family:monospace; border:1px; } | 17 .unittest-table { font-family:monospace; border:1px; } |
18 .unittest-pass { background: #6b3;} | 18 .unittest-pass { background: #6b3;} |
19 .unittest-fail { background: #d55;} | 19 .unittest-fail { background: #d55;} |
20 .unittest-error { background: #a11;} | 20 .unittest-error { background: #a11;} |
21 </style> | 21 </style> |
22 </head> | 22 </head> |
23 <body> | 23 <body> |
24 <h1> Running $title </h1> | 24 <h1> Running $title </h1> |
25 <script type="text/javascript" | 25 <script type="text/javascript" |
26 src="/root_dart/pkg/unittest/lib/test_controller.js"> | 26 src="/root_dart/pkg/unittest/lib/test_controller.js"> |
27 </script> | 27 </script> |
28 <script type="$scriptType" src="$sourceScript" onerror="externalError(null)" | 28 <script type="$scriptType" src="$sourceScript" onerror="externalError(null)"> |
29 defer> | |
30 </script> | 29 </script> |
31 <script type="text/javascript" | 30 <script type="text/javascript" |
32 src="/root_dart/pkg/browser/lib/dart.js"></script> | 31 src="/root_dart/pkg/browser/lib/dart.js"></script> |
33 <script type="text/javascript" | 32 <script type="text/javascript" |
34 src="/root_dart/pkg/browser/lib/interop.js"></script> | 33 src="/root_dart/pkg/browser/lib/interop.js"></script> |
35 </body> | 34 </body> |
36 </html> | 35 </html> |
37 """; | 36 """; |
38 | 37 |
39 String getHtmlLayoutContents(String scriptType, Path sourceScript) => | 38 String getHtmlLayoutContents(String scriptType, Path sourceScript) => |
40 """ | 39 """ |
41 <!DOCTYPE html> | 40 <!DOCTYPE html> |
42 <html> | 41 <html> |
43 <head> | 42 <head> |
44 <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 43 <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
45 </head> | 44 </head> |
46 <body> | 45 <body> |
47 <script type="text/javascript"> | 46 <script type="text/javascript"> |
48 if (navigator.webkitStartDart) navigator.webkitStartDart(); | 47 if (navigator.webkitStartDart) navigator.webkitStartDart(); |
49 </script> | 48 </script> |
50 <script type="$scriptType" src="$sourceScript" defer></script> | 49 <script type="$scriptType" src="$sourceScript"></script> |
51 </body> | 50 </body> |
52 </html> | 51 </html> |
53 """; | 52 """; |
54 | 53 |
55 String dartTestWrapper(bool usePackageImport, String libraryPathComponent) { | 54 String dartTestWrapper(bool usePackageImport, String libraryPathComponent) { |
56 // Tests inside "pkg" import unittest using "package:". All others use a | 55 // Tests inside "pkg" import unittest using "package:". All others use a |
57 // relative path. The imports need to agree, so use a matching form here. | 56 // relative path. The imports need to agree, so use a matching form here. |
58 var unitTest; | 57 var unitTest; |
59 if (usePackageImport) { | 58 if (usePackageImport) { |
60 unitTest = 'package:unittest'; | 59 unitTest = 'package:unittest'; |
61 } else { | 60 } else { |
62 unitTest = '/root_dart/pkg/unittest/lib'; | 61 unitTest = '/root_dart/pkg/unittest/lib'; |
63 } | 62 } |
64 return """ | 63 return """ |
65 library test; | 64 library test; |
66 | 65 |
67 import '$unitTest/unittest.dart' as unittest; | 66 import '$unitTest/unittest.dart' as unittest; |
68 import '$unitTest/html_config.dart' as config; | 67 import '$unitTest/html_config.dart' as config; |
69 import '$libraryPathComponent' as Test; | 68 import '$libraryPathComponent' as Test; |
70 | 69 |
71 main() { | 70 main() { |
72 config.useHtmlConfiguration(); | 71 config.useHtmlConfiguration(); |
73 unittest.group('', Test.main); | 72 unittest.group('', Test.main); |
74 } | 73 } |
75 """; | 74 """; |
76 } | 75 } |
OLD | NEW |