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

Side by Side Diff: tests/standalone/src/TimerCancelTest.dart

Issue 8992007: Make the repeating argument to timers optional. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 9 years 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
« no previous file with comments | « tests/standalone/src/TimerCancel2Test.dart ('k') | tests/standalone/src/TimerRepeatTest.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class TimerCancelTest { 5 class TimerCancelTest {
6 6
7 static void testSimpleTimer() { 7 static void testSimpleTimer() {
8 8
9 void timeoutHandlerUnreachable(Timer timer) { 9 void timeoutHandlerUnreachable(Timer timer) {
10 Expect.equals(true, false); 10 Expect.equals(true, false);
11 } 11 }
12 12
13 void timeoutHandler(Timer timer) { 13 void timeoutHandler(Timer timer) {
14 cancelTimer.cancel(); 14 cancelTimer.cancel();
15 } 15 }
16 16
17 void timeoutHandlerRepeat(Timer timer) { 17 void timeoutHandlerRepeat(Timer timer) {
18 repeatTimer++; 18 repeatTimer++;
19 timer.cancel(); 19 timer.cancel();
20 Expect.equals(true, repeatTimer == 1); 20 Expect.equals(true, repeatTimer == 1);
21 } 21 }
22 22
23 cancelTimer = new Timer(timeoutHandlerUnreachable, 1000, false); 23 cancelTimer = new Timer(timeoutHandlerUnreachable, 1000);
24 cancelTimer.cancel(); 24 cancelTimer.cancel();
25 new Timer(timeoutHandler, 1000, false); 25 new Timer(timeoutHandler, 1000);
26 cancelTimer = new Timer(timeoutHandlerUnreachable, 2000, false); 26 cancelTimer = new Timer(timeoutHandlerUnreachable, 2000);
27 repeatTimer = 0; 27 repeatTimer = 0;
28 new Timer(timeoutHandlerRepeat, 1500, true); 28 new Timer.repeating(timeoutHandlerRepeat, 1500);
29 } 29 }
30 30
31 static void testMain() { 31 static void testMain() {
32 testSimpleTimer(); 32 testSimpleTimer();
33 } 33 }
34 34
35 static Timer cancelTimer; 35 static Timer cancelTimer;
36 static int repeatTimer; 36 static int repeatTimer;
37 } 37 }
38 38
39 main() { 39 main() {
40 TimerCancelTest.testMain(); 40 TimerCancelTest.testMain();
41 } 41 }
OLDNEW
« no previous file with comments | « tests/standalone/src/TimerCancel2Test.dart ('k') | tests/standalone/src/TimerRepeatTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698