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

Side by Side Diff: pkg/unittest/test_controller.js

Issue 11339039: Add additional test harness error handling to test_controller. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | no next file » | 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 // Clear the console before every test run.
11 if (typeof console == "object" && typeof console.clear == "function") {
12 console.clear();
ahe 2012/10/30 09:48:51 Unfortunately, I only think this works in Firebug.
13 }
14
15 // Set window onerror to make sure that we catch test harness errors across all
16 // browsers.
17 window.onerror = function (message, url, lineNumber) {
18 showErrorAndExit("\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n");
19 window.postMessage('unittest-suite-external-error', '*');
20 };
21
10 if (navigator.webkitStartDart) { 22 if (navigator.webkitStartDart) {
11 navigator.webkitStartDart(); 23 navigator.webkitStartDart();
12 } 24 }
13 25
14 // testRunner is provided by DRT or WebKit's layout tests. 26 // testRunner is provided by DRT or WebKit's layout tests.
15 // It is not available in selenium tests. 27 // It is not available in selenium tests.
16 var testRunner = window.testRunner || window.layoutTestController; 28 var testRunner = window.testRunner || window.layoutTestController;
17 29
18 var waitForDone = false; 30 var waitForDone = false;
19 31
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 function dartMainRunner(main) { 124 function dartMainRunner(main) {
113 window.postMessage('dart-calling-main', '*'); 125 window.postMessage('dart-calling-main', '*');
114 try { 126 try {
115 main(); 127 main();
116 } catch (e) { 128 } catch (e) {
117 window.postMessage('unittest-suite-fail', '*'); 129 window.postMessage('unittest-suite-fail', '*');
118 return; 130 return;
119 } 131 }
120 window.postMessage('dart-main-done', '*'); 132 window.postMessage('dart-main-done', '*');
121 } 133 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698