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

Unified Diff: pkg/analysis_server/test/integration/integration_tests.dart

Issue 453263002: Fix analysis server to only send SERVER_STATUS when subscribed to. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/integration/integration_tests.dart
diff --git a/pkg/analysis_server/test/integration/integration_tests.dart b/pkg/analysis_server/test/integration/integration_tests.dart
index dbd26a72f4485857e07da8d05a53be2e54eb4d35..6bbe118895a5358e6f0a50abcb3c55dd861eeb9b 100644
--- a/pkg/analysis_server/test/integration/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/integration_tests.dart
@@ -56,6 +56,11 @@ abstract class AbstractAnalysisServerIntegrationTest extends InttestMixin {
var serverConnectedParams;
/**
+ * True if we are currently subscribed to [SERVER_STATUS] updates.
+ */
+ bool _subscribedToServerStatus = false;
+
+ /**
* Write a source file with the given absolute [pathname] and [contents].
*
* If the file didn't previously exist, it is created. If it did, it is
@@ -79,10 +84,17 @@ abstract class AbstractAnalysisServerIntegrationTest extends InttestMixin {
/**
* Send the server an 'analysis.setAnalysisRoots' command directing it to
- * analyze [sourceDirectory].
- */
- Future standardAnalysisRoot() {
- return sendAnalysisSetAnalysisRoots([sourceDirectory.path], []);
+ * analyze [sourceDirectory]. If [subscribeStatus] is true (the default),
+ * then also enable [SERVER_STATUS] notifications so that [analysisFinished]
+ * can be used.
+ */
+ Future standardAnalysisSetup({bool subscribeStatus: true}) {
+ List<Future> futures = <Future>[];
+ if (subscribeStatus) {
+ futures.add(sendServerSetSubscriptions(['STATUS']));
+ }
+ futures.add(sendAnalysisSetAnalysisRoots([sourceDirectory.path], []));
+ return Future.wait(futures);
Brian Wilkerson 2014/08/09 15:33:16 Out of curiosity, is there any performance penalty
Paul Berry 2014/08/09 15:42:46 Looking at the implementation in sdk/lib/async/fut
}
/**
@@ -97,6 +109,9 @@ abstract class AbstractAnalysisServerIntegrationTest extends InttestMixin {
Future get analysisFinished {
Completer completer = new Completer();
StreamSubscription subscription;
+ // This will only work if the caller has already subscribed to
+ // SERVER_STATUS (e.g. using sendServerSetSubscriptions(['STATUS']))
+ expect(_subscribedToServerStatus, isTrue);
subscription = server.onNotification(SERVER_STATUS).listen((params) {
bool analysisComplete = false;
try {
@@ -122,6 +137,14 @@ abstract class AbstractAnalysisServerIntegrationTest extends InttestMixin {
server.debugStdio();
}
+ @override
+ Future sendServerSetSubscriptions(List<String> subscriptions, {bool
+ checkTypes: true}) {
+ _subscribedToServerStatus = subscriptions.contains('STATUS');
+ return super.sendServerSetSubscriptions(subscriptions, checkTypes:
+ checkTypes);
+ }
+
/**
* The server is automatically started before every test, and a temporary
* [sourceDirectory] is created.

Powered by Google App Engine
This is Rietveld 408576698