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

Unified Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 2382033003: Revert "Remove unused option in server API" (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/context_manager_test.dart
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index ffaae9575706c952e33fad261947a55f6b5405c0..87f62fddfd25ebc48e1b0ea2cc4fb4e61bab3d6c 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -444,6 +444,10 @@ test_pack:lib/''');
newFile([examplePath, ContextManagerImpl.PACKAGE_SPEC_NAME]);
newFile([examplePath, 'example.dart']);
+ packageMapProvider.packageMap['proj'] = <Folder>[
+ resourceProvider.getResource(libPath)
+ ];
+
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
expect(callbacks.currentContextPaths, hasLength(2));
@@ -487,6 +491,7 @@ test_pack:lib/''');
}
void test_setRoots_addFolderWithoutPubspec() {
+ packageMapProvider.packageMap = null;
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// verify
expect(callbacks.currentContextPaths, hasLength(1));
@@ -977,6 +982,7 @@ test_pack:lib/''');
}
void test_setRoots_removeFolderWithoutPubspec() {
+ packageMapProvider.packageMap = null;
// add one root - there is a context
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
expect(callbacks.currentContextPaths, hasLength(1));
@@ -1613,6 +1619,7 @@ test_pack:lib/''');
// create a dependency file
String dependencyPath = posix.join(projPath, 'dep');
resourceProvider.newFile(dependencyPath, 'contents');
+ packageMapProvider.dependencies.add(dependencyPath);
// create a Dart file
String dartFilePath = posix.join(projPath, 'main.dart');
resourceProvider.newFile(dartFilePath, 'contents');
@@ -1621,6 +1628,7 @@ test_pack:lib/''');
expect(_currentPackageMap, isEmpty);
// Change the package map dependency so that the packageMapProvider is
// re-run, and arrange for it to return null from computePackageMap().
+ packageMapProvider.packageMap = null;
resourceProvider.modifyFile(dependencyPath, 'new contents');
await pumpEventQueue();
// The package map should have been changed to null.
@@ -1702,6 +1710,8 @@ abstract class ContextManagerTest {
MemoryResourceProvider resourceProvider;
+ MockPackageMapProvider packageMapProvider;
+
UriResolver packageResolver = null;
String projPath = '/my/proj';
@@ -1784,12 +1794,14 @@ abstract class ContextManagerTest {
void setUp() {
processRequiredPlugins();
resourceProvider = new MemoryResourceProvider();
+ packageMapProvider = new MockPackageMapProvider();
DartSdk sdk = new MockSdk(resourceProvider: resourceProvider);
DartSdkManager sdkManager = new DartSdkManager('/', false, (_) => sdk);
manager = new ContextManagerImpl(
resourceProvider,
sdkManager,
providePackageResolver,
+ packageMapProvider,
analysisFilesGlobs,
InstrumentationService.NULL_SERVICE,
new AnalysisOptionsImpl());
@@ -2697,6 +2709,11 @@ class TestContextManagerCallbacks extends ContextManagerCallbacks {
}
@override
+ void computingPackageMap(bool computing) {
+ // Do nothing.
+ }
+
+ @override
ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) {
DartSdkManager sdkManager = new DartSdkManager('/', false, null);
ContextBuilder builder =
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698