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

Side by Side Diff: test/restartable_timer_test.dart

Issue 2161283002: Fix Dart 1.17 strong-mode warnings. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Created 4 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
« no previous file with comments | « pubspec.yaml ('k') | test/result_test.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'package:async/async.dart'; 5 import 'package:async/async.dart';
6 import 'package:fake_async/fake_async.dart'; 6 import 'package:fake_async/fake_async.dart';
7 import 'package:test/test.dart'; 7 import 'package:test/test.dart';
8 8
9 main() { 9 main() {
10 test("runs the callback once the duration has elapsed", () { 10 test("runs the callback once the duration has elapsed", () {
11 new FakeAsync().run((async) { 11 new FakeAsync().run((async) {
12 var fired = false; 12 var fired = false;
13 var timer = new RestartableTimer(new Duration(seconds: 5), () { 13 new RestartableTimer(new Duration(seconds: 5), () {
14 fired = true; 14 fired = true;
15 }); 15 });
16 16
17 async.elapse(new Duration(seconds: 4)); 17 async.elapse(new Duration(seconds: 4));
18 expect(fired, isFalse); 18 expect(fired, isFalse);
19 19
20 async.elapse(new Duration(seconds: 1)); 20 async.elapse(new Duration(seconds: 1));
21 expect(fired, isTrue); 21 expect(fired, isTrue);
22 }); 22 });
23 }); 23 });
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 expect(fired, isFalse); 92 expect(fired, isFalse);
93 timer.reset(); 93 timer.reset();
94 94
95 async.elapse(new Duration(seconds: 5)); 95 async.elapse(new Duration(seconds: 5));
96 expect(fired, isTrue); 96 expect(fired, isTrue);
97 }); 97 });
98 }); 98 });
99 99
100 test("only runs the callback once if the timer isn't reset", () { 100 test("only runs the callback once if the timer isn't reset", () {
101 new FakeAsync().run((async) { 101 new FakeAsync().run((async) {
102 var timer = new RestartableTimer( 102 new RestartableTimer(
103 new Duration(seconds: 5), 103 new Duration(seconds: 5),
104 expectAsync(() {}, count: 1)); 104 expectAsync(() {}, count: 1));
105 async.elapse(new Duration(seconds: 10)); 105 async.elapse(new Duration(seconds: 10));
106 }); 106 });
107 }); 107 });
108 } 108 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/result_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698