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> |
11 <html> | 11 <html> |
12 <head> | 12 <head> |
13 <title> Test $title </title> | 13 <title> Test $title </title> |
14 <style> | 14 <style> |
15 .unittest-table { font-family:monospace; border:1px; } | 15 .unittest-table { font-family:monospace; border:1px; } |
16 .unittest-pass { background: #6b3;} | 16 .unittest-pass { background: #6b3;} |
17 .unittest-fail { background: #d55;} | 17 .unittest-fail { background: #d55;} |
18 .unittest-error { background: #a11;} | 18 .unittest-error { background: #a11;} |
19 </style> | 19 </style> |
20 </head> | 20 </head> |
21 <body> | 21 <body> |
22 <h1> Running $title </h1> | 22 <h1> Running $title </h1> |
23 <script type="text/javascript" src="$controllerScript"></script> | 23 <script type="text/javascript" src="$controllerScript"></script> |
24 <script type="text/javascript"> | 24 <script type="text/javascript"> |
25 // If nobody intercepts the error, finish the test. | 25 // If nobody intercepts the error, finish the test. |
26 onerror = function(message, url, lineNumber) { | 26 onerror = function() { window.layoutTestController.notifyDone() }; |
27 if (window.layoutTestController) { | |
28 window.layoutTestController.notifyDone(); | |
29 } | |
30 }; | |
31 | 27 |
32 document.onreadystatechange = function() { | 28 document.onreadystatechange = function() { |
33 if (document.readyState != "loaded") return; | 29 if (document.readyState != "loaded") return; |
34 // If 'startedDartTest' is not set, that means that the test did not have | 30 // If 'startedDartTest' is not set, that means that the test did not have |
35 // a chance to load. This will happen when a load error occurs in the VM. | 31 // a chance to load. This will happen when a load error occurs in the VM. |
36 // Give the machine time to start up. | 32 // Give the machine time to start up. |
37 setTimeout(function() { | 33 setTimeout(function() { |
38 // A window.postMessage might have been enqueued after this timeout. | 34 // A window.postMessage might have been enqueued after this timeout. |
39 // Just sleep another time to give the browser the time to process the | 35 // Just sleep another time to give the browser the time to process the |
40 // posted message. | 36 // posted message. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 waitForDone(); | 95 waitForDone(); |
100 } else { | 96 } else { |
101 pass(); | 97 pass(); |
102 } | 98 } |
103 mainIsFinished = true; | 99 mainIsFinished = true; |
104 } catch(var e, var trace) { | 100 } catch(var e, var trace) { |
105 fail(e, trace); | 101 fail(e, trace); |
106 } | 102 } |
107 } | 103 } |
108 """; | 104 """; |
OLD | NEW |