Index: pkg/analysis_server/test/src/plugin/plugin_manager_test.dart |
diff --git a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart |
index 0990dd56a8bb2b03e6baec54d5b16b37e1546bc0..b101b9b6d3e2cdfd0aa02d836489d1146e3a1a3e 100644 |
--- a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart |
+++ b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart |
@@ -90,12 +90,12 @@ class BuiltInPluginInfoTest { |
expect(() => plugin.stop(), throwsA(new isInstanceOf<StateError>())); |
} |
- test_stop_running() { |
+ test_stop_running() async { |
PluginSession session = new PluginSession(plugin); |
TestServerCommunicationChannel channel = |
new TestServerCommunicationChannel(session); |
plugin.currentSession = session; |
- plugin.stop(); |
+ await plugin.stop(); |
expect(plugin.currentSession, isNull); |
expect(channel.sentRequests, hasLength(1)); |
expect(channel.sentRequests[0].method, 'plugin.shutdown'); |
@@ -166,12 +166,12 @@ class DiscoveredPluginInfoTest { |
expect(() => plugin.stop(), throwsA(new isInstanceOf<StateError>())); |
} |
- test_stop_running() { |
+ test_stop_running() async { |
PluginSession session = new PluginSession(plugin); |
TestServerCommunicationChannel channel = |
new TestServerCommunicationChannel(session); |
plugin.currentSession = session; |
- plugin.stop(); |
+ await plugin.stop(); |
expect(plugin.currentSession, isNull); |
expect(channel.sentRequests, hasLength(1)); |
expect(channel.sentRequests[0].method, 'plugin.shutdown'); |
@@ -491,10 +491,10 @@ class PluginSessionTest { |
expect(() => session.stop(), throwsA(new isInstanceOf<StateError>())); |
} |
- void test_stop_running() { |
+ test_stop_running() async { |
TestServerCommunicationChannel channel = |
new TestServerCommunicationChannel(session); |
- session.stop(); |
+ await session.stop(); |
expect(channel.sentRequests, hasLength(1)); |
expect(channel.sentRequests[0].method, 'plugin.shutdown'); |
} |
@@ -671,10 +671,11 @@ class TestNotificationManager implements NotificationManager { |
} |
class TestServerCommunicationChannel implements ServerCommunicationChannel { |
+ final PluginSession session; |
int closeCount = 0; |
List<Request> sentRequests = <Request>[]; |
- TestServerCommunicationChannel(PluginSession session) { |
+ TestServerCommunicationChannel(this.session) { |
session.channel = this; |
} |
@@ -683,6 +684,10 @@ class TestServerCommunicationChannel implements ServerCommunicationChannel { |
closeCount++; |
} |
+ void kill() { |
+ fail('Unexpected invocation of kill'); |
+ } |
+ |
@override |
void listen(void onResponse(Response response), |
void onNotification(Notification notification), |
@@ -693,5 +698,8 @@ class TestServerCommunicationChannel implements ServerCommunicationChannel { |
@override |
void sendRequest(Request request) { |
sentRequests.add(request); |
+ if (request.method == 'plugin.shutdown') { |
+ session.handleOnDone(); |
+ } |
} |
} |