| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart' | 8 import 'package:analysis_server/protocol/protocol_generated.dart' |
| 9 hide AnalysisOptions; | 9 hide AnalysisOptions; |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 length++; | 46 length++; |
| 47 } | 47 } |
| 48 return length; | 48 return length; |
| 49 } | 49 } |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * An abstract base for all 'analysis' domain tests. | 52 * An abstract base for all 'analysis' domain tests. |
| 53 */ | 53 */ |
| 54 class AbstractAnalysisTest { | 54 class AbstractAnalysisTest { |
| 55 bool enableNewAnalysisDriver = false; | |
| 56 bool generateSummaryFiles = false; | 55 bool generateSummaryFiles = false; |
| 57 MockServerChannel serverChannel; | 56 MockServerChannel serverChannel; |
| 58 MemoryResourceProvider resourceProvider; | 57 MemoryResourceProvider resourceProvider; |
| 59 MockPackageMapProvider packageMapProvider; | 58 MockPackageMapProvider packageMapProvider; |
| 60 TestPluginManager pluginManager; | 59 TestPluginManager pluginManager; |
| 61 AnalysisServer server; | 60 AnalysisServer server; |
| 62 RequestHandler handler; | 61 RequestHandler handler; |
| 63 | 62 |
| 64 final List<ServerErrorParams> serverErrors = <ServerErrorParams>[]; | 63 final List<ServerErrorParams> serverErrors = <ServerErrorParams>[]; |
| 65 final List<GeneralAnalysisService> generalServices = | 64 final List<GeneralAnalysisService> generalServices = |
| 66 <GeneralAnalysisService>[]; | 65 <GeneralAnalysisService>[]; |
| 67 final Map<AnalysisService, List<String>> analysisSubscriptions = {}; | 66 final Map<AnalysisService, List<String>> analysisSubscriptions = {}; |
| 68 | 67 |
| 69 String projectPath; | 68 String projectPath; |
| 70 String testFolder; | 69 String testFolder; |
| 71 String testFile; | 70 String testFile; |
| 72 String testCode; | 71 String testCode; |
| 73 | 72 |
| 74 AbstractAnalysisTest(); | 73 AbstractAnalysisTest(); |
| 75 | 74 |
| 76 AnalysisDomainHandler get analysisHandler => server.handlers | 75 AnalysisDomainHandler get analysisHandler => server.handlers |
| 77 .singleWhere((handler) => handler is AnalysisDomainHandler); | 76 .singleWhere((handler) => handler is AnalysisDomainHandler); |
| 78 | 77 |
| 79 AnalysisOptions get analysisOptions => enableNewAnalysisDriver | 78 AnalysisOptions get analysisOptions => enableNewAnalysisDriver |
| 80 ? testDiver.analysisOptions | 79 ? testDiver.analysisOptions |
| 81 : testContext.analysisOptions; | 80 : testContext.analysisOptions; |
| 82 | 81 |
| 82 bool get enableNewAnalysisDriver => true; |
| 83 |
| 83 AnalysisContext get testContext => server.getAnalysisContext(testFile); | 84 AnalysisContext get testContext => server.getAnalysisContext(testFile); |
| 84 | 85 |
| 85 AnalysisDriver get testDiver => server.getAnalysisDriver(testFile); | 86 AnalysisDriver get testDiver => server.getAnalysisDriver(testFile); |
| 86 | 87 |
| 87 void addAnalysisSubscription(AnalysisService service, String file) { | 88 void addAnalysisSubscription(AnalysisService service, String file) { |
| 88 // add file to subscription | 89 // add file to subscription |
| 89 var files = analysisSubscriptions[service]; | 90 var files = analysisSubscriptions[service]; |
| 90 if (files == null) { | 91 if (files == null) { |
| 91 files = <String>[]; | 92 files = <String>[]; |
| 92 analysisSubscriptions[service] = files; | 93 analysisSubscriptions[service] = files; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 plugin.AnalysisUpdateContentParams params) { | 353 plugin.AnalysisUpdateContentParams params) { |
| 353 analysisUpdateContentParams = params; | 354 analysisUpdateContentParams = params; |
| 354 } | 355 } |
| 355 | 356 |
| 356 @override | 357 @override |
| 357 Future<List<Null>> stopAll() async { | 358 Future<List<Null>> stopAll() async { |
| 358 fail('Unexpected invocation of stopAll'); | 359 fail('Unexpected invocation of stopAll'); |
| 359 return null; | 360 return null; |
| 360 } | 361 } |
| 361 } | 362 } |
| OLD | NEW |