Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * conent shell. | 7 * conent shell. |
| 8 * | |
| 9 * *NOTE*: this is a fork of package:unittest/test_controller.js. | |
| 10 * It has been modified to work with package:polymer/boot.js. | |
|
kustermann
2013/08/28 17:56:45
This is really bad. We should not fork!
It's reall
Jennifer Messerly
2013/08/28 18:11:06
agreed, we already have a copy in polymer/lib/test
Siggi Cherem (dart-lang)
2013/08/28 18:21:10
I was also thinking of the same approach =)
| |
| 8 */ | 11 */ |
| 9 | 12 |
| 10 // Clear the console before every test run - this is Firebug specific code. | 13 // Clear the console before every test run - this is Firebug specific code. |
| 11 if (typeof console == "object" && typeof console.clear == "function") { | 14 if (typeof console == "object" && typeof console.clear == "function") { |
| 12 console.clear(); | 15 console.clear(); |
| 13 } | 16 } |
| 14 // Set window onerror to make sure that we catch test harness errors across all | 17 // Set window onerror to make sure that we catch test harness errors across all |
| 15 // browsers. | 18 // browsers. |
| 16 window.onerror = function (message, url, lineNumber) { | 19 window.onerror = function (message, url, lineNumber) { |
| 17 if (url) { | 20 if (url) { |
| 18 showErrorAndExit( | 21 showErrorAndExit( |
| 19 "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); | 22 "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); |
| 20 } else { | 23 } else { |
| 21 showErrorAndExit(message); | 24 showErrorAndExit(message); |
| 22 } | 25 } |
| 23 window.postMessage('unittest-suite-external-error', '*'); | 26 window.postMessage('unittest-suite-external-error', '*'); |
| 24 }; | 27 }; |
| 25 | 28 |
| 26 if (navigator.webkitStartDart) { | |
| 27 navigator.webkitStartDart(); | |
| 28 } | |
|
kustermann
2013/08/28 17:56:45
Why did you remove this?
This is needed for darti
Jennifer Messerly
2013/08/28 18:11:06
Polymer's "boot.js" knows how to start Dartium. Th
| |
| 29 | |
| 30 // testRunner is provided by content shell. | 29 // testRunner is provided by content shell. |
| 31 // It is not available in selenium tests. | 30 // It is not available in selenium tests. |
| 32 var testRunner = window.testRunner || window.layoutTestController; | 31 var testRunner = window.testRunner || window.layoutTestController; |
| 33 | 32 |
| 34 var waitForDone = false; | 33 var waitForDone = false; |
| 35 | 34 |
| 36 // Returns the driving window object if available | 35 // Returns the driving window object if available |
| 37 function getDriverWindow() { | 36 function getDriverWindow() { |
| 38 if (window != window.parent) { | 37 if (window != window.parent) { |
| 39 // We're running in an iframe. | 38 // We're running in an iframe. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 try { | 163 try { |
| 165 main(); | 164 main(); |
| 166 } catch (e) { | 165 } catch (e) { |
| 167 dartPrint(e); | 166 dartPrint(e); |
| 168 if (e.stack) dartPrint(e.stack); | 167 if (e.stack) dartPrint(e.stack); |
| 169 window.postMessage('unittest-suite-fail', '*'); | 168 window.postMessage('unittest-suite-fail', '*'); |
| 170 return; | 169 return; |
| 171 } | 170 } |
| 172 window.postMessage('dart-main-done', '*'); | 171 window.postMessage('dart-main-done', '*'); |
| 173 } | 172 } |
| OLD | NEW |