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.search.element_references; | 5 library test.search.element_references; |
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/services/index/index.dart'; | 10 import 'package:analysis_server/src/services/index/index.dart'; |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 @reflectiveTest | 23 @reflectiveTest |
24 class ElementReferencesTest extends AbstractSearchDomainTest { | 24 class ElementReferencesTest extends AbstractSearchDomainTest { |
25 Element searchElement; | 25 Element searchElement; |
26 | 26 |
27 void assertHasRef(SearchResultKind kind, String search, bool isPotential) { | 27 void assertHasRef(SearchResultKind kind, String search, bool isPotential) { |
28 assertHasResult(kind, search); | 28 assertHasResult(kind, search); |
29 expect(result.isPotential, isPotential); | 29 expect(result.isPotential, isPotential); |
30 } | 30 } |
31 | 31 |
32 Future<Null> findElementReferences(String search, bool includePotential) async
{ | 32 Future<Null> findElementReferences( |
| 33 String search, bool includePotential) async { |
33 int offset = findOffset(search); | 34 int offset = findOffset(search); |
34 await waitForTasksFinished(); | 35 await waitForTasksFinished(); |
35 Request request = new SearchFindElementReferencesParams( | 36 Request request = new SearchFindElementReferencesParams( |
36 testFile, offset, includePotential) | 37 testFile, offset, includePotential) |
37 .toRequest('0'); | 38 .toRequest('0'); |
38 Response response = await waitResponse(request); | 39 Response response = await waitResponse(request); |
39 var result = new SearchFindElementReferencesResult.fromResponse(response); | 40 var result = new SearchFindElementReferencesResult.fromResponse(response); |
40 searchId = result.id; | 41 searchId = result.id; |
41 searchElement = result.element; | 42 searchElement = result.element; |
42 if (searchId != null) { | 43 if (searchId != null) { |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 print(vvv); | 688 print(vvv); |
688 } | 689 } |
689 '''); | 690 '''); |
690 Request request = new SearchFindElementReferencesParams(testFile, 0, false) | 691 Request request = new SearchFindElementReferencesParams(testFile, 0, false) |
691 .toRequest('0'); | 692 .toRequest('0'); |
692 Response response = await waitResponse(request); | 693 Response response = await waitResponse(request); |
693 expect(response.error, isNotNull); | 694 expect(response.error, isNotNull); |
694 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 695 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
695 } | 696 } |
696 } | 697 } |
OLD | NEW |