| 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 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 @MirrorsUsed(targets: 'mocks', override: '*') | 10 @MirrorsUsed(targets: 'mocks', override: '*') |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // would therefore not wait for microtask callbacks that are scheduled after | 54 // would therefore not wait for microtask callbacks that are scheduled after |
| 55 // invoking this method. | 55 // invoking this method. |
| 56 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); | 56 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * Returns a [Future] that completes when the given [AnalysisServer] finished | 60 * Returns a [Future] that completes when the given [AnalysisServer] finished |
| 61 * all its scheduled tasks. | 61 * all its scheduled tasks. |
| 62 */ | 62 */ |
| 63 Future waitForServerOperationsPerformed(AnalysisServer server) { | 63 Future waitForServerOperationsPerformed(AnalysisServer server) { |
| 64 if (server.test_areOperationsFinished()) { | 64 if (server.isAnalysisComplete()) { |
| 65 return new Future.value(); | 65 return new Future.value(); |
| 66 } | 66 } |
| 67 // We use a delayed future to allow microtask events to finish. The | 67 // We use a delayed future to allow microtask events to finish. The |
| 68 // Future.value or Future() constructors use scheduleMicrotask themselves and | 68 // Future.value or Future() constructors use scheduleMicrotask themselves and |
| 69 // would therefore not wait for microtask callbacks that are scheduled after | 69 // would therefore not wait for microtask callbacks that are scheduled after |
| 70 // invoking this method. | 70 // invoking this method. |
| 71 return new Future.delayed(Duration.ZERO, | 71 return new Future.delayed(Duration.ZERO, |
| 72 () => waitForServerOperationsPerformed(server)); | 72 () => waitForServerOperationsPerformed(server)); |
| 73 } | 73 } |
| 74 | 74 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 StringTypedMock(this._toString); | 498 StringTypedMock(this._toString); |
| 499 | 499 |
| 500 @override | 500 @override |
| 501 String toString() { | 501 String toString() { |
| 502 if (_toString != null) { | 502 if (_toString != null) { |
| 503 return _toString; | 503 return _toString; |
| 504 } | 504 } |
| 505 return super.toString(); | 505 return super.toString(); |
| 506 } | 506 } |
| 507 } | 507 } |
| OLD | NEW |