| OLD | NEW |
| 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.dart.util; | 5 library test.services.completion.dart.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // would therefore not wait for microtask callbacks that are scheduled after | 129 // would therefore not wait for microtask callbacks that are scheduled after |
| 130 // invoking this method. | 130 // invoking this method. |
| 131 return new Future.delayed( | 131 return new Future.delayed( |
| 132 Duration.ZERO, () => computeLibrariesContaining(times - 1)); | 132 Duration.ZERO, () => computeLibrariesContaining(times - 1)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 Future computeSuggestions([int times = 200]) async { | 135 Future computeSuggestions([int times = 200]) async { |
| 136 AnalysisServer server = new AnalysisServerMock( | 136 AnalysisServer server = new AnalysisServerMock( |
| 137 searchEngine: searchEngine, resourceProvider: provider); | 137 searchEngine: searchEngine, resourceProvider: provider); |
| 138 CompletionRequestImpl baseRequest = new CompletionRequestImpl( | 138 CompletionRequestImpl baseRequest = new CompletionRequestImpl( |
| 139 server, context, provider, testSource, completionOffset); | 139 server, context, testSource, completionOffset); |
| 140 request = new DartCompletionRequestImpl.forRequest(baseRequest); | 140 request = new DartCompletionRequestImpl.forRequest(baseRequest); |
| 141 Completer<List<CompletionSuggestion>> completer = | 141 Completer<List<CompletionSuggestion>> completer = |
| 142 new Completer<List<CompletionSuggestion>>(); | 142 new Completer<List<CompletionSuggestion>>(); |
| 143 | 143 |
| 144 // Request completions | 144 // Request completions |
| 145 contributor | 145 contributor |
| 146 .computeSuggestions(request) | 146 .computeSuggestions(request) |
| 147 .then((List<CompletionSuggestion> computedSuggestions) { | 147 .then((List<CompletionSuggestion> computedSuggestions) { |
| 148 completer.complete(computedSuggestions); | 148 completer.complete(computedSuggestions); |
| 149 }); | 149 }); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 | 214 |
| 215 @override | 215 @override |
| 216 void setUp() { | 216 void setUp() { |
| 217 super.setUp(); | 217 super.setUp(); |
| 218 index = createLocalMemoryIndex(); | 218 index = createLocalMemoryIndex(); |
| 219 searchEngine = new SearchEngineImpl(index); | 219 searchEngine = new SearchEngineImpl(index); |
| 220 contributor = createContributor(); | 220 contributor = createContributor(); |
| 221 } | 221 } |
| 222 } | 222 } |
| OLD | NEW |