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

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

Issue 23875032: Expose Zones. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 2 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 | « tests/lib/async/catch_errors14_test.dart ('k') | tests/lib/async/catch_errors17_test.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 import 'package:async_helper/async_helper.dart'; 5 import 'package:async_helper/async_helper.dart';
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import 'dart:async'; 7 import 'dart:async';
8 import 'catch_errors.dart'; 8 import 'catch_errors.dart';
9 9
10 main() { 10 main() {
11 asyncStart(); 11 asyncStart();
12 Completer done = new Completer();
12 var events = []; 13 var events = [];
13 // Test that the outer `catchErrors` waits for the nested `catchErrors` stream 14
14 // to be done.
15 catchErrors(() { 15 catchErrors(() {
16 events.add("catch error entry"); 16 events.add("catch error entry");
17 catchErrors(() { 17 catchErrors(() {
18 events.add("catch error entry2"); 18 events.add("catch error entry2");
19 new Future.error("future error"); 19 new Future.error("future error");
20 new Future.error("future error2"); 20 new Future.error("future error2");
21 new Future.value(499).then((x) => throw x); 21 new Future.value(499).then((x) => throw x);
22 new Future.delayed(const Duration(milliseconds: 50), () { 22 new Future.delayed(const Duration(milliseconds: 50), () {
23 throw "delayed error"; 23 throw "delayed error";
24 }); 24 });
25 throw "catch error"; 25 throw "catch error";
26 }).listen((x) { events.add("i $x"); }, 26 }).listen((x) {
27 onDone: () => events.add("inner done")); 27 events.add("i $x");
28 if (x == "delayed error") done.complete(true);
29 },
30 onDone: () { Expect.fail("Unexpected callback"); });
28 events.add("after inner"); 31 events.add("after inner");
29 throw "inner throw"; 32 throw "inner throw";
30 }).listen((x) { 33 }).listen((x) {
31 events.add("o $x"); 34 events.add("o $x");
32 }, 35 },
33 onDone: () { 36 onDone: () { Expect.fail("Unexpected callback"); });
37 done.future.whenComplete(() {
38 // Give some time to run the handlers.
39 Timer.run(() {
34 Expect.listEquals(["catch error entry", 40 Expect.listEquals(["catch error entry",
35 "catch error entry2", 41 "catch error entry2",
36 "after inner", 42 "after inner",
37 "main exit", 43 "main exit",
38 "i catch error", 44 "i catch error",
39 // We guarantee the order of one stream but not any 45 // We guarantee the order of one stream but not any
40 // global order. 46 // global order.
41 "o inner throw", 47 "o inner throw",
42 "i future error", 48 "i future error",
43 "i future error2", 49 "i future error2",
44 "i 499", 50 "i 499",
45 "i delayed error", 51 "i delayed error",
46 "inner done",
47 ], 52 ],
48 events); 53 events);
49 asyncEnd(); 54 asyncEnd();
50 }); 55 });
56 });
51 events.add("main exit"); 57 events.add("main exit");
52 } 58 }
OLDNEW
« no previous file with comments | « tests/lib/async/catch_errors14_test.dart ('k') | tests/lib/async/catch_errors17_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698