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

Side by Side Diff: tests/lib/async/zone_debug_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:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import 'package:async_helper/async_helper.dart'; 6 import 'package:async_helper/async_helper.dart';
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'dart:collection'; 9 import 'dart:collection';
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 Zone forked; 72 Zone forked;
73 forked = Zone.current.fork(specification: DEBUG_SPECIFICATION); 73 forked = Zone.current.fork(specification: DEBUG_SPECIFICATION);
74 74
75 asyncStart(); 75 asyncStart();
76 76
77 int openTests = 0; 77 int openTests = 0;
78 78
79 openTests++; 79 openTests++;
80 forked.run(() { 80 forked.run(() {
81 int forkTrace = stackTrace; 81 int forkTrace = stackTrace;
82 runAsync(() { 82 scheduleMicrotask(() {
83 int runAsyncTrace = stackTrace; 83 int scheduleMicrotaskTrace = stackTrace;
84 runAsync(() { 84 scheduleMicrotask(() {
85 expectedDebugTrace = [runAsyncTrace, forkTrace]; 85 expectedDebugTrace = [scheduleMicrotaskTrace, forkTrace];
86 openTests--; 86 openTests--;
87 if (openTests == 0) { 87 if (openTests == 0) {
88 done.complete(); 88 done.complete();
89 } 89 }
90 throw "foo"; 90 throw "foo";
91 }); 91 });
92 expectedDebugTrace = [forkTrace]; 92 expectedDebugTrace = [forkTrace];
93 throw "bar"; 93 throw "bar";
94 }); 94 });
95 }); 95 });
96 96
97 Expect.listEquals([], restoredStackTrace); 97 Expect.listEquals([], restoredStackTrace);
98 Zone forked2 = forked.fork(); 98 Zone forked2 = forked.fork();
99 Zone forked3 = forked2.fork(); 99 Zone forked3 = forked2.fork();
100 int fork2Trace; 100 int fork2Trace;
101 int fork3Trace; 101 int fork3Trace;
102 var f2; 102 var f2;
103 var globalTrace = stackTrace; 103 var globalTrace = stackTrace;
104 var f = forked3.bindCallback(() { 104 var f = forked3.bindCallback(() {
105 Expect.identical(forked3, Zone.current); 105 Expect.identical(forked3, Zone.current);
106 fork2Trace = stackTrace; 106 fork2Trace = stackTrace;
107 f2 = forked2.bindCallback(() { 107 f2 = forked2.bindCallback(() {
108 Expect.identical(forked2, Zone.current); 108 Expect.identical(forked2, Zone.current);
109 Expect.listEquals([fork2Trace, globalTrace], restoredStackTrace); 109 Expect.listEquals([fork2Trace, globalTrace], restoredStackTrace);
110 fork3Trace = stackTrace; 110 fork3Trace = stackTrace;
111 openTests--; 111 openTests--;
112 if (openTests == 0) { 112 if (openTests == 0) {
113 done.complete(); 113 done.complete();
114 } 114 }
115 runAsync(() { 115 scheduleMicrotask(() {
116 expectedDebugTrace = [fork3Trace, fork2Trace, globalTrace]; 116 expectedDebugTrace = [fork3Trace, fork2Trace, globalTrace];
117 throw "gee"; 117 throw "gee";
118 }); 118 });
119 }, runGuarded: false); 119 }, runGuarded: false);
120 }, runGuarded: false); 120 }, runGuarded: false);
121 openTests++; 121 openTests++;
122 f(); 122 f();
123 f2(); 123 f2();
124 124
125 done.future.whenComplete(() { 125 done.future.whenComplete(() {
126 // We don't really care for the order. 126 // We don't really care for the order.
127 events.sort(); 127 events.sort();
128 Expect.listEquals([ "handling uncaught error bar", 128 Expect.listEquals([ "handling uncaught error bar",
129 "handling uncaught error foo", 129 "handling uncaught error foo",
130 "handling uncaught error gee"], 130 "handling uncaught error gee"],
131 events); 131 events);
132 asyncEnd(); 132 asyncEnd();
133 }); 133 });
134 } 134 }
OLDNEW
« no previous file with comments | « tests/lib/async/stream_event_transformed_test.dart ('k') | tests/lib/async/zone_empty_description_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698