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

Unified Diff: tests/lib/async/future_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/language/closure_cycles_test.dart ('k') | tests/lib/async/slow_consumer2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/future_test.dart
diff --git a/tests/lib/async/future_test.dart b/tests/lib/async/future_test.dart
index 19c09f83ec5c276ba361c838bff56c31ec758737..5458e8380c61edc004be148bde7fa164899d09ed 100644
--- a/tests/lib/async/future_test.dart
+++ b/tests/lib/async/future_test.dart
@@ -7,6 +7,8 @@ library future_test;
import 'dart:async';
import 'dart:isolate';
+const Duration MS = const Duration(milliseconds: 1);
+
testImmediate() {
final future = new Future<String>.immediate("42");
var port = new ReceivePort();
@@ -357,7 +359,7 @@ testFutureWhenCompletePreValue() {
var completer = new Completer();
Future future = completer.future;
completer.complete(42);
- new Timer(0, () {
+ Timer.run(() {
Future later = future.whenComplete(countDown);
later.then((v) {
Expect.equals(42, v);
@@ -367,6 +369,7 @@ testFutureWhenCompletePreValue() {
}
testFutureWhenValueFutureValue() {
+
var port = new ReceivePort();
int counter = 3;
countDown(int expect) {
@@ -377,7 +380,7 @@ testFutureWhenValueFutureValue() {
completer.future.whenComplete(() {
countDown(3);
var completer2 = new Completer();
- new Timer(10, (_) {
+ new Timer(MS * 10, () {
countDown(2);
completer2.complete(37);
});
@@ -401,7 +404,7 @@ testFutureWhenValueFutureError() {
completer.future.whenComplete(() {
countDown(3);
var completer2 = new Completer();
- new Timer(10, (_) {
+ new Timer(MS * 10, () {
countDown(2);
completer2.completeError("Fail");
});
@@ -427,7 +430,7 @@ testFutureWhenErrorFutureValue() {
completer.future.whenComplete(() {
countDown(3);
var completer2 = new Completer();
- new Timer(10, (_) {
+ new Timer(MS * 10, () {
countDown(2);
completer2.complete(37);
});
@@ -453,7 +456,7 @@ testFutureWhenErrorFutureError() {
completer.future.whenComplete(() {
countDown(3);
var completer2 = new Completer();
- new Timer(10, (_) {
+ new Timer(MS * 10, () {
countDown(2);
completer2.completeError("Fail");
});
« no previous file with comments | « tests/language/closure_cycles_test.dart ('k') | tests/lib/async/slow_consumer2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698