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

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

Issue 319983005: pkg/unittest: test cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 6 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
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 library unittest.breath_test;
6
5 import 'dart:async'; 7 import 'dart:async';
6 8
7 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
8 10
9 main() { 11 void main() {
10 // Test the sync test 'breath' feature of unittest. 12 // Test the sync test 'breath' feature of unittest.
11 13
12 group('breath', () { 14 group('breath', () {
13 var sentinel = 0; 15 var sentinel = 0;
14 var start; 16 var start;
15 17
16 test('initial', () { 18 test('initial', () {
17 Timer.run(() { sentinel = 1; }); 19 Timer.run(() { sentinel = 1; });
18 }); 20 });
19 21
20 test('starve', () { 22 test('starve', () {
21 start = new DateTime.now().millisecondsSinceEpoch; 23 start = new DateTime.now().millisecondsSinceEpoch;
22 var now; 24 var now;
23 do { 25 do {
24 expect(sentinel, 0); 26 expect(sentinel, 0);
25 now = new DateTime.now().millisecondsSinceEpoch; 27 now = new DateTime.now().millisecondsSinceEpoch;
26 } while (now - start <= BREATH_INTERVAL); 28 } while (now - start <= BREATH_INTERVAL);
27 }); 29 });
28 30
29 test('breathed', () { 31 test('breathed', () {
30 expect(sentinel, 1); 32 expect(sentinel, 1);
31 }); 33 });
32 }); 34 });
33 } 35 }
34
OLDNEW
« no previous file with comments | « pkg/unittest/test/async_setup_teardown_test.dart ('k') | pkg/unittest/test/completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698