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

Side by Side Diff: tests/lib/async/timer_isActive_test.dart

Issue 18325006: Add isActive field on Timer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 7 years, 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:async';
6 import '../../../pkg/unittest/lib/unittest.dart';
7
8 main() {
9
10 test("timer isActive test", () {
11 Timer t;
12
13 t = new Timer(const Duration(seconds: 1),
14 expectAsync0( () => expect(t.isActive, equals(false))));
floitsch 2013/07/01 17:50:56 no need for space.
zarah 2013/07/02 11:22:01 Done.
15 expect(t.isActive, equals(true));
16 });
17
18 test("periodic timer cancel test", () {
19 Timer t;
20
21 int i = 0;
22 void checkActive(Timer timer) {
23 expect(t.isActive, equals(true));
24 if (i == 2) {
25 t.cancel();
26 expect(t.isActive, equals(false));
27 }
28 i++;
29 }
30
31 t = new Timer.periodic(new Duration(milliseconds: 1),
32 expectAsync1(checkActive, count: 3));
33 expect(t.isActive, equals(true));
34 });
35
36 test("timer cancel test", () {
37
38 Timer timer = new Timer(const Duration(seconds: 1),
39 () => fail("Should not be reached."));
floitsch 2013/07/01 17:50:56 if possible indent with other argument. If not, mo
zarah 2013/07/02 11:22:01 Done.
40 Timer.run(expectAsync0(() {
41 expect(timer.isActive, equals(true));
42 timer.cancel();
43 expect(timer.isActive, equals(false));
44 }));
floitsch 2013/07/01 17:50:56 indentation (should be 2 spaces to the left).
zarah 2013/07/02 11:22:01 Done.
45 });
floitsch 2013/07/01 17:50:56 ditto.
zarah 2013/07/02 11:22:01 Done.
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698