| 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.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 21 matching lines...) Expand all Loading... |
| 32 */ | 32 */ |
| 33 Future pumpEventQueue([int times = 20]) { | 33 Future pumpEventQueue([int times = 20]) { |
| 34 if (times == 0) return new Future.value(); | 34 if (times == 0) return new Future.value(); |
| 35 // We use a delayed future to allow microtask events to finish. The | 35 // We use a delayed future to allow microtask events to finish. The |
| 36 // Future.value or Future() constructors use scheduleMicrotask themselves and | 36 // Future.value or Future() constructors use scheduleMicrotask themselves and |
| 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 @reflectiveTest |
| 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 CompletionPerformance perf; |
| 48 DartCompletionManager manager; | 48 DartCompletionManager manager; |
| 49 MockCompletionComputer computer1; | 49 MockCompletionComputer computer1; |
| 50 MockCompletionComputer computer2; | 50 MockCompletionComputer computer2; |
| 51 CompletionSuggestion suggestion1; | 51 CompletionSuggestion suggestion1; |
| 52 CompletionSuggestion suggestion2; | 52 CompletionSuggestion suggestion2; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 @override | 202 @override |
| 203 Future<bool> computeFull(DartCompletionRequest request) { | 203 Future<bool> computeFull(DartCompletionRequest request) { |
| 204 this.request = request; | 204 this.request = request; |
| 205 fullCount++; | 205 fullCount++; |
| 206 if (fullSuggestion != null) { | 206 if (fullSuggestion != null) { |
| 207 request.suggestions.add(fullSuggestion); | 207 request.suggestions.add(fullSuggestion); |
| 208 } | 208 } |
| 209 return new Future.value(fullSuggestion != null); | 209 return new Future.value(fullSuggestion != null); |
| 210 } | 210 } |
| 211 } | 211 } |
| OLD | NEW |