| 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.domain.completion; | 5 library test.domain.completion; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/channel/channel.dart'; | 10 import 'package:analysis_server/src/channel/channel.dart'; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 428 } |
| 429 | 429 |
| 430 class MockCache extends CompletionCache { | 430 class MockCache extends CompletionCache { |
| 431 MockCache(AnalysisContext context, Source source) : super(context, source); | 431 MockCache(AnalysisContext context, Source source) : super(context, source); |
| 432 } | 432 } |
| 433 | 433 |
| 434 class MockCompletionManager implements CompletionManager { | 434 class MockCompletionManager implements CompletionManager { |
| 435 final AnalysisContext context; | 435 final AnalysisContext context; |
| 436 final Source source; | 436 final Source source; |
| 437 final SearchEngine searchEngine; | 437 final SearchEngine searchEngine; |
| 438 CompletionCache cache; | |
| 439 StreamController<CompletionResult> controller; | 438 StreamController<CompletionResult> controller; |
| 440 int computeCallCount = 0; | 439 int computeCallCount = 0; |
| 441 | 440 |
| 442 MockCompletionManager(this.context, this.source, this.searchEngine, | 441 MockCompletionManager(this.context, this.source, this.searchEngine); |
| 443 this.cache); | |
| 444 | 442 |
| 445 @override | 443 @override |
| 446 void computeCache() { | 444 void computeCache() { |
| 447 // ignored | 445 // ignored |
| 448 } | 446 } |
| 449 | 447 |
| 450 @override | 448 @override |
| 451 void computeSuggestions(CompletionRequest request) { | 449 void computeSuggestions(CompletionRequest request) { |
| 452 ++computeCallCount; | 450 ++computeCallCount; |
| 453 CompletionResult result = new CompletionResult(0, 0, [], true); | 451 CompletionResult result = new CompletionResult(0, 0, [], true); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 added: event.added.length > 0 ? [mockContext] : [], | 549 added: event.added.length > 0 ? [mockContext] : [], |
| 552 changed: event.changed.length > 0 ? [mockContext] : [], | 550 changed: event.changed.length > 0 ? [mockContext] : [], |
| 553 removed: event.removed.length > 0 ? [mockContext] : [])); | 551 removed: event.removed.length > 0 ? [mockContext] : [])); |
| 554 } | 552 } |
| 555 | 553 |
| 556 void contextsChangedRaw(ContextsChangedEvent newEvent) { | 554 void contextsChangedRaw(ContextsChangedEvent newEvent) { |
| 557 super.contextsChanged(newEvent); | 555 super.contextsChanged(newEvent); |
| 558 } | 556 } |
| 559 | 557 |
| 560 CompletionManager createCompletionManager(AnalysisContext context, | 558 CompletionManager createCompletionManager(AnalysisContext context, |
| 561 Source source, SearchEngine searchEngine, CompletionCache cache) { | 559 Source source, SearchEngine searchEngine) { |
| 562 return new MockCompletionManager(mockContext, source, searchEngine, cache); | 560 return new MockCompletionManager(mockContext, source, searchEngine); |
| 563 } | 561 } |
| 564 } | 562 } |
| OLD | NEW |