| 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.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'; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 serverChannel = new MockServerChannel(); | 44 serverChannel = new MockServerChannel(); |
| 45 resourceProvider = new MemoryResourceProvider(); | 45 resourceProvider = new MemoryResourceProvider(); |
| 46 server = new AnalysisServer(serverChannel, resourceProvider); | 46 server = new AnalysisServer(serverChannel, resourceProvider); |
| 47 server.defaultSdk = new MockSdk(); | 47 server.defaultSdk = new MockSdk(); |
| 48 handler = new AnalysisDomainHandler(server); | 48 handler = new AnalysisDomainHandler(server); |
| 49 // listen for notifications | 49 // listen for notifications |
| 50 Stream<Notification> notificationStream = serverChannel.notificationControll
er.stream; | 50 Stream<Notification> notificationStream = serverChannel.notificationControll
er.stream; |
| 51 notificationStream.listen((Notification notification) { | 51 notificationStream.listen((Notification notification) { |
| 52 processNotification(notification); | 52 processNotification(notification); |
| 53 }); | 53 }); |
| 54 // create an empty project | |
| 55 _createEmptyProject(); | |
| 56 } | 54 } |
| 57 | 55 |
| 58 void addAnalysisSubscription(AnalysisService service, String file) { | 56 void addAnalysisSubscription(AnalysisService service, String file) { |
| 59 // add file to subscription | 57 // add file to subscription |
| 60 var files = analysisSubscriptions[service.name]; | 58 var files = analysisSubscriptions[service.name]; |
| 61 if (files == null) { | 59 if (files == null) { |
| 62 files = <String>[]; | 60 files = <String>[]; |
| 63 analysisSubscriptions[service.name] = files; | 61 analysisSubscriptions[service.name] = files; |
| 64 } | 62 } |
| 65 files.add(file); | 63 files.add(file); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // | 175 // |
| 178 // /** | 176 // /** |
| 179 // * Returns navigation information recorded for the given [testFile]. | 177 // * Returns navigation information recorded for the given [testFile]. |
| 180 // * May be empty, but not `null`. | 178 // * May be empty, but not `null`. |
| 181 // */ | 179 // */ |
| 182 // List<Map<String, Object>> getTestNavigation() { | 180 // List<Map<String, Object>> getTestNavigation() { |
| 183 // return getNavigation(testFile); | 181 // return getNavigation(testFile); |
| 184 // } | 182 // } |
| 185 | 183 |
| 186 /** | 184 /** |
| 187 * Creates an empty project `/project/`. | 185 * Creates a project `/project`. |
| 188 */ | 186 */ |
| 189 void _createEmptyProject() { | 187 void createProject() { |
| 190 resourceProvider.newFolder(projectPath); | 188 resourceProvider.newFolder(projectPath); |
| 191 Request request = new Request('0', ANALYSIS_SET_ANALYSIS_ROOTS); | 189 Request request = new Request('0', ANALYSIS_SET_ANALYSIS_ROOTS); |
| 192 request.setParameter(INCLUDED, [projectPath]); | 190 request.setParameter(INCLUDED, [projectPath]); |
| 193 request.setParameter(EXCLUDED, []); | 191 request.setParameter(EXCLUDED, []); |
| 194 handleSuccessfulRequest(request); | 192 handleSuccessfulRequest(request); |
| 195 } | 193 } |
| 196 | 194 |
| 197 // /** | 195 // /** |
| 198 // * Creates a project with a single Dart file `/project/bin/test.dart` with | 196 // * Creates a project with a single Dart file `/project/bin/test.dart` with |
| 199 // * the given [code]. | 197 // * the given [code]. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 int c = search.codeUnitAt(length); | 270 int c = search.codeUnitAt(length); |
| 273 if (!(c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0) || | 271 if (!(c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0) || |
| 274 c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0) || | 272 c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0) || |
| 275 c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0))) { | 273 c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0))) { |
| 276 break; | 274 break; |
| 277 } | 275 } |
| 278 length++; | 276 length++; |
| 279 } | 277 } |
| 280 return length; | 278 return length; |
| 281 } | 279 } |
| OLD | NEW |