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

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

Issue 2542853003: Create summary files in MockSdk classes (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.analysis_server; 5 library test.analysis_server;
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return server.onAnalysisComplete.then((_) { 114 return server.onAnalysisComplete.then((_) {
115 expect(server.statusAnalyzing, isFalse); 115 expect(server.statusAnalyzing, isFalse);
116 // Make sure getAnalysisContext returned the proper context for each. 116 // Make sure getAnalysisContext returned the proper context for each.
117 expect(fooContext.getKindOf(fooSource), SourceKind.LIBRARY); 117 expect(fooContext.getKindOf(fooSource), SourceKind.LIBRARY);
118 expect(fooContext.getKindOf(barSource), SourceKind.UNKNOWN); 118 expect(fooContext.getKindOf(barSource), SourceKind.UNKNOWN);
119 expect(barContext.getKindOf(fooSource), SourceKind.UNKNOWN); 119 expect(barContext.getKindOf(fooSource), SourceKind.UNKNOWN);
120 expect(barContext.getKindOf(barSource), SourceKind.LIBRARY); 120 expect(barContext.getKindOf(barSource), SourceKind.LIBRARY);
121 }); 121 });
122 } 122 }
123 123
124 void processRequiredPlugins() { 124 void processRequiredPlugins(ServerPlugin serverPlugin) {
125 List<Plugin> plugins = <Plugin>[]; 125 List<Plugin> plugins = <Plugin>[];
126 plugins.addAll(AnalysisEngine.instance.requiredPlugins); 126 plugins.addAll(AnalysisEngine.instance.requiredPlugins);
127 plugins.add(AnalysisEngine.instance.optionsPlugin); 127 plugins.add(AnalysisEngine.instance.optionsPlugin);
128 plugins.add(server.serverPlugin); 128 plugins.add(serverPlugin);
129 129
130 ExtensionManager manager = new ExtensionManager(); 130 ExtensionManager manager = new ExtensionManager();
131 manager.processPlugins(plugins); 131 manager.processPlugins(plugins);
132 } 132 }
133 133
134 void setUp() { 134 void setUp() {
135 ExtensionManager manager = new ExtensionManager(); 135 ServerPlugin serverPlugin = new ServerPlugin();
136 ServerPlugin plugin = new ServerPlugin(); 136 processRequiredPlugins(serverPlugin);
137 manager.processPlugins([plugin]);
138 channel = new MockServerChannel(); 137 channel = new MockServerChannel();
139 resourceProvider = new MemoryResourceProvider(); 138 resourceProvider = new MemoryResourceProvider();
140 // Create an SDK in the mock file system. 139 // Create an SDK in the mock file system.
141 new MockSdk(resourceProvider: resourceProvider); 140 new MockSdk(resourceProvider: resourceProvider);
142 packageMapProvider = new MockPackageMapProvider(); 141 packageMapProvider = new MockPackageMapProvider();
143 server = new AnalysisServer( 142 server = new AnalysisServer(
144 channel, 143 channel,
145 resourceProvider, 144 resourceProvider,
146 packageMapProvider, 145 packageMapProvider,
147 null, 146 null,
148 plugin, 147 serverPlugin,
149 new AnalysisServerOptions(), 148 new AnalysisServerOptions(),
150 new DartSdkManager('/', false), 149 new DartSdkManager('/', false),
151 InstrumentationService.NULL_SERVICE, 150 InstrumentationService.NULL_SERVICE,
152 rethrowExceptions: true); 151 rethrowExceptions: true);
153 processRequiredPlugins();
154 } 152 }
155 153
156 Future test_contextDisposed() { 154 Future test_contextDisposed() {
157 resourceProvider.newFolder('/foo'); 155 resourceProvider.newFolder('/foo');
158 resourceProvider.newFile('/foo/bar.dart', 'library lib;'); 156 resourceProvider.newFile('/foo/bar.dart', 'library lib;');
159 server.setAnalysisRoots('0', ['/foo'], [], {}); 157 server.setAnalysisRoots('0', ['/foo'], [], {});
160 AnalysisContext context; 158 AnalysisContext context;
161 return pumpEventQueue() 159 return pumpEventQueue()
162 .then((_) { 160 .then((_) {
163 context = server.getAnalysisContext('/foo/bar.dart'); 161 context = server.getAnalysisContext('/foo/bar.dart');
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 _MockServerOperation(this.context); 568 _MockServerOperation(this.context);
571 569
572 @override 570 @override
573 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; 571 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS;
574 572
575 @override 573 @override
576 void perform(AnalysisServer server) { 574 void perform(AnalysisServer server) {
577 isComplete = true; 575 isComplete = true;
578 } 576 }
579 } 577 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | pkg/analysis_server/test/mock_sdk.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698