| 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/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 resultSet.results.addAll(params.results); | 90 resultSet.results.addAll(params.results); |
| 91 resultSet.done = params.isLast; | 91 resultSet.done = params.isLast; |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 @override | 95 @override |
| 96 void setUp() { | 96 void setUp() { |
| 97 super.setUp(); | 97 super.setUp(); |
| 98 createProject(); | 98 createProject(); |
| 99 server.handlers = [new SearchDomainHandler(server),]; | 99 server.handlers = [ |
| 100 new SearchDomainHandler(server), |
| 101 ]; |
| 100 } | 102 } |
| 101 | 103 |
| 102 Future waitForSearchResults() { | 104 Future waitForSearchResults() { |
| 103 _ResultSet resultSet = resultSets[searchId]; | 105 _ResultSet resultSet = resultSets[searchId]; |
| 104 if (resultSet != null && resultSet.done) { | 106 if (resultSet != null && resultSet.done) { |
| 105 results = resultSet.results; | 107 results = resultSet.results; |
| 106 return new Future.value(); | 108 return new Future.value(); |
| 107 } | 109 } |
| 108 return new Future.delayed(Duration.ZERO, waitForSearchResults); | 110 return new Future.delayed(Duration.ZERO, waitForSearchResults); |
| 109 } | 111 } |
| 110 } | 112 } |
| 111 | 113 |
| 112 class _ResultSet { | 114 class _ResultSet { |
| 113 final String id; | 115 final String id; |
| 114 final List<SearchResult> results = <SearchResult>[]; | 116 final List<SearchResult> results = <SearchResult>[]; |
| 115 bool done = false; | 117 bool done = false; |
| 116 | 118 |
| 117 _ResultSet(this.id); | 119 _ResultSet(this.id); |
| 118 } | 120 } |
| OLD | NEW |