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

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart

Issue 2873943003: cleanup dart code completion contributors (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library test.services.completion.dart.manager; 5 library test.services.completion.dart.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
10 import 'package:analysis_server/src/services/completion/completion_core.dart'; 10 import 'package:analysis_server/src/services/completion/completion_core.dart';
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 null); 68 null);
69 Completer<DartCompletionRequest> requestCompleter = 69 Completer<DartCompletionRequest> requestCompleter =
70 new Completer<DartCompletionRequest>(); 70 new Completer<DartCompletionRequest>();
71 DartCompletionRequestImpl 71 DartCompletionRequestImpl
72 .from(baseRequest, resultDescriptor: RESOLVED_UNIT1) 72 .from(baseRequest, resultDescriptor: RESOLVED_UNIT1)
73 .then((DartCompletionRequest request) { 73 .then((DartCompletionRequest request) {
74 requestCompleter.complete(request); 74 requestCompleter.complete(request);
75 }); 75 });
76 request = await performAnalysis(200, requestCompleter); 76 request = await performAnalysis(200, requestCompleter);
77 77
78 // Get the unresolved directives
79 var directives = request.target.unit.directives; 78 var directives = request.target.unit.directives;
80 79
81 // Assert that the import does not have an export namespace 80 List<ImportElement> imports = request.libraryElement.imports;
82 if (!enableNewAnalysisDriver) {
83 Element element = resolutionMap.elementDeclaredByDirective(directives[0]);
84 expect(element?.library?.exportNamespace, isNull);
85 }
86
87 // Resolve directives
88 var importCompleter = new Completer<List<ImportElement>>();
89 request.resolveImports().then((List<ImportElement> elements) {
90 importCompleter.complete(elements);
91 });
92 List<ImportElement> imports = await performAnalysis(200, importCompleter);
93 expect(imports, hasLength(directives.length + 1)); 81 expect(imports, hasLength(directives.length + 1));
94 82
95 ImportElement importNamed(String expectedUri) { 83 ImportElement importNamed(String expectedUri) {
96 return imports.firstWhere((elem) => elem.uri == expectedUri, orElse: () { 84 return imports.firstWhere((elem) => elem.uri == expectedUri, orElse: () {
97 var importedNames = imports.map((elem) => elem.uri); 85 var importedNames = imports.map((elem) => elem.uri);
98 fail('Failed to find $expectedUri in $importedNames'); 86 fail('Failed to find $expectedUri in $importedNames');
99 }); 87 });
100 } 88 }
101 89
102 void assertImportedLib(String expectedUri) { 90 void assertImportedLib(String expectedUri) {
103 ImportElement importElem = importNamed(expectedUri); 91 ImportElement importElem = importNamed(expectedUri);
104 expect(importElem.importedLibrary.exportNamespace, isNotNull); 92 expect(importElem.importedLibrary.exportNamespace, isNotNull);
105 } 93 }
106 94
107 // Assert that the new imports each have an export namespace 95 // Assert that the new imports each have an export namespace
108 assertImportedLib(null /* dart:core */); 96 assertImportedLib(null /* dart:core */);
109 assertImportedLib('/libA.dart'); 97 assertImportedLib('/libA.dart');
110 } 98 }
111 } 99 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698