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

Side by Side Diff: pkg/scheduled_test/lib/src/utils.dart

Issue 14251013: Rename unsubscribeOnError to cancelOnError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 utils; 5 library utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:stack_trace/stack_trace.dart'; 9 import 'package:stack_trace/stack_trace.dart';
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 var completer = new Completer(); 104 var completer = new Completer();
105 var subscription; 105 var subscription;
106 subscription = stream.listen((value) { 106 subscription = stream.listen((value) {
107 subscription.cancel(); 107 subscription.cancel();
108 completer.complete(value); 108 completer.complete(value);
109 }, onError: (e) { 109 }, onError: (e) {
110 completer.completeError(e.error, e.stackTrace); 110 completer.completeError(e.error, e.stackTrace);
111 }, onDone: () { 111 }, onDone: () {
112 completer.completeError(new StateError("No elements"), stackTrace); 112 completer.completeError(new StateError("No elements"), stackTrace);
113 }, unsubscribeOnError: true); 113 }, cancelOnError: true);
114 return completer.future; 114 return completer.future;
115 } 115 }
116 116
117 /// A function that can be called to cancel a [Stream] and send a done message. 117 /// A function that can be called to cancel a [Stream] and send a done message.
118 typedef void StreamCanceller(); 118 typedef void StreamCanceller();
119 119
120 // TODO(nweiz): use a StreamSubscription when issue 9026 is fixed. 120 // TODO(nweiz): use a StreamSubscription when issue 9026 is fixed.
121 /// Returns a wrapped version of [stream] along with a function that will cancel 121 /// Returns a wrapped version of [stream] along with a function that will cancel
122 /// the wrapped stream. Unlike [StreamSubscription], this canceller will send a 122 /// the wrapped stream. Unlike [StreamSubscription], this canceller will send a
123 /// "done" message to the wrapped stream. 123 /// "done" message to the wrapped stream.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 /// Returns a string representation of [trace] that has the core and test frames 188 /// Returns a string representation of [trace] that has the core and test frames
189 /// folded together. 189 /// folded together.
190 String terseTraceString(StackTrace trace) { 190 String terseTraceString(StackTrace trace) {
191 return new Trace.from(trace).terse.foldFrames((frame) { 191 return new Trace.from(trace).terse.foldFrames((frame) {
192 return frame.package == 'scheduled_test' || frame.package == 'unittest' || 192 return frame.package == 'scheduled_test' || frame.package == 'unittest' ||
193 frame.isCore; 193 frame.isCore;
194 }).toString().trim(); 194 }).toString().trim();
195 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698