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

Side by Side Diff: pkg/analysis_server/test/mocks.dart

Issue 2016993004: Make some pkg tests less timing-dependent. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library mocks; 5 library mocks;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:analysis_server/plugin/protocol/protocol.dart' 10 import 'package:analysis_server/plugin/protocol/protocol.dart'
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 if (_closed) { 242 if (_closed) {
243 return; 243 return;
244 } 244 }
245 responsesReceived.add(response); 245 responsesReceived.add(response);
246 // Wrap send response in future to simulate WebSocket. 246 // Wrap send response in future to simulate WebSocket.
247 new Future(() => responseController.add(response)); 247 new Future(() => responseController.add(response));
248 } 248 }
249 249
250 Future<Response> waitForResponse(Request request) { 250 Future<Response> waitForResponse(Request request) {
251 String id = request.id; 251 String id = request.id;
252 pumpEventQueue().then((_) {
253 responseController.addError(new NoResponseException(request));
254 });
255 return new Future<Response>(() => 252 return new Future<Response>(() =>
256 responseController.stream.firstWhere((response) => response.id == id)); 253 responseController.stream.firstWhere((response) => response.id == id));
257 } 254 }
258 } 255 }
259 256
260 /** 257 /**
261 * A mock [ServerOperation] for testing [AnalysisServer]. 258 * A mock [ServerOperation] for testing [AnalysisServer].
262 */ 259 */
263 class MockServerOperation implements PerformAnalysisOperation { 260 class MockServerOperation implements PerformAnalysisOperation {
264 final ServerOperationPriority priority; 261 final ServerOperationPriority priority;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 431 }
435 return mismatchDescription; 432 return mismatchDescription;
436 } 433 }
437 434
438 @override 435 @override
439 bool matches(item, Map matchState) { 436 bool matches(item, Map matchState) {
440 Response response = item; 437 Response response = item;
441 return response != null && response.id == _id && response.error == null; 438 return response != null && response.id == _id && response.error == null;
442 } 439 }
443 } 440 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698