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

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

Issue 2562083002: Get some tests running using the analysis driver (Closed)
Patch Set: Created 4 years 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
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/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart'
10 hide AnalysisOptions;
10 import 'package:analysis_server/src/analysis_server.dart'; 11 import 'package:analysis_server/src/analysis_server.dart';
11 import 'package:analysis_server/src/constants.dart'; 12 import 'package:analysis_server/src/constants.dart';
12 import 'package:analysis_server/src/domain_analysis.dart'; 13 import 'package:analysis_server/src/domain_analysis.dart';
13 import 'package:analysis_server/src/plugin/linter_plugin.dart'; 14 import 'package:analysis_server/src/plugin/linter_plugin.dart';
14 import 'package:analysis_server/src/plugin/server_plugin.dart'; 15 import 'package:analysis_server/src/plugin/server_plugin.dart';
15 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi n.dart'; 16 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi n.dart';
16 import 'package:analysis_server/src/services/index/index.dart'; 17 import 'package:analysis_server/src/services/index/index.dart';
17 import 'package:analyzer/file_system/file_system.dart'; 18 import 'package:analyzer/file_system/file_system.dart';
18 import 'package:analyzer/file_system/memory_file_system.dart'; 19 import 'package:analyzer/file_system/memory_file_system.dart';
19 import 'package:analyzer/instrumentation/instrumentation.dart'; 20 import 'package:analyzer/instrumentation/instrumentation.dart';
21 import 'package:analyzer/src/dart/analysis/driver.dart';
20 import 'package:analyzer/src/generated/engine.dart'; 22 import 'package:analyzer/src/generated/engine.dart';
21 import 'package:analyzer/src/generated/sdk.dart'; 23 import 'package:analyzer/src/generated/sdk.dart';
22 import 'package:linter/src/plugin/linter_plugin.dart'; 24 import 'package:linter/src/plugin/linter_plugin.dart';
23 import 'package:plugin/manager.dart'; 25 import 'package:plugin/manager.dart';
24 import 'package:plugin/plugin.dart'; 26 import 'package:plugin/plugin.dart';
25 import 'package:test/test.dart'; 27 import 'package:test/test.dart';
26 28
27 import 'mock_sdk.dart'; 29 import 'mock_sdk.dart';
28 import 'mocks.dart'; 30 import 'mocks.dart';
29 31
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 String projectPath; 64 String projectPath;
63 String testFolder; 65 String testFolder;
64 String testFile; 66 String testFile;
65 String testCode; 67 String testCode;
66 68
67 AbstractAnalysisTest(); 69 AbstractAnalysisTest();
68 70
69 AnalysisDomainHandler get analysisHandler => server.handlers 71 AnalysisDomainHandler get analysisHandler => server.handlers
70 .singleWhere((handler) => handler is AnalysisDomainHandler); 72 .singleWhere((handler) => handler is AnalysisDomainHandler);
71 73
74 AnalysisOptions get analysisOptions => enableNewAnalysisDriver
75 ? testDiver.analysisOptions
76 : testContext.analysisOptions;
77
72 AnalysisContext get testContext => server.getAnalysisContext(testFile); 78 AnalysisContext get testContext => server.getAnalysisContext(testFile);
73 79
80 AnalysisDriver get testDiver => server.getAnalysisDriver(testFile);
81
74 void addAnalysisSubscription(AnalysisService service, String file) { 82 void addAnalysisSubscription(AnalysisService service, String file) {
75 // add file to subscription 83 // add file to subscription
76 var files = analysisSubscriptions[service]; 84 var files = analysisSubscriptions[service];
77 if (files == null) { 85 if (files == null) {
78 files = <String>[]; 86 files = <String>[];
79 analysisSubscriptions[service] = files; 87 analysisSubscriptions[service] = files;
80 } 88 }
81 files.add(file); 89 files.add(file);
82 // set subscriptions 90 // set subscriptions
83 Request request = new AnalysisSetSubscriptionsParams(analysisSubscriptions) 91 Request request = new AnalysisSetSubscriptionsParams(analysisSubscriptions)
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 256 }
249 257
250 /** 258 /**
251 * Completes with a successful [Response] for the given [request]. 259 * Completes with a successful [Response] for the given [request].
252 * Otherwise fails. 260 * Otherwise fails.
253 */ 261 */
254 Future<Response> waitResponse(Request request) async { 262 Future<Response> waitResponse(Request request) async {
255 return serverChannel.sendRequest(request); 263 return serverChannel.sendRequest(request);
256 } 264 }
257 } 265 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698