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

Side by Side Diff: tests/lib_strong/async/catch_errors12_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
14 var events = [];
15 // Tests that errors that have been delayed by several milliseconds with
16 // Timers are still caught by `catchErrors`.
17 catchErrors(() {
18 events.add("catch error entry");
19 Timer.run(() { throw "timer error"; });
20 new Timer(const Duration(milliseconds: 100), () { throw "timer2 error"; });
21 new Future.value(499).then((x) {
22 new Timer(const Duration(milliseconds: 200), () {
23 done.complete(499);
24 throw x;
25 });
26 });
27 throw "catch error";
28 }).listen((x) {
29 events.add(x);
30 },
31 onDone: () { Expect.fail("Unexpected callback"); });
32 done.future.whenComplete(() {
33 // Give time to execute the callbacks.
34 Timer.run(() {
35 Expect.listEquals([
36 "catch error entry",
37 "main exit",
38 "catch error",
39 "timer error",
40 "timer2 error",
41 499,
42 ],
43 events);
44 asyncEnd();
45 });
46 });
47 events.add("main exit");
48 }
OLDNEW
« no previous file with comments | « tests/lib_strong/async/catch_errors11_test.dart ('k') | tests/lib_strong/async/catch_errors13_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698