| Index: pkg/analysis_server/test/mocks.dart
|
| diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart
|
| index 917da7e29a9daa4fce0e0ce0d8d2a2ea3f0370dc..5eb4ad5e27b5ab1133e424350cfe25caa54994a4 100644
|
| --- a/pkg/analysis_server/test/mocks.dart
|
| +++ b/pkg/analysis_server/test/mocks.dart
|
| @@ -155,13 +155,9 @@ class MockServerChannel implements ServerCommunicationChannel {
|
| * Simulate request/response pair.
|
| */
|
| Future<Response> sendRequest(Request request) {
|
| - var id = request.id;
|
| // Wrap send request in future to simulate websocket
|
| new Future(() => requestController.add(request));
|
| - pumpEventQueue().then((_) => responseController.addError(
|
| - new NoResponseException(request)));
|
| - return responseController.stream.firstWhere((response) => response.id == id
|
| - );
|
| + return waitForResponse(request);
|
| }
|
|
|
| @override
|
| @@ -175,6 +171,16 @@ class MockServerChannel implements ServerCommunicationChannel {
|
| expect(responsesReceived, hasLength(responseCount));
|
| expect(notificationsReceived, hasLength(notificationCount));
|
| }
|
| +
|
| + Future<Response> waitForResponse(Request request) {
|
| + String id = request.id;
|
| + pumpEventQueue().then((_) {
|
| + responseController.addError(new NoResponseException(request));
|
| + });
|
| + return responseController.stream.firstWhere((response) {
|
| + return response.id == id;
|
| + });
|
| + }
|
| }
|
|
|
| /**
|
|
|