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

Side by Side Diff: client/testing/unittest/unittestsuite.dart

Issue 8400065: Switch to .setTimeout instead of onContentLoaded to start running tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 * Description text of the current test group. If multiple groups are nested, 6 * Description text of the current test group. If multiple groups are nested,
7 * this will contain all of their text concatenated. 7 * this will contain all of their text concatenated.
8 */ 8 */
9 String _currentGroup = ''; 9 String _currentGroup = '';
10 10
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 * Lazily initializes the test library if not already initialized. 269 * Lazily initializes the test library if not already initialized.
270 */ 270 */
271 _ensureInitialized() { 271 _ensureInitialized() {
272 if (_state != _UNINITIALIZED) return; 272 if (_state != _UNINITIALIZED) return;
273 273
274 _tests = <TestCase>[]; 274 _tests = <TestCase>[];
275 _onErrorClosure = (e) { _onError(e); }; 275 _onErrorClosure = (e) { _onError(e); };
276 276
277 // Immediately queue the suite up. It will run after a timeout (i.e. after 277 // Immediately queue the suite up. It will run after a timeout (i.e. after
278 // main() has returned). 278 // main() has returned).
279 listener(e) { 279 listener() {
280 _currentGroup = ''; 280 _currentGroup = '';
281 _runTests(); 281 _runTests();
282 }; 282 };
283 283
284 try { 284 window.setTimeout(listener, 0);
285 window.dynamic.on.contentLoaded.add(listener);
286 } catch(var e) {
287 // TODO(jacobr): remove this horrible hack to work around dartc bugs.
288 window.dynamic.addEventListener("DOMContentLoaded", listener, false);
289 }
290 285
291 _state = _READY; 286 _state = _READY;
292 } 287 }
293 288
294 /** 289 /**
295 * Wraps an value and provides an "==" operator that can be used to verify that 290 * Wraps an value and provides an "==" operator that can be used to verify that
296 * the value matches a given expectation. 291 * the value matches a given expectation.
297 */ 292 */
298 class Expectation { 293 class Expectation {
299 final _value; 294 final _value;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 '''; 409 ''';
415 410
416 if (stackTrace != null) { 411 if (stackTrace != null) {
417 message += 412 message +=
418 '<tr><td></td><td colspan="2"><pre>${stackTrace}</pre></td></tr>'; 413 '<tr><td></td><td colspan="2"><pre>${stackTrace}</pre></td></tr>';
419 } 414 }
420 } 415 }
421 } 416 }
422 417
423 typedef void TestFunction(); 418 typedef void TestFunction();
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