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

Side by Side Diff: pkg/analysis_server/test/domain_completion_test.dart

Issue 1044463004: Gracefully degrade if no source for completion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 8 months 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.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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/integration/completion/get_suggestions_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698