| OLD | NEW |
| 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 @MirrorsUsed(targets: 'mocks', override: '*') | 7 @MirrorsUsed(targets: 'mocks', override: '*') |
| 8 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 } | 276 } |
| 277 | 277 |
| 278 Future<Response> waitForResponse(Request request) { | 278 Future<Response> waitForResponse(Request request) { |
| 279 String id = request.id; | 279 String id = request.id; |
| 280 pumpEventQueue().then((_) { | 280 pumpEventQueue().then((_) { |
| 281 responseController.addError(new NoResponseException(request)); | 281 responseController.addError(new NoResponseException(request)); |
| 282 }); | 282 }); |
| 283 return responseController.stream.firstWhere((response) { | 283 return responseController.stream.firstWhere((response) { |
| 284 return response.id == id; | 284 return response.id == id; |
| 285 }); | 285 }); |
| 286 // return responseController.stream.firstWhere((response) { | |
| 287 // return response.id == id; | |
| 288 // }); | |
| 289 } | 286 } |
| 290 } | 287 } |
| 291 | 288 |
| 292 | 289 |
| 293 /** | 290 /** |
| 294 * A mock [ServerOperation] for testing [AnalysisServer]. | 291 * A mock [ServerOperation] for testing [AnalysisServer]. |
| 295 */ | 292 */ |
| 296 class MockServerOperation implements PerformAnalysisOperation { | 293 class MockServerOperation implements PerformAnalysisOperation { |
| 297 final ServerOperationPriority priority; | 294 final ServerOperationPriority priority; |
| 298 final MockServerOperationPerformFunction _perform; | 295 final MockServerOperationPerformFunction _perform; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 478 } |
| 482 return mismatchDescription; | 479 return mismatchDescription; |
| 483 } | 480 } |
| 484 | 481 |
| 485 @override | 482 @override |
| 486 bool matches(item, Map matchState) { | 483 bool matches(item, Map matchState) { |
| 487 Response response = item; | 484 Response response = item; |
| 488 return response != null && response.id == _id && response.error == null; | 485 return response != null && response.id == _id && response.error == null; |
| 489 } | 486 } |
| 490 } | 487 } |
| OLD | NEW |