| Index: pkg/analysis_server/test/mocks.dart
|
| diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart
|
| index 1d0082ceb999cfe4605c4b955cadb3129499e026..8f909933f5bbbd2719adcdc00dba086b228f848e 100644
|
| --- a/pkg/analysis_server/test/mocks.dart
|
| +++ b/pkg/analysis_server/test/mocks.dart
|
| @@ -51,6 +51,22 @@ Future pumpEventQueue([int times = 20]) {
|
| }
|
|
|
| /**
|
| + * Returns a [Future] that completes when the given [AnalysisServer] finished
|
| + * all its scheduled tasks.
|
| + */
|
| +Future waitForServerTasksFinished(AnalysisServer server) {
|
| + if (server.test_areTasksFinished()) {
|
| + return new Future.value();
|
| + }
|
| + // We use a delayed future to allow microtask events to finish. The
|
| + // Future.value or Future() constructors use scheduleMicrotask themselves and
|
| + // would therefore not wait for microtask callbacks that are scheduled after
|
| + // invoking this method.
|
| + return new Future.delayed(Duration.ZERO,
|
| + () => waitForServerTasksFinished(server));
|
| +}
|
| +
|
| +/**
|
| * A mock [WebSocket] for testing.
|
| */
|
| class MockSocket<T> implements WebSocket {
|
|
|