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

Unified Diff: pkg/analysis_server/test/mocks.dart

Issue 307533004: Send 'notification.errors' for all non-SDK files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698