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

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

Issue 2963743002: Revert "Make Zone API strong mode clean." (Closed)
Patch Set: Created 3 years, 5 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
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 library future_timeout_test; 5 library future_timeout_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 main() { 10 main() {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 Zone forked; 148 Zone forked;
149 int registerCallDelta = 0; 149 int registerCallDelta = 0;
150 bool callbackCalled = false; 150 bool callbackCalled = false;
151 Function callback = () { 151 Function callback = () {
152 expect(callbackCalled, false); 152 expect(callbackCalled, false);
153 callbackCalled = true; 153 callbackCalled = true;
154 expect(Zone.current, forked); 154 expect(Zone.current, forked);
155 return 42; 155 return 42;
156 }; 156 };
157 forked = Zone.current.fork(specification: new ZoneSpecification( 157 forked = Zone.current.fork(specification: new ZoneSpecification(
158 registerCallback: 158 registerCallback: (Zone self, ZoneDelegate parent, Zone origin, f()) {
159 <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) {
160 if (!identical(f, callback)) return f; 159 if (!identical(f, callback)) return f;
161 registerCallDelta++; // Increment calls to register. 160 registerCallDelta++; // Increment calls to register.
162 expect(origin, forked); 161 expect(origin, forked);
163 expect(self, forked); 162 expect(self, forked);
164 return expectAsync(() { 163 return expectAsync(() {
165 registerCallDelta--; 164 registerCallDelta--;
166 return f(); 165 return f();
167 }); 166 });
168 })); 167 }));
169 Completer completer = new Completer(); 168 Completer completer = new Completer();
(...skipping 22 matching lines...) Expand all
192 191
193 test("timeoutType", () { 192 test("timeoutType", () {
194 Completer completer = new Completer<int>(); 193 Completer completer = new Completer<int>();
195 Future timedOut = completer.future.timeout(const Duration(milliseconds: 5)); 194 Future timedOut = completer.future.timeout(const Duration(milliseconds: 5));
196 expect(timedOut, new isInstanceOf<Future<int>>()); 195 expect(timedOut, new isInstanceOf<Future<int>>());
197 expect(timedOut, isNot(new isInstanceOf<Future<String>>())); 196 expect(timedOut, isNot(new isInstanceOf<Future<String>>()));
198 timedOut.catchError((_) {}); 197 timedOut.catchError((_) {});
199 completer.complete(499); 198 completer.complete(499);
200 }); 199 });
201 } 200 }
OLDNEW
« no previous file with comments | « tests/lib_strong/async/async_await_zones_test.dart ('k') | tests/lib_strong/async/stream_listen_zone_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698