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

Side by Side Diff: pkg/unittest/test/breath_test.dart

Issue 20115007: Added a way to let the outer event loop run periodically so that things like (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:async';
6
7 import 'package:unittest/unittest.dart';
8
9 main() {
10 // Test the sync test 'breath' feature of unittest.
11
12 group('breath', () {
13 var sentinel = 0;
14 var start;
15
16 test('initial', () {
17 Timer.run(() { sentinel = 1; });
18 });
19
20 test('starve', () {
21 start = new DateTime.now().millisecondsSinceEpoch;
22 var now;
23 do {
24 expect(sentinel, 0);
25 now = new DateTime.now().millisecondsSinceEpoch;
26 } while (now - start <= BREATH_INTERVAL);
27 });
28
29 test('breathed', () {
30 expect(sentinel, 1);
31 });
32 });
33 }
34
OLDNEW
« pkg/unittest/lib/unittest.dart ('K') | « pkg/unittest/lib/unittest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698