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

Side by Side Diff: tests/html/async_window_test.dart

Issue 12793003: Rename Timer.repeating to Timer.periodic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 library AsyncWindowTest; 1 library AsyncWindowTest;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart'; 3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 main() { 7 main() {
8 useHtmlConfiguration(); 8 useHtmlConfiguration();
9 test('Timer', () { 9 test('Timer', () {
10 new Timer(const Duration(milliseconds: 10), expectAsync0((){})); 10 new Timer(const Duration(milliseconds: 10), expectAsync0((){}));
11 }); 11 });
12 test('Timer.repeating', () { 12 test('Timer.periodic', () {
13 int counter = 0; 13 int counter = 0;
14 int id = null; 14 int id = null;
15 new Timer.repeating(const Duration(milliseconds: 10), 15 new Timer.periodic(const Duration(milliseconds: 10),
16 expectAsyncUntil1( 16 expectAsyncUntil1(
17 (timer) { 17 (timer) {
18 if (counter == 3) { 18 if (counter == 3) {
19 counter = 1024; 19 counter = 1024;
20 timer.cancel(); 20 timer.cancel();
21 // Wait some more time to be sure callback won't be invoked any 21 // Wait some more time to be sure callback won't be invoked any
22 // more. 22 // more.
23 new Timer(const Duration(milliseconds: 50), expectAsync0((){})); 23 new Timer(const Duration(milliseconds: 50), expectAsync0((){}));
24 return; 24 return;
25 } 25 }
26 // As callback should have been cleared on 4th invocation, counter 26 // As callback should have been cleared on 4th invocation, counter
27 // should never be greater than 3. 27 // should never be greater than 3.
28 assert(counter < 3); 28 assert(counter < 3);
29 counter++; 29 counter++;
30 }, 30 },
31 () => counter == 3)); 31 () => counter == 3));
32 }); 32 });
33 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698