| 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 <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 13 <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 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" src="$controllerScript"></script> | 24 <script type="text/javascript" src="$controllerScript"></script> |
| 25 <script type="text/javascript"> | |
| 26 // If nobody intercepts the error, finish the test. | |
| 27 onerror = function(message, url, lineNumber) { | |
| 28 if (window.layoutTestController) { | |
| 29 window.layoutTestController.notifyDone(); | |
| 30 } | |
| 31 }; | |
| 32 | |
| 33 document.onreadystatechange = function() { | |
| 34 if (document.readyState != "loaded") return; | |
| 35 // If 'startedDartTest' is not set, that means that the test did not have | |
| 36 // a chance to load. This will happen when a load error occurs in the VM. | |
| 37 // Give the machine time to start up. | |
| 38 setTimeout(function() { | |
| 39 // A window.postMessage might have been enqueued after this timeout. | |
| 40 // Just sleep another time to give the browser the time to process the | |
| 41 // posted message. | |
| 42 setTimeout(function() { | |
| 43 if (layoutTestController && !layoutTestController.startedDartTest) { | |
| 44 layoutTestController.notifyDone(); | |
| 45 } | |
| 46 }, 0); | |
| 47 }, 50); | |
| 48 }; | |
| 49 </script> | |
| 50 <script type="$scriptType" src="$sourceScript"></script> | 25 <script type="$scriptType" src="$sourceScript"></script> |
| 51 </body> | 26 </body> |
| 52 </html> | 27 </html> |
| 53 """; | 28 """; |
| 54 | 29 |
| 55 /** | 30 /** |
| 56 * Returns the native [path] converted for use in a URI. | 31 * Returns the native [path] converted for use in a URI. |
| 57 */ | 32 */ |
| 58 nativePathToUri(String path) { | 33 nativePathToUri(String path) { |
| 59 // This regexp matches Windows-like file names. Strictly speaking, | 34 // This regexp matches Windows-like file names. Strictly speaking, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 try { | 64 try { |
| 90 unittest.ensureInitialized(); | 65 unittest.ensureInitialized(); |
| 91 Test.main(); | 66 Test.main(); |
| 92 } catch(var e, var trace) { | 67 } catch(var e, var trace) { |
| 93 unittest.reportTestError( | 68 unittest.reportTestError( |
| 94 e.toString(), trace == null ? '' : trace.toString()); | 69 e.toString(), trace == null ? '' : trace.toString()); |
| 95 } | 70 } |
| 96 } | 71 } |
| 97 """; | 72 """; |
| 98 } | 73 } |
| OLD | NEW |