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

Side by Side Diff: pkg/analysis_server/test/analysis_abstract.dart

Issue 892913004: Fix type hierarchy when there is no element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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.domain.analysis.abstract; 5 library test.domain.analysis.abstract;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/domain_analysis.dart'; 10 import 'package:analysis_server/src/domain_analysis.dart';
11 import 'package:analysis_server/src/protocol.dart'; 11 import 'package:analysis_server/src/protocol.dart';
12 import 'package:analysis_server/src/services/index/index.dart'; 12 import 'package:analysis_server/src/services/index/index.dart';
13 import 'package:analyzer/file_system/file_system.dart'; 13 import 'package:analyzer/file_system/file_system.dart';
14 import 'package:analyzer/file_system/memory_file_system.dart'; 14 import 'package:analyzer/file_system/memory_file_system.dart';
15 import 'package:analyzer/instrumentation/instrumentation.dart'; 15 import 'package:analyzer/instrumentation/instrumentation.dart';
16 import 'package:unittest/unittest.dart'; 16 import 'package:unittest/unittest.dart';
17 17
18 import 'mock_sdk.dart'; 18 import 'mock_sdk.dart';
19 import 'mocks.dart'; 19 import 'mocks.dart';
20 import 'package:analysis_server/src/constants.dart';
20 21
21 22
22 int findIdentifierLength(String search) { 23 int findIdentifierLength(String search) {
23 int length = 0; 24 int length = 0;
24 while (length < search.length) { 25 while (length < search.length) {
25 int c = search.codeUnitAt(length); 26 int c = search.codeUnitAt(length);
26 if (!(c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0) || 27 if (!(c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0) ||
27 c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0) || 28 c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0) ||
28 c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0))) { 29 c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0))) {
29 break; 30 break;
30 } 31 }
31 length++; 32 length++;
32 } 33 }
33 return length; 34 return length;
34 } 35 }
35 36
36 37
37 /** 38 /**
38 * An abstract base for all 'analysis' domain tests. 39 * An abstract base for all 'analysis' domain tests.
39 */ 40 */
40 class AbstractAnalysisTest { 41 class AbstractAnalysisTest {
41 MockServerChannel serverChannel; 42 MockServerChannel serverChannel;
42 MemoryResourceProvider resourceProvider; 43 MemoryResourceProvider resourceProvider;
43 MockPackageMapProvider packageMapProvider; 44 MockPackageMapProvider packageMapProvider;
44 AnalysisServer server; 45 AnalysisServer server;
45 RequestHandler handler; 46 RequestHandler handler;
46 47
47 Map<AnalysisService, List<String>> analysisSubscriptions = {}; 48 final List<ServerErrorParams> serverErrors = <ServerErrorParams>[];
49 final Map<AnalysisService, List<String>> analysisSubscriptions = {};
48 50
49 String projectPath = '/project'; 51 String projectPath = '/project';
50 String testFolder = '/project/bin/'; 52 String testFolder = '/project/bin/';
51 String testFile = '/project/bin/test.dart'; 53 String testFile = '/project/bin/test.dart';
52 String testCode; 54 String testCode;
53 55
54 AbstractAnalysisTest(); 56 AbstractAnalysisTest();
55 57
56 void addAnalysisSubscription(AnalysisService service, String file) { 58 void addAnalysisSubscription(AnalysisService service, String file) {
57 // add file to subscription 59 // add file to subscription
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return response; 136 return response;
135 } 137 }
136 138
137 String modifyTestFile(String content) { 139 String modifyTestFile(String content) {
138 addFile(testFile, content); 140 addFile(testFile, content);
139 this.testCode = content; 141 this.testCode = content;
140 return testFile; 142 return testFile;
141 } 143 }
142 144
143 void processNotification(Notification notification) { 145 void processNotification(Notification notification) {
146 if (notification.event == SERVER_ERROR) {
147 var params = new ServerErrorParams.fromNotification(notification);
148 serverErrors.add(params);
149 }
144 } 150 }
145 151
146 void setUp() { 152 void setUp() {
147 serverChannel = new MockServerChannel(); 153 serverChannel = new MockServerChannel();
148 resourceProvider = new MemoryResourceProvider(); 154 resourceProvider = new MemoryResourceProvider();
149 packageMapProvider = new MockPackageMapProvider(); 155 packageMapProvider = new MockPackageMapProvider();
150 Index index = createIndex(); 156 Index index = createIndex();
151 server = createAnalysisServer(index); 157 server = createAnalysisServer(index);
152 handler = new AnalysisDomainHandler(server); 158 handler = new AnalysisDomainHandler(server);
153 // listen for notifications 159 // listen for notifications
(...skipping 20 matching lines...) Expand all
174 } 180 }
175 181
176 /** 182 /**
177 * Completes with a successful [Response] for the given [request]. 183 * Completes with a successful [Response] for the given [request].
178 * Otherwise fails. 184 * Otherwise fails.
179 */ 185 */
180 Future<Response> waitResponse(Request request) async { 186 Future<Response> waitResponse(Request request) async {
181 return serverChannel.sendRequest(request); 187 return serverChannel.sendRequest(request);
182 } 188 }
183 } 189 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/search/search_domain.dart ('k') | pkg/analysis_server/test/search/type_hierarchy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698