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

Side by Side Diff: pkg/analysis_server/test/domain_completion_util.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) 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.domain.completion; 5 library test.domain.completion;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
11 import 'package:analysis_server/src/domain_completion.dart'; 11 import 'package:analysis_server/src/domain_completion.dart';
12 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 12 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
13 import 'package:analysis_server/src/services/index/index.dart' show Index; 13 import 'package:analysis_server/src/services/index/index.dart';
14 import 'package:analysis_server/src/services/index/local_memory_index.dart';
15 import 'package:unittest/unittest.dart'; 14 import 'package:unittest/unittest.dart';
16 15
17 import 'analysis_abstract.dart'; 16 import 'analysis_abstract.dart';
18 import 'mocks.dart'; 17 import 'mocks.dart';
19 18
20 class AbstractCompletionDomainTest extends AbstractAnalysisTest { 19 class AbstractCompletionDomainTest extends AbstractAnalysisTest {
21 String completionId; 20 String completionId;
22 int completionOffset; 21 int completionOffset;
23 int replacementOffset; 22 int replacementOffset;
24 int replacementLength; 23 int replacementLength;
25 List<CompletionSuggestion> suggestions = []; 24 List<CompletionSuggestion> suggestions = [];
26 bool suggestionsDone = false; 25 bool suggestionsDone = false;
27 Map<String,List<CompletionSuggestion>> allSuggestions = {}; 26 Map<String, List<CompletionSuggestion>> allSuggestions = {};
28 27
29 String addTestFile(String content, {int offset}) { 28 String addTestFile(String content, {int offset}) {
30 completionOffset = content.indexOf('^'); 29 completionOffset = content.indexOf('^');
31 if (offset != null) { 30 if (offset != null) {
32 expect(completionOffset, -1, reason: 'cannot supply offset and ^'); 31 expect(completionOffset, -1, reason: 'cannot supply offset and ^');
33 completionOffset = offset; 32 completionOffset = offset;
34 return super.addTestFile(content); 33 return super.addTestFile(content);
35 } 34 }
36 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^'); 35 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^');
37 int nextOffset = content.indexOf('^', completionOffset + 1); 36 int nextOffset = content.indexOf('^', completionOffset + 1);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 72 }
74 } 73 }
75 74
76 void assertValidId(String id) { 75 void assertValidId(String id) {
77 expect(id, isNotNull); 76 expect(id, isNotNull);
78 expect(id.isNotEmpty, isTrue); 77 expect(id.isNotEmpty, isTrue);
79 } 78 }
80 79
81 @override 80 @override
82 Index createIndex() { 81 Index createIndex() {
83 return createLocalMemoryIndex(); 82 return createMemoryIndex();
84 } 83 }
85 84
86 Future getSuggestions() { 85 Future getSuggestions() {
87 return waitForTasksFinished().then((_) { 86 return waitForTasksFinished().then((_) {
88 Request request = 87 Request request =
89 new CompletionGetSuggestionsParams(testFile, completionOffset) 88 new CompletionGetSuggestionsParams(testFile, completionOffset)
90 .toRequest('0'); 89 .toRequest('0');
91 Response response = handleSuccessfulRequest(request); 90 Response response = handleSuccessfulRequest(request);
92 completionId = response.id; 91 completionId = response.id;
93 assertValidId(completionId); 92 assertValidId(completionId);
(...skipping 22 matching lines...) Expand all
116 } 115 }
117 } 116 }
118 117
119 @override 118 @override
120 void setUp() { 119 void setUp() {
121 super.setUp(); 120 super.setUp();
122 createProject(); 121 createProject();
123 handler = new CompletionDomainHandler(server); 122 handler = new CompletionDomainHandler(server);
124 } 123 }
125 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698