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

Side by Side Diff: pkg/analysis_server/test/search/abstract_search_domain.dart

Issue 479683005: Make more use of generated code in analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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.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';
10 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
11 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
11 import 'package:analysis_server/src/protocol2.dart';
12 import 'package:analysis_server/src/search/search_domain.dart'; 12 import 'package:analysis_server/src/search/search_domain.dart';
13 import 'package:analysis_server/src/search/search_result.dart';
14 import 'package:analysis_server/src/services/index/index.dart' show Index; 13 import 'package:analysis_server/src/services/index/index.dart' show Index;
15 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 14 import 'package:analysis_server/src/services/index/local_memory_index.dart';
16 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
17 16
18 import '../analysis_abstract.dart'; 17 import '../analysis_abstract.dart';
19 18
20 19
21 class AbstractSearchDomainTest extends AbstractAnalysisTest { 20 class AbstractSearchDomainTest extends AbstractAnalysisTest {
22 String searchId; 21 String searchId;
23 bool searchDone = false; 22 bool searchDone = false;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 68
70 String getPathString(List<Element> path) { 69 String getPathString(List<Element> path) {
71 return path.map((Element element) { 70 return path.map((Element element) {
72 return '${element.kind.name} ${element.name}'; 71 return '${element.kind.name} ${element.name}';
73 }).join('\n'); 72 }).join('\n');
74 } 73 }
75 74
76 @override 75 @override
77 void processNotification(Notification notification) { 76 void processNotification(Notification notification) {
78 if (notification.event == SEARCH_RESULTS) { 77 if (notification.event == SEARCH_RESULTS) {
79 String id = notification.getParameter(ID); 78 var params = new SearchResultsParams.fromNotification(notification);
80 if (id == searchId) { 79 if (params.id == searchId) {
81 for (Map<String, Object> json in notification.getParameter(RESULTS)) { 80 results.addAll(params.results);
82 results.add(new SearchResult.fromJson(json)); 81 searchDone = params.last;
83 }
84 searchDone = notification.getParameter(LAST);
85 } 82 }
86 } 83 }
87 } 84 }
88 85
89 @override 86 @override
90 void setUp() { 87 void setUp() {
91 super.setUp(); 88 super.setUp();
92 createProject(); 89 createProject();
93 handler = new SearchDomainHandler(server); 90 handler = new SearchDomainHandler(server);
94 } 91 }
95 92
96 Future waitForSearchResults() { 93 Future waitForSearchResults() {
97 if (searchDone) { 94 if (searchDone) {
98 return new Future.value(); 95 return new Future.value();
99 } 96 }
100 return new Future.delayed(Duration.ZERO, waitForSearchResults); 97 return new Future.delayed(Duration.ZERO, waitForSearchResults);
101 } 98 }
102 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698