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

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

Issue 2618243002: Fix the rest of the completion tests with the new analysis driver. (Closed)
Patch Set: Created 3 years, 11 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/test/integration/completion/get_suggestions_test.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 var libSource = addSource( 47 var libSource = addSource(
48 '/libB.dart', 48 '/libB.dart',
49 ''' 49 '''
50 library libB; 50 library libB;
51 import "/libA.dart" as foo; 51 import "/libA.dart" as foo;
52 part '$testFile'; 52 part '$testFile';
53 '''); 53 ''');
54 addTestSource('part of libB; main() {^}'); 54 addTestSource('part of libB; main() {^}');
55 55
56 // Associate part with library 56 // Associate part with library
57 context.computeResult(libSource, LIBRARY_CYCLE_UNITS); 57 if (!enableNewAnalysisDriver) {
58 context.computeResult(libSource, LIBRARY_CYCLE_UNITS);
59 }
58 60
59 // Build the request 61 // Build the request
60 CompletionRequestImpl baseRequest = new CompletionRequestImpl( 62 CompletionRequestImpl baseRequest = new CompletionRequestImpl(
61 null, 63 enableNewAnalysisDriver ? await driver.getResult(testFile) : null,
62 context, 64 enableNewAnalysisDriver ? null : context,
63 provider, 65 provider,
64 searchEngine, 66 searchEngine,
65 testSource, 67 testSource,
66 completionOffset, 68 completionOffset,
67 new CompletionPerformance()); 69 new CompletionPerformance());
68 Completer<DartCompletionRequest> requestCompleter = 70 Completer<DartCompletionRequest> requestCompleter =
69 new Completer<DartCompletionRequest>(); 71 new Completer<DartCompletionRequest>();
70 DartCompletionRequestImpl 72 DartCompletionRequestImpl
71 .from(baseRequest, resultDescriptor: RESOLVED_UNIT1) 73 .from(baseRequest, resultDescriptor: RESOLVED_UNIT1)
72 .then((DartCompletionRequest request) { 74 .then((DartCompletionRequest request) {
73 requestCompleter.complete(request); 75 requestCompleter.complete(request);
74 }); 76 });
75 request = await performAnalysis(200, requestCompleter); 77 request = await performAnalysis(200, requestCompleter);
76 78
77 // Get the unresolved directives 79 // Get the unresolved directives
78 var directives = request.target.unit.directives; 80 var directives = request.target.unit.directives;
79 81
80 // Assert that the import does not have an export namespace 82 // Assert that the import does not have an export namespace
81 Element element = resolutionMap.elementDeclaredByDirective(directives[0]); 83 if (!enableNewAnalysisDriver) {
82 expect(element?.library?.exportNamespace, isNull); 84 Element element = resolutionMap.elementDeclaredByDirective(directives[0]);
85 expect(element?.library?.exportNamespace, isNull);
86 }
83 87
84 // Resolve directives 88 // Resolve directives
85 var importCompleter = new Completer<List<ImportElement>>(); 89 var importCompleter = new Completer<List<ImportElement>>();
86 request.resolveImports().then((List<ImportElement> elements) { 90 request.resolveImports().then((List<ImportElement> elements) {
87 importCompleter.complete(elements); 91 importCompleter.complete(elements);
88 }); 92 });
89 List<ImportElement> imports = await performAnalysis(200, importCompleter); 93 List<ImportElement> imports = await performAnalysis(200, importCompleter);
90 expect(imports, hasLength(directives.length + 1)); 94 expect(imports, hasLength(directives.length + 1));
91 95
92 ImportElement importNamed(String expectedUri) { 96 ImportElement importNamed(String expectedUri) {
(...skipping 11 matching lines...) Expand all
104 // Assert that the new imports each have an export namespace 108 // Assert that the new imports each have an export namespace
105 assertImportedLib(null /* dart:core */); 109 assertImportedLib(null /* dart:core */);
106 assertImportedLib('/libA.dart'); 110 assertImportedLib('/libA.dart');
107 } 111 }
108 } 112 }
109 113
110 @reflectiveTest 114 @reflectiveTest
111 class CompletionManagerTest_Driver extends CompletionManagerTest { 115 class CompletionManagerTest_Driver extends CompletionManagerTest {
112 @override 116 @override
113 bool get enableNewAnalysisDriver => true; 117 bool get enableNewAnalysisDriver => true;
114
115 @failingTest
116 @override
117 test_resolveDirectives() {
118 // Bad state: Should not be used with the new analysis driver.
119 return super.test_resolveDirectives();
120 }
121 } 118 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/integration/completion/get_suggestions_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698