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

Unified Diff: tests/isolate/multiple_timer_test.dart

Issue 12812014: Move timer tests to async tests. (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 side-by-side diff with in-line comments
Download patch
Index: tests/isolate/multiple_timer_test.dart
diff --git a/tests/isolate/multiple_timer_test.dart b/tests/isolate/multiple_timer_test.dart
deleted file mode 100644
index 27e429ea4b28f857dba7fcbf608cbd184787e204..0000000000000000000000000000000000000000
--- a/tests/isolate/multiple_timer_test.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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.
-
-library multiple_timer_test;
-
-import 'dart:async';
-import '../../pkg/unittest/lib/unittest.dart';
-
-const Duration TIMEOUT1 = const Duration(seconds: 1);
-const Duration TIMEOUT2 = const Duration(seconds: 2);
-const Duration TIMEOUT3 = const Duration(milliseconds: 500);
-const Duration TIMEOUT4 = const Duration(milliseconds: 1500);
-
-main() {
- test("multiple timer test", () {
- Stopwatch _stopwatch1 = new Stopwatch();
- Stopwatch _stopwatch2 = new Stopwatch();
- Stopwatch _stopwatch3 = new Stopwatch();
- Stopwatch _stopwatch4 = new Stopwatch();
- List<int> _order;
- int _message;
-
- void timeoutHandler1() {
- // The stopwatch is more precise than the Timer. It can happen that
- // the TIMEOUT triggers *slightly* too early.
- expect(_stopwatch1.elapsedMilliseconds + 1,
- greaterThanOrEqualTo(TIMEOUT1.inMilliseconds));
- expect(_order[_message], 0);
- _message++;
- }
-
- void timeoutHandler2() {
- // The stopwatch is more precise than the Timer. It can happen that
- // the TIMEOUT triggers *slightly* too early.
- expect(_stopwatch2.elapsedMilliseconds + 1,
- greaterThanOrEqualTo(TIMEOUT2.inMilliseconds));
- expect(_order[_message], 1);
- _message++;
- }
-
- void timeoutHandler3() {
- // The stopwatch is more precise than the Timer. It can happen that
- // the TIMEOUT triggers *slightly* too early.
- expect(_stopwatch3.elapsedMilliseconds + 1,
- greaterThanOrEqualTo(TIMEOUT3.inMilliseconds));
- expect(_order[_message], 2);
- _message++;
- }
-
- void timeoutHandler4() {
- // The stopwatch is more precise than the Timer. It can happen that
- // the TIMEOUT triggers *slightly* too early.
- expect(_stopwatch4.elapsedMilliseconds + 1,
- greaterThanOrEqualTo(TIMEOUT4.inMilliseconds));
- expect(_order[_message], 3);
- _message++;
- }
-
- _order = new List<int>(4);
- _order[0] = 2;
- _order[1] = 0;
- _order[2] = 3;
- _order[3] = 1;
- _message = 0;
-
- _stopwatch1.start();
- new Timer(TIMEOUT1, expectAsync0(timeoutHandler1));
- _stopwatch2.start();
- new Timer(TIMEOUT2, expectAsync0(timeoutHandler2));
- _stopwatch3.start();
- new Timer(TIMEOUT3, expectAsync0(timeoutHandler3));
- _stopwatch4.start();
- new Timer(TIMEOUT4, expectAsync0(timeoutHandler4));
- });
-}

Powered by Google App Engine
This is Rietveld 408576698