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

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

Issue 2794503002: Fix static typing problem in analysis_server tests. (Closed)
Patch Set: Created 3 years, 8 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/pubspec.yaml ('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 return new Future<Response>(() => 252 return new Future<Response>(() => responseController.stream
253 responseController.stream.firstWhere((response) => response.id == id)); 253 .firstWhere((response) => response.id == id) as Response);
254 } 254 }
255 } 255 }
256 256
257 /** 257 /**
258 * A mock [ServerOperation] for testing [AnalysisServer]. 258 * A mock [ServerOperation] for testing [AnalysisServer].
259 */ 259 */
260 class MockServerOperation implements PerformAnalysisOperation { 260 class MockServerOperation implements PerformAnalysisOperation {
261 final ServerOperationPriority priority; 261 final ServerOperationPriority priority;
262 final MockServerOperationPerformFunction _perform; 262 final MockServerOperationPerformFunction _perform;
263 263
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 431 }
432 return mismatchDescription; 432 return mismatchDescription;
433 } 433 }
434 434
435 @override 435 @override
436 bool matches(item, Map matchState) { 436 bool matches(item, Map matchState) {
437 Response response = item; 437 Response response = item;
438 return response != null && response.id == _id && response.error == null; 438 return response != null && response.id == _id && response.error == null;
439 } 439 }
440 } 440 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698