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

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

Issue 524153002: Sharing metatest logic between unittest and scheduled_test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: status fixes Created 6 years, 3 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; 5 library unittest.breath_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 void main() { 11 void main() {
12 // Test the sync test 'breath' feature of unittest. 12 // Test the sync test 'breath' feature of unittest.
13 13
14 group('breath', () { 14 group('breath', () {
15 var sentinel = 0; 15 var sentinel = 0;
16 var start; 16 var start;
17 17
18 test('initial', () { 18 test('initial', () {
19 Timer.run(() { sentinel = 1; }); 19 Timer.run(() {
20 sentinel = 1;
21 });
20 }); 22 });
21 23
22 test('starve', () { 24 test('starve', () {
23 start = new DateTime.now().millisecondsSinceEpoch; 25 start = new DateTime.now().millisecondsSinceEpoch;
24 var now; 26 var now;
25 do { 27 do {
26 expect(sentinel, 0); 28 expect(sentinel, 0);
27 now = new DateTime.now().millisecondsSinceEpoch; 29 now = new DateTime.now().millisecondsSinceEpoch;
28 } while (now - start <= BREATH_INTERVAL); 30 } while (now - start <= BREATH_INTERVAL);
29 }); 31 });
30 32
31 test('breathed', () { 33 test('breathed', () {
32 expect(sentinel, 1); 34 expect(sentinel, 1);
33 }); 35 });
34 }); 36 });
35 } 37 }
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