| 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.
|
|
|