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

Unified Diff: pkg/analysis_server/test/src/plugin/plugin_manager_test.dart

Issue 2893803004: Capture the request time for performance data and support forced shutdown (Closed)
Patch Set: Created 3 years, 7 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
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();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698