| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 simple unit test library for running tests in a browser. | 6 * A simple unit test library for running tests in a browser. |
| 7 */ | 7 */ |
| 8 library unittest.html_config; | 8 library unittest.html_config; |
| 9 | 9 |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 void processMessage(e) { | 128 void processMessage(e) { |
| 129 if ('unittest-suite-external-error' == e.data) { | 129 if ('unittest-suite-external-error' == e.data) { |
| 130 handleExternalError('<unknown>', '(external error detected)'); | 130 handleExternalError('<unknown>', '(external error detected)'); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void onInit() { | 134 void onInit() { |
| 135 // For Dart internal tests, we want to turn off stack frame | 135 // For Dart internal tests, we want to turn off stack frame |
| 136 // filtering, which we do with this meta-header. | 136 // filtering, which we do with this meta-header. |
| 137 var meta = query('meta[name="dart.unittest"]'); | 137 var meta = querySelector('meta[name="dart.unittest"]'); |
| 138 filterStacks = meta == null ? true : | 138 filterStacks = meta == null ? true : |
| 139 !meta.content.contains('full-stack-traces'); | 139 !meta.content.contains('full-stack-traces'); |
| 140 _installHandlers(); | 140 _installHandlers(); |
| 141 window.postMessage('unittest-suite-wait-for-done', '*'); | 141 window.postMessage('unittest-suite-wait-for-done', '*'); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void onStart() { | 144 void onStart() { |
| 145 // If the URL has a #testFilter=testName then filter tests to that. | 145 // If the URL has a #testFilter=testName then filter tests to that. |
| 146 // This is used to make it easy to run a single test- but is only intended | 146 // This is used to make it easy to run a single test- but is only intended |
| 147 // for interactive debugging scenarios. | 147 // for interactive debugging scenarios. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 169 window.postMessage('unittest-suite-done', '*'); | 169 window.postMessage('unittest-suite-done', '*'); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void useHtmlConfiguration([bool isLayoutTest = false]) { | 173 void useHtmlConfiguration([bool isLayoutTest = false]) { |
| 174 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; | 174 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; |
| 175 } | 175 } |
| 176 | 176 |
| 177 final _singletonLayout = new HtmlConfiguration(true); | 177 final _singletonLayout = new HtmlConfiguration(true); |
| 178 final _singletonNotLayout = new HtmlConfiguration(false); | 178 final _singletonNotLayout = new HtmlConfiguration(false); |
| OLD | NEW |