| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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:async'; | 5 import 'dart:async'; |
| 6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 | 9 |
| 10 test("timer isActive test", () { | 10 test("timer isActive test", () { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 i++; | 28 i++; |
| 29 } | 29 } |
| 30 | 30 |
| 31 t = new Timer.periodic(new Duration(milliseconds: 1), | 31 t = new Timer.periodic(new Duration(milliseconds: 1), |
| 32 expectAsync(checkActive, count: 3)); | 32 expectAsync(checkActive, count: 3)); |
| 33 expect(t.isActive, equals(true)); | 33 expect(t.isActive, equals(true)); |
| 34 }); | 34 }); |
| 35 | 35 |
| 36 test("timer cancel test", () { | 36 test("timer cancel test", () { |
| 37 Timer timer = new Timer(const Duration(seconds: 1), | 37 Timer timer = new Timer(const Duration(seconds: 15), |
| 38 () => fail("Should not be reached.")); | 38 () => fail("Should not be reached.")); |
| 39 Timer.run(expectAsync(() { | 39 Timer.run(expectAsync(() { |
| 40 expect(timer.isActive, equals(true)); | 40 expect(timer.isActive, equals(true)); |
| 41 timer.cancel(); | 41 timer.cancel(); |
| 42 expect(timer.isActive, equals(false)); | 42 expect(timer.isActive, equals(false)); |
| 43 })); | 43 })); |
| 44 }); | 44 }); |
| 45 } | 45 } |
| OLD | NEW |