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

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

Issue 3004523003: Remove more references to the old plugin system (Closed)
Patch Set: Created 3 years, 3 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
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 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_constants.dart'; 8 import 'package:analysis_server/protocol/protocol_constants.dart';
9 import 'package:analysis_server/protocol/protocol_generated.dart'; 9 import 'package:analysis_server/protocol/protocol_generated.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
11 import 'package:analysis_server/src/domain_analysis.dart'; 11 import 'package:analysis_server/src/domain_analysis.dart';
12 import 'package:analyzer/file_system/memory_file_system.dart'; 12 import 'package:analyzer/file_system/memory_file_system.dart';
13 import 'package:analyzer/instrumentation/instrumentation.dart'; 13 import 'package:analyzer/instrumentation/instrumentation.dart';
14 import 'package:analyzer/src/generated/engine.dart'; 14 import 'package:analyzer/src/generated/engine.dart';
15 import 'package:analyzer/src/generated/sdk.dart'; 15 import 'package:analyzer/src/generated/sdk.dart';
16 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 16 import 'package:analyzer_plugin/protocol/protocol_common.dart';
17 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; 17 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
18 import 'package:plugin/manager.dart'; 18 import 'package:plugin/manager.dart';
19 import 'package:plugin/plugin.dart';
20 import 'package:test/test.dart'; 19 import 'package:test/test.dart';
21 import 'package:test_reflective_loader/test_reflective_loader.dart'; 20 import 'package:test_reflective_loader/test_reflective_loader.dart';
22 21
23 import 'analysis_abstract.dart'; 22 import 'analysis_abstract.dart';
24 import 'mock_sdk.dart'; 23 import 'mock_sdk.dart';
25 import 'mocks.dart'; 24 import 'mocks.dart';
26 25
27 main() { 26 main() {
28 defineReflectiveSuite(() { 27 defineReflectiveSuite(() {
29 defineReflectiveTests(AnalysisDomainTest); 28 defineReflectiveTests(AnalysisDomainTest);
30 defineReflectiveTests(SetSubscriptionsTest); 29 defineReflectiveTests(SetSubscriptionsTest);
31 }); 30 });
32 31
33 MockServerChannel serverChannel; 32 MockServerChannel serverChannel;
34 MemoryResourceProvider resourceProvider; 33 MemoryResourceProvider resourceProvider;
35 AnalysisServer server; 34 AnalysisServer server;
36 AnalysisDomainHandler handler; 35 AnalysisDomainHandler handler;
37 36
38 void processRequiredPlugins() { 37 void processRequiredPlugins() {
39 List<Plugin> plugins = <Plugin>[];
40 plugins.addAll(AnalysisEngine.instance.requiredPlugins);
41
42 ExtensionManager manager = new ExtensionManager(); 38 ExtensionManager manager = new ExtensionManager();
43 manager.processPlugins(plugins); 39 manager.processPlugins(AnalysisEngine.instance.requiredPlugins);
44 } 40 }
45 41
46 setUp(() { 42 setUp(() {
47 serverChannel = new MockServerChannel(); 43 serverChannel = new MockServerChannel();
48 resourceProvider = new MemoryResourceProvider(); 44 resourceProvider = new MemoryResourceProvider();
49 processRequiredPlugins(); 45 processRequiredPlugins();
50 // Create an SDK in the mock file system. 46 // Create an SDK in the mock file system.
51 new MockSdk(resourceProvider: resourceProvider); 47 new MockSdk(resourceProvider: resourceProvider);
52 server = new AnalysisServer( 48 server = new AnalysisServer(
53 serverChannel, 49 serverChannel,
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 581
586 /** 582 /**
587 * Validates that the given [request] is handled successfully. 583 * Validates that the given [request] is handled successfully.
588 */ 584 */
589 void handleSuccessfulRequest(Request request) { 585 void handleSuccessfulRequest(Request request) {
590 Response response = handler.handleRequest(request); 586 Response response = handler.handleRequest(request);
591 expect(response, isResponseSuccess('0')); 587 expect(response, isResponseSuccess('0'));
592 } 588 }
593 589
594 void processRequiredPlugins() { 590 void processRequiredPlugins() {
595 List<Plugin> plugins = <Plugin>[];
596 plugins.addAll(AnalysisEngine.instance.requiredPlugins);
597
598 ExtensionManager manager = new ExtensionManager(); 591 ExtensionManager manager = new ExtensionManager();
599 manager.processPlugins(plugins); 592 manager.processPlugins(AnalysisEngine.instance.requiredPlugins);
600 } 593 }
601 594
602 /** 595 /**
603 * Send an `updateContent` request for [testFile]. 596 * Send an `updateContent` request for [testFile].
604 */ 597 */
605 void sendContentChange(dynamic contentChange) { 598 void sendContentChange(dynamic contentChange) {
606 Request request = new AnalysisUpdateContentParams({testFile: contentChange}) 599 Request request = new AnalysisUpdateContentParams({testFile: contentChange})
607 .toRequest('0'); 600 .toRequest('0');
608 handleSuccessfulRequest(request); 601 handleSuccessfulRequest(request);
609 } 602 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 plugin.AnalysisSetSubscriptionsParams params = 781 plugin.AnalysisSetSubscriptionsParams params =
789 pluginManager.analysisSetSubscriptionsParams; 782 pluginManager.analysisSetSubscriptionsParams;
790 expect(params, isNotNull); 783 expect(params, isNotNull);
791 Map<plugin.AnalysisService, List<String>> subscriptions = 784 Map<plugin.AnalysisService, List<String>> subscriptions =
792 params.subscriptions; 785 params.subscriptions;
793 expect(subscriptions, hasLength(1)); 786 expect(subscriptions, hasLength(1));
794 List<String> files = subscriptions[plugin.AnalysisService.HIGHLIGHTS]; 787 List<String> files = subscriptions[plugin.AnalysisService.HIGHLIGHTS];
795 expect(files, [testFile]); 788 expect(files, [testFile]);
796 } 789 }
797 } 790 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analysis_server/test/services/correction/assist_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698