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

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

Issue 691853006: display completion performance in new server status page (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 CompletionPerformance perf;
47 DartCompletionManager manager; 48 DartCompletionManager manager;
48 MockCompletionComputer computer1; 49 MockCompletionComputer computer1;
49 MockCompletionComputer computer2; 50 MockCompletionComputer computer2;
50 CompletionSuggestion suggestion1; 51 CompletionSuggestion suggestion1;
51 CompletionSuggestion suggestion2; 52 CompletionSuggestion suggestion2;
52 53
53 void resolveLibrary() { 54 void resolveLibrary() {
54 context.resolveCompilationUnit( 55 context.resolveCompilationUnit(
55 source, 56 source,
56 context.computeLibraryElement(source)); 57 context.computeLibraryElement(source));
57 } 58 }
58 59
59 @override 60 @override
60 void setUp() { 61 void setUp() {
61 super.setUp(); 62 super.setUp();
62 index = createLocalMemoryIndex(); 63 index = createLocalMemoryIndex();
63 searchEngine = new SearchEngineImpl(index); 64 searchEngine = new SearchEngineImpl(index);
64 source = addSource('/does/not/exist.dart', ''); 65 source = addSource('/does/not/exist.dart', '');
65 manager = new DartCompletionManager(context, searchEngine, source, 0); 66 perf = new CompletionPerformance();
67 manager = new DartCompletionManager(context, searchEngine, source, 0, perf);
66 suggestion1 = new CompletionSuggestion( 68 suggestion1 = new CompletionSuggestion(
67 CompletionSuggestionKind.INVOCATION, 69 CompletionSuggestionKind.INVOCATION,
68 CompletionRelevance.DEFAULT, 70 CompletionRelevance.DEFAULT,
69 "suggestion1", 71 "suggestion1",
70 1, 72 1,
71 1, 73 1,
72 false, 74 false,
73 false); 75 false);
74 suggestion2 = new CompletionSuggestion( 76 suggestion2 = new CompletionSuggestion(
75 CompletionSuggestionKind.IDENTIFIER, 77 CompletionSuggestionKind.IDENTIFIER,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 @override 185 @override
184 Future<bool> computeFull(DartCompletionRequest request) { 186 Future<bool> computeFull(DartCompletionRequest request) {
185 this.request = request; 187 this.request = request;
186 fullCount++; 188 fullCount++;
187 if (fullSuggestion != null) { 189 if (fullSuggestion != null) {
188 request.suggestions.add(fullSuggestion); 190 request.suggestions.add(fullSuggestion);
189 } 191 }
190 return new Future.value(fullSuggestion != null); 192 return new Future.value(fullSuggestion != null);
191 } 193 }
192 } 194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698