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

Unified Diff: pkg/analysis_server/test/analysis_abstract.dart

Issue 2832643005: Add plugin support for getAssists (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | pkg/analysis_server/test/edit/assists_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/analysis_abstract.dart
diff --git a/pkg/analysis_server/test/analysis_abstract.dart b/pkg/analysis_server/test/analysis_abstract.dart
index c147c23bc7493ed6a2bfe3741033ea081f2c0467..d0c918d1656d1f32d95612b45d32c50a854feb3a 100644
--- a/pkg/analysis_server/test/analysis_abstract.dart
+++ b/pkg/analysis_server/test/analysis_abstract.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library test.domain.analysis.abstract;
-
import 'dart:async';
import 'package:analysis_server/plugin/protocol/protocol.dart'
@@ -11,15 +9,20 @@ import 'package:analysis_server/plugin/protocol/protocol.dart'
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/constants.dart';
import 'package:analysis_server/src/domain_analysis.dart';
+import 'package:analysis_server/src/plugin/notification_manager.dart';
+import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/plugin/server_plugin.dart';
import 'package:analysis_server/src/provisional/completion/dart/completion_plugin.dart';
import 'package:analysis_server/src/services/index/index.dart';
+import 'package:analyzer/context/context_root.dart' as analyzer;
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
+import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin;
import 'package:plugin/manager.dart';
import 'package:plugin/plugin.dart';
import 'package:test/test.dart';
@@ -51,6 +54,7 @@ class AbstractAnalysisTest {
MockServerChannel serverChannel;
MemoryResourceProvider resourceProvider;
MockPackageMapProvider packageMapProvider;
+ TestPluginManager pluginManager;
AnalysisServer server;
RequestHandler handler;
@@ -224,8 +228,10 @@ class AbstractAnalysisTest {
testFolder = resourceProvider.convertPath('/project/bin');
testFile = resourceProvider.convertPath('/project/bin/test.dart');
packageMapProvider = new MockPackageMapProvider();
+ pluginManager = new TestPluginManager();
Index index = createIndex();
server = createAnalysisServer(index);
+ server.pluginManager = pluginManager;
handler = analysisHandler;
// listen for notifications
Stream<Notification> notificationStream =
@@ -258,3 +264,65 @@ class AbstractAnalysisTest {
return serverChannel.sendRequest(request);
}
}
+
+/**
+ * A plugin manager that simulates broadcasting requests to plugins by
+ * hard-coding the responses.
+ */
+class TestPluginManager implements PluginManager {
+ Map<PluginInfo, Future<plugin.Response>> broadcastResults;
+
+ @override
+ String get byteStorePath {
+ fail('Unexpected invocation of byteStorePath');
+ return null;
+ }
+
+ @override
+ InstrumentationService get instrumentationService {
+ fail('Unexpected invocation of instrumentationService');
+ return null;
+ }
+
+ @override
+ NotificationManager get notificationManager {
+ fail('Unexpected invocation of notificationManager');
+ return null;
+ }
+
+ @override
+ ResourceProvider get resourceProvider {
+ fail('Unexpected invocation of resourceProvider');
+ return null;
+ }
+
+ @override
+ Future<Null> addPluginToContextRoot(
+ analyzer.ContextRoot contextRoot, String path) async {
+ fail('Unexpected invocation of addPluginToContextRoot');
+ return null;
+ }
+
+ @override
+ Map<PluginInfo, Future<plugin.Response>> broadcast(
+ analyzer.ContextRoot contextRoot, plugin.RequestParams params) {
+ return broadcastResults ?? <PluginInfo, Future<plugin.Response>>{};
+ }
+
+ @override
+ List<PluginInfo> pluginsForContextRoot(analyzer.ContextRoot contextRoot) {
+ fail('Unexpected invocation of pluginsForContextRoot');
+ return null;
+ }
+
+ @override
+ void removedContextRoot(analyzer.ContextRoot contextRoot) {
+ fail('Unexpected invocation of removedContextRoot');
+ }
+
+ @override
+ Future<List<Null>> stopAll() async {
+ fail('Unexpected invocation of stopAll');
+ return null;
+ }
+}
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | pkg/analysis_server/test/edit/assists_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698