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

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

Issue 1000203003: If the file belongs to any analysis root, check whether we're in it now. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/analysis_server_test.dart
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index daba3fdb8bc761b9036911e1cc7b17b90e422ca6..efd1c168215d404060b5d41b5237a28a0b903817 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -283,6 +283,53 @@ import "../foo/foo.dart";
expect(source.fullName, filePath);
}
+ /**
+ * Test that having multiple analysis contexts analyze the same file doesn't
+ * cause that file to receive duplicate notifications when it's modified.
+ */
+ Future test_no_duplicate_notifications() async {
+ // Subscribe to STATUS so we'll know when analysis is done.
+ server.serverServices = [ServerService.STATUS].toSet();
+ resourceProvider.newFolder('/foo');
+ resourceProvider.newFolder('/bar');
+ resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";');
+ File bar = resourceProvider.newFile('/bar/bar.dart', 'library bar;');
+ server.setAnalysisRoots('0', ['/foo', '/bar'], [], {});
+ Map<AnalysisService, Set<String>> subscriptions =
+ <AnalysisService, Set<String>>{};
+ for (AnalysisService service in AnalysisService.VALUES) {
+ subscriptions[service] = <String>[bar.path].toSet();
+ }
+ server.setAnalysisSubscriptions(subscriptions);
+ await pumpEventQueue(100);
+ expect(server.statusAnalyzing, isFalse);
+ channel.notificationsReceived.clear();
+ server.updateContent(
+ '0', {bar.path: new AddContentOverlay('library bar; void f() {}')});
+ await pumpEventQueue(100);
+ expect(server.statusAnalyzing, isFalse);
+ expect(channel.notificationsReceived, isNotEmpty);
+ Set<String> notificationTypesReceived = new Set<String>();
+ for (Notification notification in channel.notificationsReceived) {
+ String notificationType = notification.event;
+ switch (notificationType) {
+ case 'server.status':
+ case 'analysis.errors':
+ // It's normal for these notifications to be sent multiple times.
+ break;
+ case 'analysis.outline':
+ // It's normal for this notification to be sent twice.
+ // TODO(paulberry): why?
+ break;
+ default:
+ if (!notificationTypesReceived.add(notificationType)) {
+ fail('Notification type $notificationType received more than once');
+ }
+ break;
+ }
+ }
+ }
+
test_operationsRemovedOnContextDisposal() async {
resourceProvider.newFolder('/foo');
resourceProvider.newFile('/foo/baz.dart', 'library lib;');
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698