| 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/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 plugins.add(linterServerPlugin); | 118 plugins.add(linterServerPlugin); |
| 119 addServerPlugins(plugins); | 119 addServerPlugins(plugins); |
| 120 // | 120 // |
| 121 // Process plugins | 121 // Process plugins |
| 122 // | 122 // |
| 123 ExtensionManager manager = new ExtensionManager(); | 123 ExtensionManager manager = new ExtensionManager(); |
| 124 manager.processPlugins(plugins); | 124 manager.processPlugins(plugins); |
| 125 // | 125 // |
| 126 // Create server | 126 // Create server |
| 127 // | 127 // |
| 128 MockSdk sdk = new MockSdk(resourceProvider: resourceProvider); |
| 128 return new AnalysisServer( | 129 return new AnalysisServer( |
| 129 serverChannel, | 130 serverChannel, |
| 130 resourceProvider, | 131 resourceProvider, |
| 131 packageMapProvider, | 132 packageMapProvider, |
| 132 index, | 133 index, |
| 133 serverPlugin, | 134 serverPlugin, |
| 134 new AnalysisServerOptions(), | 135 new AnalysisServerOptions(), |
| 135 new DartSdkManager('', false, (_) => new MockSdk()), | 136 new DartSdkManager('/', false, (_) => sdk), |
| 136 InstrumentationService.NULL_SERVICE); | 137 InstrumentationService.NULL_SERVICE); |
| 137 } | 138 } |
| 138 | 139 |
| 139 Index createIndex() { | 140 Index createIndex() { |
| 140 return null; | 141 return null; |
| 141 } | 142 } |
| 142 | 143 |
| 143 /** | 144 /** |
| 144 * Creates a project `/project`. | 145 * Creates a project `/project`. |
| 145 */ | 146 */ |
| 146 void createProject() { | 147 void createProject({Map<String, String> packageRoots}) { |
| 147 resourceProvider.newFolder(projectPath); | 148 resourceProvider.newFolder(projectPath); |
| 148 Request request = | 149 Request request = |
| 149 new AnalysisSetAnalysisRootsParams([projectPath], []).toRequest('0'); | 150 new AnalysisSetAnalysisRootsParams([projectPath], [], packageRoots: pack
ageRoots).toRequest('0'); |
| 150 handleSuccessfulRequest(request, handler: analysisHandler); | 151 handleSuccessfulRequest(request, handler: analysisHandler); |
| 151 } | 152 } |
| 152 | 153 |
| 153 /** | 154 /** |
| 154 * Returns the offset of [search] in [testCode]. | 155 * Returns the offset of [search] in [testCode]. |
| 155 * Fails if not found. | 156 * Fails if not found. |
| 156 */ | 157 */ |
| 157 int findFileOffset(String path, String search) { | 158 int findFileOffset(String path, String search) { |
| 158 File file = resourceProvider.getResource(path) as File; | 159 File file = resourceProvider.getResource(path) as File; |
| 159 String code = file.createSource().contents.data; | 160 String code = file.createSource().contents.data; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 234 } |
| 234 | 235 |
| 235 /** | 236 /** |
| 236 * Completes with a successful [Response] for the given [request]. | 237 * Completes with a successful [Response] for the given [request]. |
| 237 * Otherwise fails. | 238 * Otherwise fails. |
| 238 */ | 239 */ |
| 239 Future<Response> waitResponse(Request request) async { | 240 Future<Response> waitResponse(Request request) async { |
| 240 return serverChannel.sendRequest(request); | 241 return serverChannel.sendRequest(request); |
| 241 } | 242 } |
| 242 } | 243 } |
| OLD | NEW |