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

Side by Side Diff: packages/async/test/restartable_timer_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 | « packages/async/test/null_stream_sink_test.dart ('k') | packages/async/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 'dart:async';
6
7 import 'package:async/async.dart'; 5 import 'package:async/async.dart';
8 import 'package:fake_async/fake_async.dart'; 6 import 'package:fake_async/fake_async.dart';
9 import 'package:test/test.dart'; 7 import 'package:test/test.dart';
10 8
11 main() { 9 main() {
12 test("runs the callback once the duration has elapsed", () { 10 test("runs the callback once the duration has elapsed", () {
13 new FakeAsync().run((async) { 11 new FakeAsync().run((async) {
14 var fired = false; 12 var fired = false;
15 var timer = new RestartableTimer(new Duration(seconds: 5), () { 13 new RestartableTimer(new Duration(seconds: 5), () {
16 fired = true; 14 fired = true;
17 }); 15 });
18 16
19 async.elapse(new Duration(seconds: 4)); 17 async.elapse(new Duration(seconds: 4));
20 expect(fired, isFalse); 18 expect(fired, isFalse);
21 19
22 async.elapse(new Duration(seconds: 1)); 20 async.elapse(new Duration(seconds: 1));
23 expect(fired, isTrue); 21 expect(fired, isTrue);
24 }); 22 });
25 }); 23 });
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 expect(fired, isFalse); 92 expect(fired, isFalse);
95 timer.reset(); 93 timer.reset();
96 94
97 async.elapse(new Duration(seconds: 5)); 95 async.elapse(new Duration(seconds: 5));
98 expect(fired, isTrue); 96 expect(fired, isTrue);
99 }); 97 });
100 }); 98 });
101 99
102 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", () {
103 new FakeAsync().run((async) { 101 new FakeAsync().run((async) {
104 var timer = new RestartableTimer( 102 new RestartableTimer(
105 new Duration(seconds: 5), 103 new Duration(seconds: 5), expectAsync0(() {}, count: 1));
106 expectAsync(() {}, count: 1));
107 async.elapse(new Duration(seconds: 10)); 104 async.elapse(new Duration(seconds: 10));
108 }); 105 });
109 }); 106 });
110 } 107 }
OLDNEW
« no previous file with comments | « packages/async/test/null_stream_sink_test.dart ('k') | packages/async/test/result_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698