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

Side by Side Diff: pkg/analysis_server/test/src/plugin/plugin_manager_test.dart

Issue 2988743002: Remove the analysus.reanalyze request from the plugin API (Closed)
Patch Set: Restart plugins Created 3 years, 4 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
« no previous file with comments | « pkg/analysis_server/test/analysis_abstract.dart ('k') | pkg/analyzer_plugin/doc/api.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:io' as io; 6 import 'dart:io' as io;
7 7
8 import 'package:analysis_server/src/plugin/notification_manager.dart'; 8 import 'package:analysis_server/src/plugin/notification_manager.dart';
9 import 'package:analysis_server/src/plugin/plugin_manager.dart'; 9 import 'package:analysis_server/src/plugin/plugin_manager.dart';
10 import 'package:analyzer/context/context_root.dart'; 10 import 'package:analyzer/context/context_root.dart';
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 await withPlugin(test: (String pluginPath) async { 353 await withPlugin(test: (String pluginPath) async {
354 ContextRoot contextRoot = new ContextRoot(pkgPath, []); 354 ContextRoot contextRoot = new ContextRoot(pkgPath, []);
355 await manager.addPluginToContextRoot(contextRoot, pluginPath); 355 await manager.addPluginToContextRoot(contextRoot, pluginPath);
356 356
357 manager.removedContextRoot(contextRoot); 357 manager.removedContextRoot(contextRoot);
358 358
359 await manager.stopAll(); 359 await manager.stopAll();
360 }); 360 });
361 pkg1Dir.deleteSync(recursive: true); 361 pkg1Dir.deleteSync(recursive: true);
362 } 362 }
363
364 test_restartPlugins() async {
365 io.Directory pkg1Dir = io.Directory.systemTemp.createTempSync('pkg1');
366 String pkg1Path = pkg1Dir.resolveSymbolicLinksSync();
367 io.Directory pkg2Dir = io.Directory.systemTemp.createTempSync('pkg2');
368 String pkg2Path = pkg2Dir.resolveSymbolicLinksSync();
369 await withPlugin(
370 pluginName: 'plugin1',
371 test: (String plugin1Path) async {
372 await withPlugin(
373 pluginName: 'plugin2',
374 test: (String plugin2Path) async {
375 ContextRoot contextRoot1 = new ContextRoot(pkg1Path, []);
376 ContextRoot contextRoot2 = new ContextRoot(pkg2Path, []);
377 await manager.addPluginToContextRoot(contextRoot1, plugin1Path);
378 await manager.addPluginToContextRoot(contextRoot1, plugin2Path);
379 await manager.addPluginToContextRoot(contextRoot2, plugin1Path);
380
381 await manager.restartPlugins();
382 List<PluginInfo> plugins = manager.plugins;
383 expect(plugins, hasLength(2));
384 expect(plugins[0].currentSession, isNotNull);
385 expect(plugins[1].currentSession, isNotNull);
386 if (plugins[0].pluginId.contains('plugin1')) {
387 expect(plugins[0].contextRoots,
388 unorderedEquals([contextRoot1, contextRoot2]));
389 expect(
390 plugins[1].contextRoots, unorderedEquals([contextRoot1]));
391 } else {
392 expect(
393 plugins[0].contextRoots, unorderedEquals([contextRoot1]));
394 expect(plugins[1].contextRoots,
395 unorderedEquals([contextRoot1, contextRoot2]));
396 }
397 await manager.stopAll();
398 });
399 });
400 pkg1Dir.deleteSync(recursive: true);
401 }
363 } 402 }
364 403
365 @reflectiveTest 404 @reflectiveTest
366 class PluginManagerTest { 405 class PluginManagerTest {
367 MemoryResourceProvider resourceProvider; 406 MemoryResourceProvider resourceProvider;
368 String byteStorePath; 407 String byteStorePath;
369 String sdkPath; 408 String sdkPath;
370 TestNotificationManager notificationManager; 409 TestNotificationManager notificationManager;
371 PluginManager manager; 410 PluginManager manager;
372 411
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 } 910 }
872 911
873 @override 912 @override
874 void sendRequest(Request request) { 913 void sendRequest(Request request) {
875 sentRequests.add(request); 914 sentRequests.add(request);
876 if (request.method == 'plugin.shutdown') { 915 if (request.method == 'plugin.shutdown') {
877 session.handleOnDone(); 916 session.handleOnDone();
878 } 917 }
879 } 918 }
880 } 919 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_abstract.dart ('k') | pkg/analyzer_plugin/doc/api.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698