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

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

Issue 684183002: Refactor CompletionSuggestionKind (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' ;
11 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
11 import 'package:analysis_server/src/services/index/index.dart'; 12 import 'package:analysis_server/src/services/index/index.dart';
12 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 13 import 'package:analysis_server/src/services/index/local_memory_index.dart';
13 import 'package:analysis_server/src/services/search/search_engine.dart'; 14 import 'package:analysis_server/src/services/search/search_engine.dart';
14 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
15 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ; 15 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ;
16 import '../../abstract_single_unit.dart';
17 import '../../reflective_tests.dart';
18 import 'package:analyzer/src/generated/engine.dart'; 16 import 'package:analyzer/src/generated/engine.dart';
19 import 'package:analyzer/src/generated/source.dart'; 17 import 'package:analyzer/src/generated/source.dart';
20 import 'package:unittest/unittest.dart'; 18 import 'package:unittest/unittest.dart';
21 19
20 import '../../abstract_single_unit.dart';
21 import '../../reflective_tests.dart';
22
22 main() { 23 main() {
23 groupSep = ' | '; 24 groupSep = ' | ';
24 runReflectiveTests(DartCompletionManagerTest); 25 runReflectiveTests(DartCompletionManagerTest);
25 } 26 }
26 27
27 /** 28 /**
28 * Returns a [Future] that completes after pumping the event queue [times] 29 * Returns a [Future] that completes after pumping the event queue [times]
29 * times. By default, this should pump the event queue enough times to allow 30 * times. By default, this should pump the event queue enough times to allow
30 * any code to run, as long as it's not waiting on some external event. 31 * any code to run, as long as it's not waiting on some external event.
31 */ 32 */
(...skipping 24 matching lines...) Expand all
56 } 57 }
57 58
58 @override 59 @override
59 void setUp() { 60 void setUp() {
60 super.setUp(); 61 super.setUp();
61 index = createLocalMemoryIndex(); 62 index = createLocalMemoryIndex();
62 searchEngine = new SearchEngineImpl(index); 63 searchEngine = new SearchEngineImpl(index);
63 source = addSource('/does/not/exist.dart', ''); 64 source = addSource('/does/not/exist.dart', '');
64 manager = new DartCompletionManager(context, searchEngine, source, 0); 65 manager = new DartCompletionManager(context, searchEngine, source, 0);
65 suggestion1 = new CompletionSuggestion( 66 suggestion1 = new CompletionSuggestion(
66 CompletionSuggestionKind.CLASS, 67 CompletionSuggestionKind.INVOCATION,
67 CompletionRelevance.DEFAULT, 68 CompletionRelevance.DEFAULT,
68 "suggestion1", 69 "suggestion1",
69 1, 70 1,
70 1, 71 1,
71 false, 72 false,
72 false); 73 false);
73 suggestion2 = new CompletionSuggestion( 74 suggestion2 = new CompletionSuggestion(
74 CompletionSuggestionKind.CLASS, 75 CompletionSuggestionKind.IDENTIFIER,
75 CompletionRelevance.DEFAULT, 76 CompletionRelevance.DEFAULT,
76 "suggestion2", 77 "suggestion2",
77 2, 78 2,
78 2, 79 2,
79 false, 80 false,
80 false); 81 false);
81 } 82 }
82 83
83 test_compute_fastAndFull() { 84 test_compute_fastAndFull() {
84 computer1 = new MockCompletionComputer(suggestion1, null); 85 computer1 = new MockCompletionComputer(suggestion1, null);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 @override 183 @override
183 Future<bool> computeFull(DartCompletionRequest request) { 184 Future<bool> computeFull(DartCompletionRequest request) {
184 this.request = request; 185 this.request = request;
185 fullCount++; 186 fullCount++;
186 if (fullSuggestion != null) { 187 if (fullSuggestion != null) {
187 request.suggestions.add(fullSuggestion); 188 request.suggestions.add(fullSuggestion);
188 } 189 }
189 return new Future.value(fullSuggestion != null); 190 return new Future.value(fullSuggestion != null);
190 } 191 }
191 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698