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

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

Issue 2842243003: Add completion support for plugins. (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/domain_completion.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/domain_completion_test.dart
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 31d853be150d33cc134205fc9485770aeeea1c1d..73b6aec6b280917ef17430415ce56ba2bba39aaa 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -8,10 +8,14 @@ import 'dart:async';
import 'package:analysis_server/plugin/protocol/protocol.dart';
import 'package:analysis_server/src/domain_completion.dart';
+import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/provisional/completion/completion_core.dart';
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
import 'package:analysis_server/src/services/completion/dart/contribution_sorter.dart';
+import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
+import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin;
+import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -28,6 +32,12 @@ main() {
@reflectiveTest
class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
+ @override
+ void setUp() {
+ enableNewAnalysisDriver = true;
+ super.setUp();
+ }
+
test_ArgumentList_constructor_named_param_label() async {
addTestFile('main() { new A(^);}'
'class A { A({one, two}) {} }');
@@ -169,7 +179,11 @@ class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
expect(suggestions, hasLength(2));
}
+ @failingTest
test_html() {
+ //
+ // We no longer support the analysis of non-dart files.
+ //
testFile = '/project/web/test.html';
addTestFile('''
<html>^</html>
@@ -209,7 +223,12 @@ class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
});
}
+ @failingTest
test_imports_aborted_new_request() async {
+ // TODO(brianwilkerson) Figure out whether this test makes sense when
+ // running the new driver. It waits for an initial empty notification then
+ // waits for a new notification. But I think that under the driver we only
+ // ever send one notification.
addTestFile('''
class foo { }
c^''');
@@ -247,7 +266,12 @@ class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
relevance: DART_RELEVANCE_HIGH);
}
+ @failingTest
test_imports_aborted_source_changed() async {
+ // TODO(brianwilkerson) Figure out whether this test makes sense when
+ // running the new driver. It waits for an initial empty notification then
+ // waits for a new notification. But I think that under the driver we only
+ // ever send one notification.
addTestFile('''
class foo { }
c^''');
@@ -626,6 +650,33 @@ class B extends A {m() {^}}
});
}
+ test_sentToPlugins() async {
+ addTestFile('''
+ void main() {
+ ^
+ }
+ ''');
+ PluginInfo info = new PluginInfo('a', 'b', 'c', null, null);
+ plugin.CompletionGetSuggestionsResult result =
+ new plugin.CompletionGetSuggestionsResult(
+ 1, 2, <plugin.CompletionSuggestion>[
+ new plugin.CompletionSuggestion(
+ plugin.CompletionSuggestionKind.IDENTIFIER,
+ DART_RELEVANCE_DEFAULT,
+ 'plugin completion',
+ 3,
+ 0,
+ false,
+ false)
+ ]);
+ pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{
+ info: new Future.value(result.toResponse('-'))
+ };
+ await getSuggestions();
+ assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'plugin completion',
+ selectionOffset: 3);
+ }
+
test_simple() {
addTestFile('''
void main() {
« no previous file with comments | « pkg/analysis_server/lib/src/domain_completion.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698