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