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

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

Issue 26151002: Rename runAsync to scheduleMicrotask. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. 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
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 8
9 var events = []; 9 var events = [];
10 10
11 body() { 11 body() {
12 events.add("body entry"); 12 events.add("body entry");
13 runAsync(() { 13 scheduleMicrotask(() {
14 events.add("run async body"); 14 events.add("run async body");
15 runAsync(() { 15 scheduleMicrotask(() {
16 events.add("run nested body"); 16 events.add("run nested body");
17 }); 17 });
18 }); 18 });
19 return 499; 19 return 499;
20 } 20 }
21 21
22 handler(fun) { 22 handler(fun) {
23 events.add("handler"); 23 events.add("handler");
24 runAsync(fun); 24 scheduleMicrotask(fun);
25 events.add("handler done"); 25 events.add("handler done");
26 } 26 }
27 27
28 handler2(fun) { 28 handler2(fun) {
29 events.add("handler2"); 29 events.add("handler2");
30 runAsync(fun); 30 scheduleMicrotask(fun);
31 events.add("handler2 done"); 31 events.add("handler2 done");
32 } 32 }
33 33
34 main() { 34 main() {
35 asyncStart(); 35 asyncStart();
36 36
37 // Test that nested runZonedExperimental go to the next outer zone. 37 // Test that nested runZonedExperimental go to the next outer zone.
38 var result = runZonedExperimental( 38 var result = runZonedExperimental(
39 () => runZonedExperimental(body, onRunAsync: handler2), 39 () => runZonedExperimental(body, onScheduleMicrotask: handler2),
40 onRunAsync: handler); 40 onRunAsync: handler);
41 events.add("after"); 41 events.add("after");
42 Timer.run(() { 42 Timer.run(() {
43 Expect.listEquals( 43 Expect.listEquals(
44 ["body entry", 44 ["body entry",
45 "handler2", "handler", "handler done", "handler2 done", 45 "handler2", "handler", "handler done", "handler2 done",
46 "after", 46 "after",
47 "run async body", 47 "run async body",
48 "handler2", "handler", "handler done", "handler2 done", 48 "handler2", "handler", "handler done", "handler2 done",
49 "run nested body"], 49 "run nested body"],
50 events); 50 events);
51 asyncEnd(); 51 asyncEnd();
52 }); 52 });
53 } 53 }
OLDNEW
« no previous file with comments | « tests/lib/async/intercept_run_async4_test.dart ('k') | tests/lib/async/intercept_run_async6_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698