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 test.analysis_server; | 5 library test.analysis_server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 resourceProvider.newFolder('/bar'); | 313 resourceProvider.newFolder('/bar'); |
314 resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";'); | 314 resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";'); |
315 File bar = resourceProvider.newFile('/bar/bar.dart', 'library bar;'); | 315 File bar = resourceProvider.newFile('/bar/bar.dart', 'library bar;'); |
316 server.setAnalysisRoots('0', ['/foo', '/bar'], [], {}); | 316 server.setAnalysisRoots('0', ['/foo', '/bar'], [], {}); |
317 Map<AnalysisService, Set<String>> subscriptions = | 317 Map<AnalysisService, Set<String>> subscriptions = |
318 <AnalysisService, Set<String>>{}; | 318 <AnalysisService, Set<String>>{}; |
319 for (AnalysisService service in AnalysisService.VALUES) { | 319 for (AnalysisService service in AnalysisService.VALUES) { |
320 subscriptions[service] = <String>[bar.path].toSet(); | 320 subscriptions[service] = <String>[bar.path].toSet(); |
321 } | 321 } |
322 server.setAnalysisSubscriptions(subscriptions); | 322 server.setAnalysisSubscriptions(subscriptions); |
323 await pumpEventQueue(200); | 323 await pumpEventQueue(500); |
324 expect(server.statusAnalyzing, isFalse); | 324 expect(server.statusAnalyzing, isFalse); |
325 channel.notificationsReceived.clear(); | 325 channel.notificationsReceived.clear(); |
326 server.updateContent( | 326 server.updateContent( |
327 '0', {bar.path: new AddContentOverlay('library bar; void f() {}')}); | 327 '0', {bar.path: new AddContentOverlay('library bar; void f() {}')}); |
328 await pumpEventQueue(200); | 328 await pumpEventQueue(500); |
329 expect(server.statusAnalyzing, isFalse); | 329 expect(server.statusAnalyzing, isFalse); |
330 expect(channel.notificationsReceived, isNotEmpty); | 330 expect(channel.notificationsReceived, isNotEmpty); |
331 Set<String> notificationTypesReceived = new Set<String>(); | 331 Set<String> notificationTypesReceived = new Set<String>(); |
332 for (Notification notification in channel.notificationsReceived) { | 332 for (Notification notification in channel.notificationsReceived) { |
333 String notificationType = notification.event; | 333 String notificationType = notification.event; |
334 switch (notificationType) { | 334 switch (notificationType) { |
335 case 'server.status': | 335 case 'server.status': |
336 case 'analysis.errors': | 336 case 'analysis.errors': |
337 // It's normal for these notifications to be sent multiple times. | 337 // It's normal for these notifications to be sent multiple times. |
338 break; | 338 break; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 _MockServerOperation(this.context); | 500 _MockServerOperation(this.context); |
501 | 501 |
502 @override | 502 @override |
503 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; | 503 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; |
504 | 504 |
505 @override | 505 @override |
506 void perform(AnalysisServer server) { | 506 void perform(AnalysisServer server) { |
507 isComplete = true; | 507 isComplete = true; |
508 } | 508 } |
509 } | 509 } |
OLD | NEW |