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

Side by Side Diff: test/pool_test.dart

Issue 1215053004: pkg/pool: remove usage of Chain.track (Closed) Base URL: https://github.com/dart-lang/pool.git@master
Patch Set: nits Created 5 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
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:fake_async/fake_async.dart'; 7 import 'package:fake_async/fake_async.dart';
8 import 'package:pool/pool.dart'; 8 import 'package:pool/pool.dart';
9 import 'package:stack_trace/stack_trace.dart'; 9 import 'package:stack_trace/stack_trace.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 expect(pool.request(), throwsA(new isInstanceOf<TimeoutException>())); 156 expect(pool.request(), throwsA(new isInstanceOf<TimeoutException>()));
157 157
158 async.elapse(new Duration(seconds: 6)); 158 async.elapse(new Duration(seconds: 6));
159 }); 159 });
160 }); 160 });
161 }); 161 });
162 162
163 group("allowRelease()", () { 163 group("allowRelease()", () {
164 test("runs the callback once the resource limit is exceeded", () async { 164 test("runs the callback once the resource limit is exceeded", () async {
165 var pool = new Pool(50); 165 var pool = new Pool(50);
166 var requests = [];
167 for (var i = 0; i < 49; i++) { 166 for (var i = 0; i < 49; i++) {
168 expect(pool.request(), completes); 167 expect(pool.request(), completes);
169 } 168 }
170 169
171 var resource = await pool.request(); 170 var resource = await pool.request();
172 var onReleaseCalled = false; 171 var onReleaseCalled = false;
173 resource.allowRelease(() => onReleaseCalled = true); 172 resource.allowRelease(() => onReleaseCalled = true);
174 await new Future.delayed(Duration.ZERO); 173 await new Future.delayed(Duration.ZERO);
175 expect(onReleaseCalled, isFalse); 174 expect(onReleaseCalled, isFalse);
176 175
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 /// 286 ///
288 /// This should only be called within a [FakeAsync.run] zone. 287 /// This should only be called within a [FakeAsync.run] zone.
289 Matcher get doesNotComplete => predicate((future) { 288 Matcher get doesNotComplete => predicate((future) {
290 expect(future, new isInstanceOf<Future>()); 289 expect(future, new isInstanceOf<Future>());
291 290
292 var stack = new Trace.current(1); 291 var stack = new Trace.current(1);
293 future.then((_) => registerException( 292 future.then((_) => registerException(
294 new TestFailure("Expected future not to complete."), stack)); 293 new TestFailure("Expected future not to complete."), stack));
295 return true; 294 return true;
296 }); 295 });
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698