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

Side by Side Diff: pkg/analysis_server/test/analysis/update_content_test.dart

Issue 1801883002: Remove old index and search implementations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.analysis.updateContent; 5 library test.analysis.updateContent;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/analysis_server.dart'; 8 import 'package:analysis_server/src/analysis_server.dart';
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/services/index/index.dart'; 10 import 'package:analysis_server/src/services/index/index.dart';
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 expect(e.response.id, id); 89 expect(e.response.id, id);
90 expect(e.response.error.code, RequestErrorCode.INVALID_OVERLAY_CHANGE); 90 expect(e.response.error.code, RequestErrorCode.INVALID_OVERLAY_CHANGE);
91 } 91 }
92 } 92 }
93 93
94 test_indexUnitAfterNopChange() async { 94 test_indexUnitAfterNopChange() async {
95 var testUnitMatcher = compilationUnitMatcher(testFile) as dynamic; 95 var testUnitMatcher = compilationUnitMatcher(testFile) as dynamic;
96 createProject(); 96 createProject();
97 addTestFile('main() { print(1); }'); 97 addTestFile('main() { print(1); }');
98 await server.onAnalysisComplete; 98 await server.onAnalysisComplete;
99 verify(server.index.index(anyObject, testUnitMatcher)).times(1); 99 verify(server.index.indexUnit(testUnitMatcher)).times(1);
100 // add an overlay 100 // add an overlay
101 server.updateContent( 101 server.updateContent(
102 '1', {testFile: new AddContentOverlay('main() { print(2); }')}); 102 '1', {testFile: new AddContentOverlay('main() { print(2); }')});
103 // Perform the next single operation: analysis. 103 // Perform the next single operation: analysis.
104 // It will schedule an indexing operation. 104 // It will schedule an indexing operation.
105 await server.test_onOperationPerformed; 105 await server.test_onOperationPerformed;
106 // Update the file and remove an overlay. 106 // Update the file and remove an overlay.
107 resourceProvider.updateFile(testFile, 'main() { print(2); }'); 107 resourceProvider.updateFile(testFile, 'main() { print(2); }');
108 server.updateContent('2', {testFile: new RemoveContentOverlay()}); 108 server.updateContent('2', {testFile: new RemoveContentOverlay()});
109 // Validate that at the end the unit was indexed. 109 // Validate that at the end the unit was indexed.
110 await server.onAnalysisComplete; 110 await server.onAnalysisComplete;
111 verify(server.index.index(anyObject, testUnitMatcher)).times(3); 111 verify(server.index.indexUnit(testUnitMatcher)).times(3);
112 } 112 }
113 113
114 test_multiple_contexts() async { 114 test_multiple_contexts() async {
115 String fooPath = '/project1/foo.dart'; 115 String fooPath = '/project1/foo.dart';
116 resourceProvider.newFile( 116 resourceProvider.newFile(
117 fooPath, 117 fooPath,
118 ''' 118 '''
119 library foo; 119 library foo;
120 import '../project2/baz.dart'; 120 import '../project2/baz.dart';
121 main() { f(); }'''); 121 main() { f(); }''');
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 _ArgumentMatcher_CompilationUnit(this.file); 291 _ArgumentMatcher_CompilationUnit(this.file);
292 292
293 @override 293 @override
294 bool matches(arg) { 294 bool matches(arg) {
295 return arg is CompilationUnit && arg.element.source.fullName == file; 295 return arg is CompilationUnit && arg.element.source.fullName == file;
296 } 296 }
297 } 297 }
298 298
299 class _MockIndex extends TypedMock implements Index {} 299 class _MockIndex extends TypedMock implements Index {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698