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

Unified Diff: packages/pool/test/pool_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/pool/pubspec.yaml ('k') | packages/quiver/.analysis_options » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/pool/test/pool_test.dart
diff --git a/packages/pool/test/pool_test.dart b/packages/pool/test/pool_test.dart
index 65fd00ee25f0ed9a498681d61077198f2d67283f..7fba9c0b06812470bc85befc890498a16f1e38d4 100644
--- a/packages/pool/test/pool_test.dart
+++ b/packages/pool/test/pool_test.dart
@@ -96,6 +96,13 @@ void main() {
async.elapse(new Duration(seconds: 1));
});
});
+
+ // Regression test for #3.
+ test("can be called immediately before close()", () async {
+ var pool = new Pool(1);
+ pool.withResource(expectAsync(() {}));
+ await pool.close();
+ });
});
group("with a timeout", () {
@@ -272,6 +279,16 @@ void main() {
});
});
+ test("done doesn't complete without close", () async {
+ var pool = new Pool(1);
+ pool.done.then(expectAsync1((_) {}, count: 0));
+
+ var resource = await pool.request();
+ resource.release();
+
+ await new Future.delayed(Duration.ZERO);
+ });
+
group("close()", () {
test("disallows request() and withResource()", () {
var pool = new Pool(1)..close();
@@ -285,6 +302,7 @@ void main() {
expect(pool.request().then((resource2) {
resource2.release();
}), completes);
+ expect(pool.done, completes);
expect(pool.close(), completes);
resource1.release();
});
@@ -398,6 +416,7 @@ void main() {
var completer = new Completer();
resource.allowRelease(() => completer.future);
+ expect(pool.done, throwsA("oh no!"));
expect(pool.close(), throwsA("oh no!"));
await new Future.delayed(Duration.ZERO);
« no previous file with comments | « packages/pool/pubspec.yaml ('k') | packages/quiver/.analysis_options » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698