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

Unified Diff: tests/isolate/timer_cancel_test.dart

Issue 12213092: Rework Timer interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/isolate/timer_cancel2_test.dart ('k') | tests/isolate/timer_isolate_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/timer_cancel_test.dart
diff --git a/tests/isolate/timer_cancel_test.dart b/tests/isolate/timer_cancel_test.dart
index d610fecbb4a9c88acc12e70712706f1d4a19530a..bc4376b211437d7018d2483178c37ce49924a936 100644
--- a/tests/isolate/timer_cancel_test.dart
+++ b/tests/isolate/timer_cancel_test.dart
@@ -9,15 +9,16 @@ import 'dart:isolate';
import '../../pkg/unittest/lib/unittest.dart';
main() {
+ final ms = const Duration(milliseconds: 1);
test("simple timer", () {
Timer cancelTimer;
int repeatTimer;
- void unreachable(Timer timer) {
+ void unreachable() {
fail("should not be reached");
}
- void handler(Timer timer) {
+ void handler() {
cancelTimer.cancel();
}
@@ -27,17 +28,17 @@ main() {
expect(repeatTimer, 1);
}
- cancelTimer = new Timer(1000, expectAsync1(unreachable, count: 0));
+ cancelTimer = new Timer(ms * 1000, expectAsync0(unreachable, count: 0));
cancelTimer.cancel();
- new Timer(1000, expectAsync1(handler));
- cancelTimer = new Timer(2000, expectAsync1(unreachable, count: 0));
+ new Timer(ms * 1000, expectAsync0(handler));
+ cancelTimer = new Timer(ms * 2000, expectAsync0(unreachable, count: 0));
repeatTimer = 0;
- new Timer.repeating(1500, expectAsync1(repeatHandler));
+ new Timer.repeating(ms * 1500, expectAsync1(repeatHandler));
});
test("cancel timer with same time", () {
var t2;
- var t1 = new Timer(0, expectAsync1((t) => t2.cancel()));
- t2 = new Timer(0, expectAsync1((t) => t1.cancel(), count: 0));
+ var t1 = Timer.run(expectAsync0(() => t2.cancel()));
+ t2 = Timer.run(expectAsync0(t1.cancel, count: 0));
});
}
« no previous file with comments | « tests/isolate/timer_cancel2_test.dart ('k') | tests/isolate/timer_isolate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698