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: pkg/scheduled_test/lib/src/mock_clock.dart

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 7 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
« no previous file with comments | « pkg/logging/lib/logging.dart ('k') | pkg/scheduled_test/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0d77e5a128c6c39c914d6093d6dababeff9c20a9..ba353fadccd0c7699aad649aa369c4019f4bd14c 100644
--- a/pkg/scheduled_test/lib/src/mock_clock.dart
+++ b/pkg/scheduled_test/lib/src/mock_clock.dart
@@ -45,13 +45,13 @@ class Clock {
int _time = 0;
/// Controller providing streams for listening.
- StreamController<int> _multiplexController =
- new StreamController<int>.broadcast();
+ StreamController<int> _broadcastController =
+ new StreamController<int>.broadcast(sync: true);
Clock._();
/// The stream of millisecond ticks of the clock.
- Stream<int> get onTick => _multiplexController.stream;
+ Stream<int> get onTick => _broadcastController.stream;
/// Advances the clock forward by [milliseconds]. This works like synchronous
/// code that takes [milliseconds] to execute; any [Timer]s that are scheduled
@@ -61,7 +61,7 @@ class Clock {
for (var i = 0; i < milliseconds; i++) {
var tickTime = ++_time;
runAsync(() {
- _multiplexController.add(tickTime);
+ _broadcastController.add(tickTime);
});
}
}
@@ -72,7 +72,7 @@ class Clock {
/// code runs before the next tick.
void run() {
pumpEventQueue().then((_) {
- if (!_multiplexController.hasListener) return;
+ if (!_broadcastController.hasListener) return;
tick();
return run();
});
« no previous file with comments | « pkg/logging/lib/logging.dart ('k') | pkg/scheduled_test/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698