| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 * A configuration for running layoutr tests with testrunner. | 6 * A configuration for running layoutr tests with testrunner. |
| 7 * This configuration is similar to the interactive_html_config | 7 * This configuration is similar to the interactive_html_config |
| 8 * as it runs each test in its own IFrame. However, where the former | 8 * as it runs each test in its own IFrame. However, where the former |
| 9 * recreated the IFrame for each test, here the IFrames are preserved. | 9 * recreated the IFrame for each test, here the IFrames are preserved. |
| 10 * Furthermore we post a message on completion. | 10 * Furthermore we post a message on completion. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 Date end = new Date.now(); | 141 Date end = new Date.now(); |
| 142 int elapsed = end.difference(_testStarts[testCase.id]).inMilliseconds; | 142 int elapsed = end.difference(_testStarts[testCase.id]).inMilliseconds; |
| 143 if (testCase.stackTrace != null) { | 143 if (testCase.stackTrace != null) { |
| 144 parentWindow.postMessage( | 144 parentWindow.postMessage( |
| 145 _Message.text(_Message.STACK, elapsed, testCase.stackTrace), '*'); | 145 _Message.text(_Message.STACK, elapsed, testCase.stackTrace), '*'); |
| 146 } | 146 } |
| 147 parentWindow.postMessage( | 147 parentWindow.postMessage( |
| 148 _Message.text(testCase.result, elapsed, testCase.message), '*'); | 148 _Message.text(testCase.result, elapsed, testCase.message), '*'); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void onDone(int passed, int failed, int errors, List<TestCase> results, | 151 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 152 String uncaughtError) { | 152 String uncaughtError) { |
| 153 } |
| 154 |
| 155 void onDone(bool success) { |
| 153 window.on.error.remove(_onErrorClosure); | 156 window.on.error.remove(_onErrorClosure); |
| 154 } | 157 } |
| 155 } | 158 } |
| 156 | 159 |
| 157 /** | 160 /** |
| 158 * The parent configuration runs in the top-level window; it wraps the tests | 161 * The parent configuration runs in the top-level window; it wraps the tests |
| 159 * in new functions that create child IFrames and run the real tests. | 162 * in new functions that create child IFrames and run the real tests. |
| 160 */ | 163 */ |
| 161 class ParentHtmlConfiguration extends Configuration { | 164 class ParentHtmlConfiguration extends Configuration { |
| 162 get autoStart => false; | 165 get autoStart => false; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 270 } |
| 268 | 271 |
| 269 void onTestResult(TestCase testCase) { | 272 void onTestResult(TestCase testCase) { |
| 270 if (!testCase.enabled) return; | 273 if (!testCase.enabled) return; |
| 271 super.onTestResult(testCase); | 274 super.onTestResult(testCase); |
| 272 document.query('#result${testCase.id}').text = | 275 document.query('#result${testCase.id}').text = |
| 273 '${testCase.result}:${testCase.runningTime.inMilliseconds}:' | 276 '${testCase.result}:${testCase.runningTime.inMilliseconds}:' |
| 274 '${testCase.description}//${testCase.message}'; | 277 '${testCase.description}//${testCase.message}'; |
| 275 } | 278 } |
| 276 | 279 |
| 277 void onDone(int passed, int failed, int errors, List<TestCase> results, | 280 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 278 String uncaughtError) { | 281 String uncaughtError) { |
| 282 } |
| 283 void onDone(bool success) { |
| 279 window.on.message.remove(_messageHandler); | 284 window.on.message.remove(_messageHandler); |
| 280 window.on.error.remove(_onErrorClosure); | 285 window.on.error.remove(_onErrorClosure); |
| 281 window.postMessage('done', '*'); // Unblock DRT | 286 window.postMessage('done', '*'); // Unblock DRT |
| 282 } | 287 } |
| 283 } | 288 } |
| 284 | 289 |
| 285 /** | 290 /** |
| 286 * Add the divs to the DOM if they are not present. | 291 * Add the divs to the DOM if they are not present. |
| 287 */ | 292 */ |
| 288 void _prepareDom() { | 293 void _prepareDom() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 301 */ | 306 */ |
| 302 void useHtmlLayoutConfiguration() { | 307 void useHtmlLayoutConfiguration() { |
| 303 if (window.location.search == '') { // This is the parent. | 308 if (window.location.search == '') { // This is the parent. |
| 304 _prepareDom(); | 309 _prepareDom(); |
| 305 configure(new ParentHtmlConfiguration()); | 310 configure(new ParentHtmlConfiguration()); |
| 306 } else { | 311 } else { |
| 307 configure(new ChildHtmlConfiguration()); | 312 configure(new ChildHtmlConfiguration()); |
| 308 } | 313 } |
| 309 } | 314 } |
| 310 | 315 |
| OLD | NEW |