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

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

Issue 742163002: cache import suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 1 month 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 | Annotate | Revision Log
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.suggestion; 5 library test.services.completion.suggestion;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/completion/completion_manager.dart' ; 10 import 'package:analysis_server/src/services/completion/completion_manager.dart' ;
(...skipping 26 matching lines...) Expand all
37 // would therefore not wait for microtask callbacks that are scheduled after 37 // would therefore not wait for microtask callbacks that are scheduled after
38 // invoking this method. 38 // invoking this method.
39 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); 39 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
40 } 40 }
41 41
42 @ReflectiveTestCase() 42 @ReflectiveTestCase()
43 class DartCompletionManagerTest extends AbstractSingleUnitTest { 43 class DartCompletionManagerTest extends AbstractSingleUnitTest {
44 Index index; 44 Index index;
45 SearchEngineImpl searchEngine; 45 SearchEngineImpl searchEngine;
46 Source source; 46 Source source;
47 CompletionCache cache;
47 CompletionPerformance perf; 48 CompletionPerformance perf;
48 DartCompletionManager manager; 49 DartCompletionManager manager;
49 MockCompletionComputer computer1; 50 MockCompletionComputer computer1;
50 MockCompletionComputer computer2; 51 MockCompletionComputer computer2;
51 CompletionSuggestion suggestion1; 52 CompletionSuggestion suggestion1;
52 CompletionSuggestion suggestion2; 53 CompletionSuggestion suggestion2;
53 54
54 void resolveLibrary() { 55 void resolveLibrary() {
55 context.resolveCompilationUnit( 56 context.resolveCompilationUnit(
56 source, 57 source,
57 context.computeLibraryElement(source)); 58 context.computeLibraryElement(source));
58 } 59 }
59 60
60 @override 61 @override
61 void setUp() { 62 void setUp() {
62 super.setUp(); 63 super.setUp();
63 index = createLocalMemoryIndex(); 64 index = createLocalMemoryIndex();
64 searchEngine = new SearchEngineImpl(index); 65 searchEngine = new SearchEngineImpl(index);
65 source = addSource('/does/not/exist.dart', ''); 66 source = addSource('/does/not/exist.dart', '');
67 cache = null;
66 perf = new CompletionPerformance(); 68 perf = new CompletionPerformance();
67 manager = new DartCompletionManager(context, searchEngine, source, 0, perf); 69 manager = new DartCompletionManager.create(
70 context,
71 searchEngine,
72 source,
73 0,
74 cache,
75 perf);
68 suggestion1 = new CompletionSuggestion( 76 suggestion1 = new CompletionSuggestion(
69 CompletionSuggestionKind.INVOCATION, 77 CompletionSuggestionKind.INVOCATION,
70 CompletionRelevance.DEFAULT, 78 CompletionRelevance.DEFAULT,
71 "suggestion1", 79 "suggestion1",
72 1, 80 1,
73 1, 81 1,
74 false, 82 false,
75 false); 83 false);
76 suggestion2 = new CompletionSuggestion( 84 suggestion2 = new CompletionSuggestion(
77 CompletionSuggestionKind.IDENTIFIER, 85 CompletionSuggestionKind.IDENTIFIER,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 @override 193 @override
186 Future<bool> computeFull(DartCompletionRequest request) { 194 Future<bool> computeFull(DartCompletionRequest request) {
187 this.request = request; 195 this.request = request;
188 fullCount++; 196 fullCount++;
189 if (fullSuggestion != null) { 197 if (fullSuggestion != null) {
190 request.suggestions.add(fullSuggestion); 198 request.suggestions.add(fullSuggestion);
191 } 199 }
192 return new Future.value(fullSuggestion != null); 200 return new Future.value(fullSuggestion != null);
193 } 201 }
194 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698