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

Unified Diff: pkg/analysis_server/test/mocks.dart

Issue 417433003: Send responses for any pending 'analysis.getErrors' requests during context removal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 6 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 | « pkg/analysis_server/test/analysis/get_errors_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ });
+ }
}
/**
« no previous file with comments | « pkg/analysis_server/test/analysis/get_errors_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698