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

Side by Side Diff: tests/isolate/global_error_handler_stream_test.dart

Issue 14150002: Remove StreamSink(replaced by EventSink) and make IOSink extend EventSink. (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
« no previous file with comments | « sdk/lib/isolate/isolate_stream.dart ('k') | tests/standalone/io/dart_std_io_pipe_script.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 test; 5 library test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 9
10 var firstFunction; 10 var firstFunction;
11 var finishFunction; 11 var finishFunction;
12 12
13 void runFunctions() { 13 void runFunctions() {
14 try { 14 try {
15 firstFunction(); 15 firstFunction();
16 } catch (e) { 16 } catch (e) {
17 new Timer(Duration.ZERO, finishFunction); 17 new Timer(Duration.ZERO, finishFunction);
18 throw; 18 throw;
19 } 19 }
20 } 20 }
21 21
22 void startTest(StreamSink finishSink) { 22 void startTest(EventSink finishSink) {
23 firstFunction = () { throw new RuntimeError("ignore exception"); }; 23 firstFunction = () { throw new RuntimeError("ignore exception"); };
24 finishFunction = () { finishSink.add("done"); finishSink.close(); }; 24 finishFunction = () { finishSink.add("done"); finishSink.close(); };
25 new Timer(Duration.ZERO, runFunctions); 25 new Timer(Duration.ZERO, runFunctions);
26 } 26 }
27 27
28 runTest() { 28 runTest() {
29 stream.single.then(startTest); 29 stream.single.then(startTest);
30 } 30 }
31 31
32 bool globalErrorHandler(IsolateUnhandledException e) { 32 bool globalErrorHandler(IsolateUnhandledException e) {
33 return e.source is RuntimeError && e.source.message == "ignore exception"; 33 return e.source is RuntimeError && e.source.message == "ignore exception";
34 } 34 }
35 35
36 main() { 36 main() {
37 var box = new MessageBox(); 37 var box = new MessageBox();
38 var timer; 38 var timer;
39 StreamSink otherIsolate = streamSpawnFunction(runTest, globalErrorHandler); 39 EventSink otherIsolate = streamSpawnFunction(runTest, globalErrorHandler);
40 otherIsolate.add(box.sink); 40 otherIsolate.add(box.sink);
41 otherIsolate.close(); 41 otherIsolate.close();
42 box.stream.single.then((msg) { 42 box.stream.single.then((msg) {
43 box.stream.close(); 43 box.stream.close();
44 timer.cancel(); 44 timer.cancel();
45 }); 45 });
46 timer = new Timer(const Duration(seconds: 2), () { throw "failed"; }); 46 timer = new Timer(const Duration(seconds: 2), () { throw "failed"; });
47 } 47 }
OLDNEW
« no previous file with comments | « sdk/lib/isolate/isolate_stream.dart ('k') | tests/standalone/io/dart_std_io_pipe_script.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698