| 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.abstract_search_domain; | 5 library test.search.abstract_search_domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/computer/element.dart'; | 9 import 'package:analysis_server/src/computer/element.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 results.join('\n')); | 66 results.join('\n')); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 String getPathString(List<Element> path) { | 70 String getPathString(List<Element> path) { |
| 71 return path.map((Element element) { | 71 return path.map((Element element) { |
| 72 return '${element.kind} ${element.name}'; | 72 return '${element.kind} ${element.name}'; |
| 73 }).join('\n'); | 73 }).join('\n'); |
| 74 } | 74 } |
| 75 | 75 |
| 76 @override |
| 76 void processNotification(Notification notification) { | 77 void processNotification(Notification notification) { |
| 77 if (notification.event == SEARCH_RESULTS) { | 78 if (notification.event == SEARCH_RESULTS) { |
| 78 String id = notification.getParameter(ID); | 79 String id = notification.getParameter(ID); |
| 79 if (id == searchId) { | 80 if (id == searchId) { |
| 80 for (Map<String, Object> json in notification.getParameter(RESULTS)) { | 81 for (Map<String, Object> json in notification.getParameter(RESULTS)) { |
| 81 results.add(new SearchResult.fromJson(json)); | 82 results.add(new SearchResult.fromJson(json)); |
| 82 } | 83 } |
| 83 searchDone = notification.getParameter(LAST); | 84 searchDone = notification.getParameter(LAST); |
| 84 } | 85 } |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| 88 @override | 89 @override |
| 89 void setUp() { | 90 void setUp() { |
| 90 super.setUp(); | 91 super.setUp(); |
| 91 createProject(); | 92 createProject(); |
| 92 handler = new SearchDomainHandler(server); | 93 handler = new SearchDomainHandler(server); |
| 93 } | 94 } |
| 94 | 95 |
| 95 Future waitForSearchResults() { | 96 Future waitForSearchResults() { |
| 96 if (searchDone) { | 97 if (searchDone) { |
| 97 return new Future.value(); | 98 return new Future.value(); |
| 98 } | 99 } |
| 99 return new Future.delayed(Duration.ZERO, waitForSearchResults); | 100 return new Future.delayed(Duration.ZERO, waitForSearchResults); |
| 100 } | 101 } |
| 101 } | 102 } |
| OLD | NEW |