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

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

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

Powered by Google App Engine
This is Rietveld 408576698