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

Unified Diff: test/test_pub.dart

Issue 1226133003: Fix several problems with offline mode. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/hosted/offline_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/test_pub.dart
diff --git a/test/test_pub.dart b/test/test_pub.dart
index 03889c67ffd1c2f36ae8ea272edd62c13f1cdce0..05429792254d48b46503840b0c16a3b2e4be2d1a 100644
--- a/test/test_pub.dart
+++ b/test/test_pub.dart
@@ -218,6 +218,24 @@ void serve([List<d.Descriptor> contents]) {
}, 'starting a server serving:\n${baseDir.describe()}');
}
+/// Like [serve], but reports an error if a request ever comes in to the server.
+void serveErrors() {
+ _hasServer = true;
+
+ schedule(() async {
+ await _closeServer();
+
+ _server = await shelf_io.serve((request) {
+ fail("The HTTP server received an unexpected request:\n"
+ "${request.method} ${request.requestedUri}");
+ return new shelf.Response.forbidden(null);
+ }, 'localhost', 0);
+
+ _portCompleter.complete(_server.port);
+ currentSchedule.onComplete.schedule(_closeServer);
+ });
+}
+
/// Closes [_server].
///
/// Returns a [Future] that completes after the [_server] is closed.
« no previous file with comments | « test/hosted/offline_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698