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

Unified Diff: tests/lib/async/event_helper.dart

Issue 12610006: Renamed StreamSink to EventSink. Renamed signalError to addError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed inheritance back! Now create StreamSink instead of EventSink where we create them. Created 7 years, 9 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
Index: tests/lib/async/event_helper.dart
diff --git a/tests/lib/async/event_helper.dart b/tests/lib/async/event_helper.dart
index c8a3cb2b42d14747b27ddb03ab00382d6fed819f..db5189c0468e7e19be4de55d612d209f48049e3b 100644
--- a/tests/lib/async/event_helper.dart
+++ b/tests/lib/async/event_helper.dart
@@ -7,7 +7,7 @@ library event_helper;
import 'dart:async';
abstract class Event {
- void replay(StreamSink sink);
+ void replay(EventSink sink);
}
class DataEvent implements Event {
@@ -15,7 +15,7 @@ class DataEvent implements Event {
DataEvent(this.data);
- void replay(StreamSink sink) { sink.add(data); }
+ void replay(EventSink sink) { sink.add(data); }
int get hashCode => data.hashCode;
@@ -33,7 +33,7 @@ class ErrorEvent implements Event {
ErrorEvent(this.error);
- void replay(StreamSink sink) { sink.signalError(error); }
+ void replay(EventSink sink) { sink.addError(error); }
int get hashCode => error.error.hashCode;
@@ -49,7 +49,7 @@ class ErrorEvent implements Event {
class DoneEvent implements Event {
const DoneEvent();
- void replay(StreamSink sink) { sink.close(); }
+ void replay(EventSink sink) { sink.close(); }
int get hashCode => 42;
@@ -59,7 +59,7 @@ class DoneEvent implements Event {
}
/** Collector of events. */
-class Events implements StreamSink {
+class Events implements EventSink {
final List<Event> events = [];
Events();
@@ -72,10 +72,12 @@ class Events implements StreamSink {
factory Events.capture(Stream stream,
{ bool unsubscribeOnError: false }) = CaptureEvents;
- // StreamSink interface.
- add(var value) { events.add(new DataEvent(value)); }
+ // EventSink interface.
+ void add(var value) {
+ events.add(new DataEvent(value));
+ }
- void signalError(AsyncError error) {
+ void addError(AsyncError error) {
events.add(new ErrorEvent(error));
}
@@ -84,10 +86,10 @@ class Events implements StreamSink {
}
// Error helper for creating errors manually..
- void error(var value) { signalError(new AsyncError(value, null)); }
+ void error(var value) { addError(new AsyncError(value, null)); }
/** Replay the captured events on a sink. */
- void replay(StreamSink sink) {
+ void replay(EventSink sink) {
for (int i = 0; i < events.length; i++) {
events[i].replay(sink);
}
@@ -139,13 +141,13 @@ class CaptureEvents extends Events {
: onDoneSignal = new Completer() {
this.unsubscribeOnError = unsubscribeOnError;
subscription = stream.listen(add,
- onError: signalError,
+ onError: addError,
onDone: close,
unsubscribeOnError: unsubscribeOnError);
}
- void signalError(AsyncError error) {
- super.signalError(error);
+ void addError(AsyncError error) {
+ super.addError(error);
if (unsubscribeOnError) onDoneSignal.complete(null);
}

Powered by Google App Engine
This is Rietveld 408576698