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 /** | 5 /** |
6 * Test controller logic - used by unit test harness to embed tests in | 6 * Test controller logic - used by unit test harness to embed tests in |
7 * DumpRenderTree. | 7 * conent shell. |
8 */ | 8 */ |
9 | 9 |
10 // Clear the console before every test run - this is Firebug specific code. | 10 // Clear the console before every test run - this is Firebug specific code. |
11 if (typeof console == "object" && typeof console.clear == "function") { | 11 if (typeof console == "object" && typeof console.clear == "function") { |
12 console.clear(); | 12 console.clear(); |
13 } | 13 } |
14 // Set window onerror to make sure that we catch test harness errors across all | 14 // Set window onerror to make sure that we catch test harness errors across all |
15 // browsers. | 15 // browsers. |
16 window.onerror = function (message, url, lineNumber) { | 16 window.onerror = function (message, url, lineNumber) { |
17 if (url) { | 17 if (url) { |
18 showErrorAndExit( | 18 showErrorAndExit( |
19 "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); | 19 "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); |
20 } else { | 20 } else { |
21 showErrorAndExit(message); | 21 showErrorAndExit(message); |
22 } | 22 } |
23 window.postMessage('unittest-suite-external-error', '*'); | 23 window.postMessage('unittest-suite-external-error', '*'); |
24 }; | 24 }; |
25 | 25 |
26 if (navigator.webkitStartDart) { | 26 if (navigator.webkitStartDart) { |
27 navigator.webkitStartDart(); | 27 navigator.webkitStartDart(); |
28 } | 28 } |
29 | 29 |
30 // testRunner is provided by DRT or WebKit's layout tests. | 30 // testRunner is provided by DRT or WebKit's layout tests. |
ricow1
2013/05/27 16:51:59
DRT -> content shell
Anton Muhin
2013/05/28 16:07:58
Done.
| |
31 // It is not available in selenium tests. | 31 // It is not available in selenium tests. |
32 var testRunner = window.testRunner || window.layoutTestController; | 32 var testRunner = window.testRunner || window.layoutTestController; |
33 | 33 |
34 var waitForDone = false; | 34 var waitForDone = false; |
35 | 35 |
36 function notifyStart() { | 36 function notifyStart() { |
37 if (window.opener) { | 37 if (window.opener) { |
38 window.opener.postMessage("STARTING", "*"); | 38 window.opener.postMessage("STARTING", "*"); |
39 } | 39 } |
40 } | 40 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 try { | 152 try { |
153 main(); | 153 main(); |
154 } catch (e) { | 154 } catch (e) { |
155 dartPrint(e); | 155 dartPrint(e); |
156 if (e.stack) dartPrint(e.stack); | 156 if (e.stack) dartPrint(e.stack); |
157 window.postMessage('unittest-suite-fail', '*'); | 157 window.postMessage('unittest-suite-fail', '*'); |
158 return; | 158 return; |
159 } | 159 } |
160 window.postMessage('dart-main-done', '*'); | 160 window.postMessage('dart-main-done', '*'); |
161 } | 161 } |
OLD | NEW |