Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Unified Diff: lib/unittest/test_controller.js

Issue 10627004: Listen for on.error events in test_controller.js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/testing/dart/browser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/unittest/test_controller.js
diff --git a/lib/unittest/test_controller.js b/lib/unittest/test_controller.js
index 988bfe10fd704039b33116d3ed407854c6d99ca7..d2dabee2139c614be4abb5506422409b91296f45 100644
--- a/lib/unittest/test_controller.js
+++ b/lib/unittest/test_controller.js
@@ -43,3 +43,33 @@ function onLoad(e) {
}
window.addEventListener("DOMContentLoaded", onLoad, false);
+
+// If nobody intercepts the error, finish the test.
+window.addEventListener("error", function(e) {
+ // needed for dartium compilation errors.
+ if (e && e.message) {
+ var element = document.createElement('pre');
Anton Muhin 2012/06/21 14:39:48 It might be worth to refactor failure dealing code
Siggi Cherem (dart-lang) 2012/06/21 15:32:20 Done.
+ element.innerHTML = e.message;
+ document.body.appendChild(element);
+ }
+ if (window.layoutTestController) {
+ window.layoutTestController.notifyDone();
+ }
+}, false);
+
+document.onreadystatechange = function() {
+ if (document.readyState != "loaded") return;
+ // If 'startedDartTest' is not set, that means that the test did not have
+ // a chance to load. This will happen when a load error occurs in the VM.
+ // Give the machine time to start up.
+ setTimeout(function() {
+ // A window.postMessage might have been enqueued after this timeout.
+ // Just sleep another time to give the browser the time to process the
+ // posted message.
+ setTimeout(function() {
+ if (layoutTestController && !layoutTestController.startedDartTest) {
+ layoutTestController.notifyDone();
+ }
+ }, 0);
+ }, 50);
+};
« no previous file with comments | « no previous file | tools/testing/dart/browser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698