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

Side by Side Diff: tests/standalone/io/multiple_timer_test.dart

Issue 10538105: Make isUtc a getter, change some method names in Date. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/language/issue4157508_test.dart ('k') | tests/standalone/io/timer_repeat_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #import("dart:io"); 5 #import("dart:io");
6 6
7 class MultipleTimerTest { 7 class MultipleTimerTest {
8 8
9 static final int TIMEOUT1 = 1000; 9 static final int TIMEOUT1 = 1000;
10 static final int TIMEOUT2 = 2000; 10 static final int TIMEOUT2 = 2000;
11 static final int TIMEOUT3 = 500; 11 static final int TIMEOUT3 = 500;
12 static final int TIMEOUT4 = 1500; 12 static final int TIMEOUT4 = 1500;
13 13
14 static void testMultipleTimer() { 14 static void testMultipleTimer() {
15 15
16 void timeoutHandler1(Timer timer) { 16 void timeoutHandler1(Timer timer) {
17 int endTime = (new Date.now()).value; 17 int endTime = (new Date.now()).millisecondsSinceEpoch;
18 Expect.equals(true, (endTime - _startTime1) >= TIMEOUT1); 18 Expect.equals(true, (endTime - _startTime1) >= TIMEOUT1);
19 Expect.equals(true, _order[_message] == 0); 19 Expect.equals(true, _order[_message] == 0);
20 _message++; 20 _message++;
21 } 21 }
22 22
23 void timeoutHandler2(Timer timer) { 23 void timeoutHandler2(Timer timer) {
24 int endTime = (new Date.now()).value; 24 int endTime = (new Date.now()).millisecondsSinceEpoch;
25 Expect.equals(true, (endTime - _startTime2) >= TIMEOUT2); 25 Expect.equals(true, (endTime - _startTime2) >= TIMEOUT2);
26 Expect.equals(true, _order[_message] == 1); 26 Expect.equals(true, _order[_message] == 1);
27 _message++; 27 _message++;
28 } 28 }
29 29
30 void timeoutHandler3(Timer timer) { 30 void timeoutHandler3(Timer timer) {
31 int endTime = (new Date.now()).value; 31 int endTime = (new Date.now()).millisecondsSinceEpoch;
32 Expect.equals(true, (endTime - _startTime3) >= TIMEOUT3); 32 Expect.equals(true, (endTime - _startTime3) >= TIMEOUT3);
33 Expect.equals(true, _order[_message] == 2); 33 Expect.equals(true, _order[_message] == 2);
34 _message++; 34 _message++;
35 } 35 }
36 36
37 void timeoutHandler4(Timer timer) { 37 void timeoutHandler4(Timer timer) {
38 int endTime = (new Date.now()).value; 38 int endTime = (new Date.now()).millisecondsSinceEpoch;
39 Expect.equals(true, (endTime - _startTime4) >= TIMEOUT4); 39 Expect.equals(true, (endTime - _startTime4) >= TIMEOUT4);
40 Expect.equals(true, _order[_message] == 3); 40 Expect.equals(true, _order[_message] == 3);
41 _message++; 41 _message++;
42 } 42 }
43 43
44 _order = new List<int>(4); 44 _order = new List<int>(4);
45 _order[0] = 2; 45 _order[0] = 2;
46 _order[1] = 0; 46 _order[1] = 0;
47 _order[2] = 3; 47 _order[2] = 3;
48 _order[3] = 1; 48 _order[3] = 1;
49 _message = 0; 49 _message = 0;
50 50
51 _startTime1 = (new Date.now()).value; 51 _startTime1 = (new Date.now()).millisecondsSinceEpoch;
52 new Timer(TIMEOUT1, timeoutHandler1); 52 new Timer(TIMEOUT1, timeoutHandler1);
53 _startTime2 = (new Date.now()).value; 53 _startTime2 = (new Date.now()).millisecondsSinceEpoch;
54 new Timer(TIMEOUT2, timeoutHandler2); 54 new Timer(TIMEOUT2, timeoutHandler2);
55 _startTime3 = (new Date.now()).value; 55 _startTime3 = (new Date.now()).millisecondsSinceEpoch;
56 new Timer(TIMEOUT3, timeoutHandler3); 56 new Timer(TIMEOUT3, timeoutHandler3);
57 _startTime4 = (new Date.now()).value; 57 _startTime4 = (new Date.now()).millisecondsSinceEpoch;
58 new Timer(TIMEOUT4, timeoutHandler4); 58 new Timer(TIMEOUT4, timeoutHandler4);
59 } 59 }
60 60
61 static void testMain() { 61 static void testMain() {
62 testMultipleTimer(); 62 testMultipleTimer();
63 } 63 }
64 64
65 static int _startTime1; 65 static int _startTime1;
66 static int _startTime2; 66 static int _startTime2;
67 static int _startTime3; 67 static int _startTime3;
68 static int _startTime4; 68 static int _startTime4;
69 static List<int> _order; 69 static List<int> _order;
70 static int _message; 70 static int _message;
71 } 71 }
72 72
73 main() { 73 main() {
74 MultipleTimerTest.testMain(); 74 MultipleTimerTest.testMain();
75 } 75 }
OLDNEW
« no previous file with comments | « tests/language/issue4157508_test.dart ('k') | tests/standalone/io/timer_repeat_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698