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

Unified Diff: test/server/utils.dart

Issue 864983002: Fix a couple test timeouts. (Closed) Base URL: git@github.com:dart-lang/json_rpc_2@master
Patch Set: Created 5 years, 11 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 | « test/server/server_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/server/utils.dart
diff --git a/test/server/utils.dart b/test/server/utils.dart
index a4fd36af674b69f1e73a6091f2aad1505770cb96..75dc9b247a0f7363c27c50c39a54380b6b31407f 100644
--- a/test/server/utils.dart
+++ b/test/server/utils.dart
@@ -61,6 +61,20 @@ void expectErrorResponse(ServerController controller, request, int errorCode,
})));
}
+/// Returns a matcher that matches [Future]s that never complete.
+Matcher get doesNotComplete => predicate((future) {
+ future.then(expectAsync((_) {
+ // This will never be called. [expectAsync] with `count: 0` ensures that an
+ // error will be thrown when [future] completes.
+ }, count: 0));
+
+ // Make sure there's enough time in the test for [expectAsync] to fail if it's
+ // going to.
+ expect(pumpEventQueue(), completes);
+
+ return true;
+});
+
/// Returns a matcher that matches a [json_rpc.RpcException] with an
/// `invalid_params` error code.
Matcher throwsInvalidParams(String message) {
« no previous file with comments | « test/server/server_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698