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

Side by Side Diff: tests/lib_strong/async/intercept_schedule_microtask6_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 class A {
11 add(x) => print(x);
12 }
13 var events = [];
14
15 body() {
16 events.add("body entry");
17 scheduleMicrotask(() {
18 events.add("run async body");
19 throw "foo";
20 });
21 return 499;
22 }
23
24 onAsyncHandler(fun) {
25 events.add("async handler");
26 scheduleMicrotask(fun);
27 events.add("async handler done");
28 }
29
30 onErrorHandler(e) {
31 events.add("error: $e");
32 }
33
34 main() {
35 asyncStart();
36
37 // Test that runZonedScheduleMicrotask works when async, error and done
38 // are used.
39 var result = runZonedScheduleMicrotask(
40 body,
41 onScheduleMicrotask: onAsyncHandler,
42 onError: onErrorHandler);
43 events.add("after");
44 Timer.run(() {
45 Expect.listEquals(
46 ["body entry",
47 "async handler", "async handler done",
48 "after",
49 "run async body",
50 "error: foo"],
51 events);
52 asyncEnd();
53 });
54 }
OLDNEW
« no previous file with comments | « tests/lib_strong/async/intercept_schedule_microtask5_test.dart ('k') | tests/lib_strong/async/multiple_timer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698