| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 } | 595 } |
| 596 | 596 |
| 597 @override | 597 @override |
| 598 Stream<SourcesChangedEvent> get onSourcesChanged => mockStream; | 598 Stream<SourcesChangedEvent> get onSourcesChanged => mockStream; |
| 599 | 599 |
| 600 @override | 600 @override |
| 601 TimestampedData<String> getContents(Source source) { | 601 TimestampedData<String> getContents(Source source) { |
| 602 return source.contents; | 602 return source.contents; |
| 603 } | 603 } |
| 604 | 604 |
| 605 @override |
| 606 bool exists(Source source) { |
| 607 return source != null && source.exists(); |
| 608 } |
| 609 |
| 605 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 610 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 606 } | 611 } |
| 607 | 612 |
| 608 /** | 613 /** |
| 609 * Mock stream for tracking calls to listen and subscription.cancel. | 614 * Mock stream for tracking calls to listen and subscription.cancel. |
| 610 */ | 615 */ |
| 611 class MockStream<E> implements Stream<E> { | 616 class MockStream<E> implements Stream<E> { |
| 612 MockSubscription<E> mockSubscription = new MockSubscription<E>(); | 617 MockSubscription<E> mockSubscription = new MockSubscription<E>(); |
| 613 int listenCount = 0; | 618 int listenCount = 0; |
| 614 | 619 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 } | 709 } |
| 705 '''); | 710 '''); |
| 706 await waitForTasksFinished(); | 711 await waitForTasksFinished(); |
| 707 Request request = | 712 Request request = |
| 708 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); | 713 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); |
| 709 Response response = handler.handleRequest(request); | 714 Response response = handler.handleRequest(request); |
| 710 expect(response.error, isNotNull); | 715 expect(response.error, isNotNull); |
| 711 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 716 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
| 712 } | 717 } |
| 713 } | 718 } |
| OLD | NEW |