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

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

Issue 18841002: Address more bot-redness. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | tests/lib/lib.status » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library event_helper; 5 library event_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 abstract class Event { 9 abstract class Event {
10 void replay(EventSink sink); 10 void replay(EventSink sink);
11 } 11 }
12 12
13 class DataEvent implements Event { 13 class DataEvent implements Event {
14 final data; 14 final data;
15 15
16 DataEvent(this.data); 16 DataEvent(this.data);
17 17
18 void replay(EventSink sink) { sink.add(data); } 18 void replay(EventSink sink) { sink.add(data); }
19 19
20 int get hashCode => data.hashCode; 20 int get hashCode => data.hashCode;
21 21
22 bool operator==(Object other) { 22 bool operator==(Object other) {
23 if (other is! DataEvent) return false; 23 if (other is! DataEvent) return false;
24 DataEvent otherEvent = other; 24 DataEvent otherEvent = other;
25 return data == other.data; 25 return data == otherEvent.data;
26 } 26 }
27 27
28 String toString() => "DataEvent: $data"; 28 String toString() => "DataEvent: $data";
29 } 29 }
30 30
31 class ErrorEvent implements Event { 31 class ErrorEvent implements Event {
32 final error; 32 final error;
33 33
34 ErrorEvent(this.error); 34 ErrorEvent(this.error);
35 35
36 void replay(EventSink sink) { sink.addError(error); } 36 void replay(EventSink sink) { sink.addError(error); }
37 37
38 int get hashCode => error.error.hashCode; 38 int get hashCode => error.error.hashCode;
39 39
40 bool operator==(Object other) { 40 bool operator==(Object other) {
41 if (other is! ErrorEvent) return false; 41 if (other is! ErrorEvent) return false;
42 ErrorEvent otherEvent = other; 42 ErrorEvent otherEvent = other;
43 return error == other.error; 43 return error == otherEvent.error;
44 } 44 }
45 45
46 String toString() => "ErrorEvent: ${error}"; 46 String toString() => "ErrorEvent: ${error}";
47 } 47 }
48 48
49 class DoneEvent implements Event { 49 class DoneEvent implements Event {
50 const DoneEvent(); 50 const DoneEvent();
51 51
52 void replay(EventSink sink) { sink.close(); } 52 void replay(EventSink sink) { sink.close(); }
53 53
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void resume() { 169 void resume() {
170 if (trace) print("Events#$hashCode: resume"); 170 if (trace) print("Events#$hashCode: resume");
171 subscription.resume(); 171 subscription.resume();
172 } 172 }
173 173
174 void onDone(void action()) { 174 void onDone(void action()) {
175 if (trace) print("Events#$hashCode: onDone"); 175 if (trace) print("Events#$hashCode: onDone");
176 onDoneSignal.future.whenComplete(action); 176 onDoneSignal.future.whenComplete(action);
177 } 177 }
178 } 178 }
OLDNEW
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | tests/lib/lib.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698