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

Unified Diff: dart/tests/compiler/dart2js_extra/timer_test.dart

Issue 11358039: Lightweight asynchronous test helper. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update test expectations Created 8 years, 1 month 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 | « dart/tests/compiler/dart2js_extra/timer_negative_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/compiler/dart2js_extra/timer_test.dart
diff --git a/dart/tests/compiler/dart2js_extra/timer_test.dart b/dart/tests/compiler/dart2js_extra/timer_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7bb325ca332887f6619acdf7e5194029f60fc20b
--- /dev/null
+++ b/dart/tests/compiler/dart2js_extra/timer_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:isolate';
+
+import 'async_helper.dart';
+
+void test(void onDone(bool success)) {
+ int expected = 4;
+
+ void timerCallback(timer) {
+ if (--expected == 0) onDone(true);
+ }
+
+ new Timer(0, timerCallback);
+ new Timer(10, timerCallback);
+ new Timer(100, timerCallback);
+ new Timer(1000, timerCallback);
+}
+
+main() {
+ asyncTest(test);
+}
« no previous file with comments | « dart/tests/compiler/dart2js_extra/timer_negative_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698