Chromium Code Reviews| Index: pkg/scheduled_test/lib/src/mock_clock.dart |
| diff --git a/pkg/scheduled_test/lib/src/mock_clock.dart b/pkg/scheduled_test/lib/src/mock_clock.dart |
| index d260b78f4df5516a9da8224485eecfd0608ab893..718f47b0ba20bd7697f8e99f1100a080fd923f99 100644 |
| --- a/pkg/scheduled_test/lib/src/mock_clock.dart |
| +++ b/pkg/scheduled_test/lib/src/mock_clock.dart |
| @@ -32,7 +32,7 @@ Clock mock() { |
| typedef void TimerCallback(); |
| -/// Returns a new (possibly mocked) [Timer]. Works the same as [new Timer]. |
| +/// Returns a new (possibly mocked) [Timer]. Works the same as `new Timer`. |
|
nweiz
2013/10/30 19:28:39
Also reference the issue number here.
|
| Timer newTimer(Duration duration, TimerCallback callback) => |
| _mocked ? new _MockTimer(duration, callback) : new Timer(duration, callback); |
| @@ -72,7 +72,7 @@ class Clock { |
| /// code runs before the next tick. |
| void run() { |
| pumpEventQueue().then((_) { |
| - if (!_broadcastController.hasListener) return; |
| + if (!_broadcastController.hasListener) return null; |
| tick(); |
| return run(); |
| }); |
| @@ -100,5 +100,10 @@ class _MockTimer implements Timer { |
| }); |
| } |
| - void cancel() => _subscription.cancel(); |
| + bool get isActive => _subscription != null; |
| + |
| + void cancel() { |
| + _subscription.cancel(); |
| + _subscription = null; |
| + } |
| } |