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

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

Issue 22420002: Add support for ie in the browser controller (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/test.dart » ('j') | tools/testing/dart/browser_controller.dart » ('J')
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 * conent shell. 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.
(...skipping 27 matching lines...) Expand all
38 if (window != window.parent) { 38 if (window != window.parent) {
39 // We're running in an iframe. 39 // We're running in an iframe.
40 return window.parent; 40 return window.parent;
41 } else if (window.opener) { 41 } else if (window.opener) {
42 // We were opened by another window. 42 // We were opened by another window.
43 return window.opener; 43 return window.opener;
44 } 44 }
45 return null; 45 return null;
46 } 46 }
47 47
48 function notifyStart() {
49 var driver = getDriverWindow();
50 if (driver) {
51 driver.postMessage("STARTING", "*");
52 }
53 }
54
55 function notifyDone() { 48 function notifyDone() {
56 if (testRunner) testRunner.notifyDone(); 49 if (testRunner) testRunner.notifyDone();
57 // To support in browser launching of tests we post back start and result 50 // To support in browser launching of tests we post back start and result
58 // messages to the window.opener. 51 // messages to the window.opener.
59 var driver = getDriverWindow(); 52 var driver = getDriverWindow();
60 if (driver) { 53 if (driver) {
61 driver.postMessage(window.document.body.innerHTML, "*"); 54 driver.postMessage(window.document.body.innerHTML, "*");
62 } 55 }
63 } 56 }
64 57
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return; 144 return;
152 } 145 }
153 var pre = document.createElement("pre"); 146 var pre = document.createElement("pre");
154 pre.appendChild(document.createTextNode(String(msg))); 147 pre.appendChild(document.createTextNode(String(msg)));
155 document.body.appendChild(pre); 148 document.body.appendChild(pre);
156 } 149 }
157 150
158 // dart2js will generate code to call this function instead of calling 151 // dart2js will generate code to call this function instead of calling
159 // Dart [main] directly. The argument is a closure that invokes main. 152 // Dart [main] directly. The argument is a closure that invokes main.
160 function dartMainRunner(main) { 153 function dartMainRunner(main) {
161 // We call notifyStart here to notify the encapsulating browser.
162 notifyStart();
163 window.postMessage('dart-calling-main', '*'); 154 window.postMessage('dart-calling-main', '*');
164 try { 155 try {
165 main(); 156 main();
166 } catch (e) { 157 } catch (e) {
167 dartPrint(e); 158 dartPrint(e);
168 if (e.stack) dartPrint(e.stack); 159 if (e.stack) dartPrint(e.stack);
169 window.postMessage('unittest-suite-fail', '*'); 160 window.postMessage('unittest-suite-fail', '*');
170 return; 161 return;
171 } 162 }
172 window.postMessage('dart-main-done', '*'); 163 window.postMessage('dart-main-done', '*');
173 } 164 }
OLDNEW
« no previous file with comments | « no previous file | tools/test.dart » ('j') | tools/testing/dart/browser_controller.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698