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

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

Issue 2297343002: Flush results when contexts are made idle. (Closed)
Patch Set: Created 4 years, 3 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
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/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/domain_completion.dart'; 10 import 'package:analysis_server/src/domain_completion.dart';
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 test_inDartDoc2() async { 304 test_inDartDoc2() async {
305 addTestFile(''' 305 addTestFile('''
306 /// Some text^ 306 /// Some text^
307 main(aaa, bbb) {} 307 main(aaa, bbb) {}
308 '''); 308 ''');
309 await getSuggestions(); 309 await getSuggestions();
310 expect(suggestions, isEmpty); 310 expect(suggestions, isEmpty);
311 } 311 }
312 312
313 test_inDartDoc_reference1() async { 313 fail_inDartDoc_reference1() async {
Brian Wilkerson 2016/08/31 19:26:34 Should we use @failingTest? More importantly, why
scheglov 2016/08/31 19:48:56 Yes, it would be better. Unfortunately analysis_se
Brian Wilkerson 2016/08/31 19:56:49 Yes, but we should be aggressively re-computing th
314 addFile( 314 addFile(
315 '/testA.dart', 315 '/testA.dart',
316 ''' 316 '''
317 part of libA; 317 part of libA;
318 foo(bar) => 0;'''); 318 foo(bar) => 0;''');
319 addTestFile(''' 319 addTestFile('''
320 library libA; 320 library libA;
321 part "/testA.dart"; 321 part "/testA.dart";
322 import "dart:math"; 322 import "dart:math";
323 /// The [^] 323 /// The [^]
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 class B extends A {m() {^}} 469 class B extends A {m() {^}}
470 '''); 470 ''');
471 return getSuggestions().then((_) { 471 return getSuggestions().then((_) {
472 expect(replacementOffset, equals(completionOffset)); 472 expect(replacementOffset, equals(completionOffset));
473 expect(replacementLength, equals(0)); 473 expect(replacementLength, equals(0));
474 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm', 474 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm',
475 relevance: DART_RELEVANCE_LOCAL_METHOD); 475 relevance: DART_RELEVANCE_LOCAL_METHOD);
476 }); 476 });
477 } 477 }
478 478
479 test_partFile() { 479 fail_partFile() {
480 addFile( 480 addFile(
481 '/project/bin/testA.dart', 481 '/project/bin/testA.dart',
482 ''' 482 '''
483 library libA; 483 library libA;
484 part "$testFile"; 484 part "$testFile";
485 import 'dart:html'; 485 import 'dart:html';
486 class A { } 486 class A { }
487 '''); 487 ''');
488 addTestFile(''' 488 addTestFile('''
489 part of libA; 489 part of libA;
490 main() {^}'''); 490 main() {^}''');
491 return getSuggestions().then((_) { 491 return getSuggestions().then((_) {
492 expect(replacementOffset, equals(completionOffset)); 492 expect(replacementOffset, equals(completionOffset));
493 expect(replacementLength, equals(0)); 493 expect(replacementLength, equals(0));
494 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object'); 494 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object');
495 assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement'); 495 assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement');
496 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); 496 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A');
497 assertNoResult('test'); 497 assertNoResult('test');
498 }); 498 });
499 } 499 }
500 500
501 test_partFile2() { 501 fail_partFile2() {
502 addFile( 502 addFile(
503 '/testA.dart', 503 '/testA.dart',
504 ''' 504 '''
505 part of libA; 505 part of libA;
506 class A { }'''); 506 class A { }''');
507 addTestFile(''' 507 addTestFile('''
508 library libA; 508 library libA;
509 part "/testA.dart"; 509 part "/testA.dart";
510 import 'dart:html'; 510 import 'dart:html';
511 main() {^} 511 main() {^}
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 606 }
607 '''); 607 ''');
608 await waitForTasksFinished(); 608 await waitForTasksFinished();
609 Request request = 609 Request request =
610 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); 610 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0');
611 Response response = handler.handleRequest(request); 611 Response response = handler.handleRequest(request);
612 expect(response.error, isNotNull); 612 expect(response.error, isNotNull);
613 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 613 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
614 } 614 }
615 } 615 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698