| 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/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:analysis_testing/reflective_tests.dart'; | 10 import 'package:analysis_testing/reflective_tests.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 Future findElementReferences(String search, bool includePotential) { | 26 Future findElementReferences(String search, bool includePotential) { |
| 27 int offset = findOffset(search); | 27 int offset = findOffset(search); |
| 28 return waitForTasksFinished().then((_) { | 28 return waitForTasksFinished().then((_) { |
| 29 Request request = new SearchFindElementReferencesParams(testFile, offset, | 29 Request request = new SearchFindElementReferencesParams(testFile, offset, |
| 30 includePotential).toRequest('0'); | 30 includePotential).toRequest('0'); |
| 31 Response response = handleSuccessfulRequest(request); | 31 Response response = handleSuccessfulRequest(request); |
| 32 var result = new SearchFindElementReferencesResult.fromResponse(response); | 32 var result = new SearchFindElementReferencesResult.fromResponse(response); |
| 33 searchId = result.id; | 33 searchId = result.id; |
| 34 searchElement = result.element; | 34 searchElement = result.element; |
| 35 results.clear(); | 35 results.clear(); |
| 36 return waitForSearchResults(); | 36 if (searchId == null) { |
| 37 return null; |
| 38 } else { |
| 39 return waitForSearchResults(); |
| 40 } |
| 37 }); | 41 }); |
| 38 } | 42 } |
| 39 | 43 |
| 40 test_constructor_named() { | 44 test_constructor_named() { |
| 41 addTestFile(''' | 45 addTestFile(''' |
| 42 class A { | 46 class A { |
| 43 A.named(p); | 47 A.named(p); |
| 44 } | 48 } |
| 45 main() { | 49 main() { |
| 46 new A.named(1); | 50 new A.named(1); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 } | 577 } |
| 574 '''); | 578 '''); |
| 575 return findElementReferences('T> {', false).then((_) { | 579 return findElementReferences('T> {', false).then((_) { |
| 576 expect(searchElement.kind, ElementKind.TYPE_PARAMETER); | 580 expect(searchElement.kind, ElementKind.TYPE_PARAMETER); |
| 577 expect(results, hasLength(2)); | 581 expect(results, hasLength(2)); |
| 578 assertHasResult(SearchResultKind.REFERENCE, 'T f;'); | 582 assertHasResult(SearchResultKind.REFERENCE, 'T f;'); |
| 579 assertHasResult(SearchResultKind.REFERENCE, 'T m()'); | 583 assertHasResult(SearchResultKind.REFERENCE, 'T m()'); |
| 580 }); | 584 }); |
| 581 } | 585 } |
| 582 } | 586 } |
| OLD | NEW |