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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 DiscoveredPluginInfo plugin; | 112 DiscoveredPluginInfo plugin; |
113 | 113 |
114 void setUp() { | 114 void setUp() { |
115 resourceProvider = new MemoryResourceProvider(); | 115 resourceProvider = new MemoryResourceProvider(); |
116 notificationManager = new TestNotificationManager(); | 116 notificationManager = new TestNotificationManager(); |
117 plugin = new DiscoveredPluginInfo(pluginPath, executionPath, packagesPath, | 117 plugin = new DiscoveredPluginInfo(pluginPath, executionPath, packagesPath, |
118 notificationManager, InstrumentationService.NULL_SERVICE); | 118 notificationManager, InstrumentationService.NULL_SERVICE); |
119 } | 119 } |
120 | 120 |
121 test_addContextRoot() { | 121 test_addContextRoot() { |
| 122 String optionsFilePath = '/pkg1/analysis_options.yaml'; |
122 ContextRoot contextRoot1 = new ContextRoot('/pkg1', []); | 123 ContextRoot contextRoot1 = new ContextRoot('/pkg1', []); |
| 124 contextRoot1.optionsFilePath = optionsFilePath; |
| 125 PluginSession session = new PluginSession(plugin); |
| 126 TestServerCommunicationChannel channel = |
| 127 new TestServerCommunicationChannel(session); |
| 128 plugin.currentSession = session; |
123 plugin.addContextRoot(contextRoot1); | 129 plugin.addContextRoot(contextRoot1); |
124 expect(plugin.contextRoots, [contextRoot1]); | 130 expect(plugin.contextRoots, [contextRoot1]); |
125 plugin.addContextRoot(contextRoot1); | 131 plugin.addContextRoot(contextRoot1); |
126 expect(plugin.contextRoots, [contextRoot1]); | 132 expect(plugin.contextRoots, [contextRoot1]); |
| 133 List<Request> sentRequests = channel.sentRequests; |
| 134 expect(sentRequests, hasLength(1)); |
| 135 List<Map> roots = sentRequests[0].params['roots']; |
| 136 expect(roots[0]['optionsFile'], optionsFilePath); |
127 } | 137 } |
128 | 138 |
129 test_creation() { | 139 test_creation() { |
130 expect(plugin.path, pluginPath); | 140 expect(plugin.path, pluginPath); |
131 expect(plugin.executionPath, executionPath); | 141 expect(plugin.executionPath, executionPath); |
132 expect(plugin.notificationManager, notificationManager); | 142 expect(plugin.notificationManager, notificationManager); |
133 expect(plugin.contextRoots, isEmpty); | 143 expect(plugin.contextRoots, isEmpty); |
134 expect(plugin.currentSession, isNull); | 144 expect(plugin.currentSession, isNull); |
135 } | 145 } |
136 | 146 |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 707 } |
698 | 708 |
699 @override | 709 @override |
700 void sendRequest(Request request) { | 710 void sendRequest(Request request) { |
701 sentRequests.add(request); | 711 sentRequests.add(request); |
702 if (request.method == 'plugin.shutdown') { | 712 if (request.method == 'plugin.shutdown') { |
703 session.handleOnDone(); | 713 session.handleOnDone(); |
704 } | 714 } |
705 } | 715 } |
706 } | 716 } |
OLD | NEW |