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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/browser_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * DumpRenderTree.
8 */ 8 */
9 9
10 if (navigator.webkitStartDart) { 10 if (navigator.webkitStartDart) {
(...skipping 25 matching lines...) Expand all
36 if (window.compilationError) { 36 if (window.compilationError) {
37 var element = document.createElement('pre'); 37 var element = document.createElement('pre');
38 element.innerHTML = window.compilationError; 38 element.innerHTML = window.compilationError;
39 document.body.appendChild(element); 39 document.body.appendChild(element);
40 window.layoutTestController.notifyDone(); 40 window.layoutTestController.notifyDone();
41 return; 41 return;
42 } 42 }
43 } 43 }
44 44
45 window.addEventListener("DOMContentLoaded", onLoad, false); 45 window.addEventListener("DOMContentLoaded", onLoad, false);
46
47 // If nobody intercepts the error, finish the test.
48 window.addEventListener("error", function(e) {
49 // needed for dartium compilation errors.
50 if (e && e.message) {
51 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.
52 element.innerHTML = e.message;
53 document.body.appendChild(element);
54 }
55 if (window.layoutTestController) {
56 window.layoutTestController.notifyDone();
57 }
58 }, false);
59
60 document.onreadystatechange = function() {
61 if (document.readyState != "loaded") return;
62 // If 'startedDartTest' is not set, that means that the test did not have
63 // a chance to load. This will happen when a load error occurs in the VM.
64 // Give the machine time to start up.
65 setTimeout(function() {
66 // A window.postMessage might have been enqueued after this timeout.
67 // Just sleep another time to give the browser the time to process the
68 // posted message.
69 setTimeout(function() {
70 if (layoutTestController && !layoutTestController.startedDartTest) {
71 layoutTestController.notifyDone();
72 }
73 }, 0);
74 }, 50);
75 };
OLDNEW
« 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