OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io' as io; | 6 import 'dart:io' as io; |
7 | 7 |
8 import 'package:analysis_server/src/plugin/notification_manager.dart'; | 8 import 'package:analysis_server/src/plugin/notification_manager.dart'; |
9 import 'package:analysis_server/src/plugin/plugin_manager.dart'; | 9 import 'package:analysis_server/src/plugin/plugin_manager.dart'; |
10 import 'package:analyzer/context/context_root.dart'; | 10 import 'package:analyzer/context/context_root.dart'; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 } | 663 } |
664 packagesPath = path.dirname(packagesPath); | 664 packagesPath = path.dirname(packagesPath); |
665 packagesPath = path.dirname(packagesPath); | 665 packagesPath = path.dirname(packagesPath); |
666 return path.join(packagesPath, '.packages'); | 666 return path.join(packagesPath, '.packages'); |
667 } | 667 } |
668 } | 668 } |
669 | 669 |
670 class TestNotificationManager implements NotificationManager { | 670 class TestNotificationManager implements NotificationManager { |
671 List<Notification> notifications = <Notification>[]; | 671 List<Notification> notifications = <Notification>[]; |
672 | 672 |
| 673 Map<String, Map<String, List<AnalysisError>>> recordedErrors = |
| 674 <String, Map<String, List<AnalysisError>>>{}; |
| 675 |
673 @override | 676 @override |
674 void handlePluginNotification(String pluginId, Notification notification) { | 677 void handlePluginNotification(String pluginId, Notification notification) { |
675 notifications.add(notification); | 678 notifications.add(notification); |
676 } | 679 } |
677 | 680 |
678 @override | 681 @override |
679 noSuchMethod(Invocation invocation) { | 682 noSuchMethod(Invocation invocation) { |
680 fail('Unexpected invocation of ${invocation.memberName}'); | 683 fail('Unexpected invocation of ${invocation.memberName}'); |
681 } | 684 } |
| 685 |
| 686 @override |
| 687 void recordAnalysisErrors( |
| 688 String pluginId, String filePath, List<AnalysisError> errorData) { |
| 689 recordedErrors.putIfAbsent( |
| 690 pluginId, () => <String, List<AnalysisError>>{})[filePath] = errorData; |
| 691 } |
682 } | 692 } |
683 | 693 |
684 class TestServerCommunicationChannel implements ServerCommunicationChannel { | 694 class TestServerCommunicationChannel implements ServerCommunicationChannel { |
685 final PluginSession session; | 695 final PluginSession session; |
686 int closeCount = 0; | 696 int closeCount = 0; |
687 List<Request> sentRequests = <Request>[]; | 697 List<Request> sentRequests = <Request>[]; |
688 | 698 |
689 TestServerCommunicationChannel(this.session) { | 699 TestServerCommunicationChannel(this.session) { |
690 session.channel = this; | 700 session.channel = this; |
691 } | 701 } |
(...skipping 15 matching lines...) Expand all Loading... |
707 } | 717 } |
708 | 718 |
709 @override | 719 @override |
710 void sendRequest(Request request) { | 720 void sendRequest(Request request) { |
711 sentRequests.add(request); | 721 sentRequests.add(request); |
712 if (request.method == 'plugin.shutdown') { | 722 if (request.method == 'plugin.shutdown') { |
713 session.handleOnDone(); | 723 session.handleOnDone(); |
714 } | 724 } |
715 } | 725 } |
716 } | 726 } |
OLD | NEW |