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

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

Issue 1653733002: Support for embedder dependency changes (#25606). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: master_merge Created 4 years, 10 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
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/source/embedder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cce4de07f7663219604496c88573d1d7a76befc1..d225c9051b73e16591754f7ef50cf3c5b25e7db0 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -286,6 +286,59 @@ linter:
expect(contexts, contains(subProjContextInfo.context));
}
+ test_embedder_added() async {
+ // Create files.
+ String libPath = newFolder([projPath, LIB_NAME]);
+ newFile([libPath, 'main.dart']);
+ newFile([libPath, 'nope.dart']);
+ String embedderPath = newFolder([projPath, 'embedder']);
+ newFile([embedderPath, 'entry.dart']);
+ String embedderSrcPath = newFolder([projPath, 'embedder', 'src']);
+ newFile([embedderSrcPath, 'part.dart']);
+
+ // Setup _embedder.yaml.
+ newFile(
+ [libPath, '_embedder.yaml'],
+ r'''
+embedded_libs:
+ "dart:foobar": "../embedder/entry.dart"
+ "dart:typed_data": "../embedder/src/part"
+ ''');
+
+ Folder projectFolder = resourceProvider.newFolder(projPath);
+
+ // NOTE that this is Not in our package path yet.
+
+ // Setup context.
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ await pumpEventQueue();
+ // Confirm that one context was created.
+ List<AnalysisContext> contexts =
+ manager.contextsInAnalysisRoot(projectFolder);
+ expect(contexts, isNotNull);
+ expect(contexts, hasLength(1));
+
+ // No embedded libs yet.
+ expect(contexts.first.sourceFactory.forUri('dart:typed_data'), isNull);
+
+ // Add .packages file that introduces a dependency with embedded libs.
+ newFile(
+ [projPath, '.packages'],
+ r'''
+test_pack:lib/''');
+
+ await pumpEventQueue();
+
+ contexts = manager.contextsInAnalysisRoot(projectFolder);
+
+ // Confirm that we still have just one context.
+ expect(contexts, isNotNull);
+ expect(contexts, hasLength(1));
+
+ // Embedded lib should be defined now.
+ expect(contexts.first.sourceFactory.forUri('dart:typed_data'), isNotNull);
+ }
+
test_embedder_options() async {
// Create files.
String libPath = newFolder([projPath, LIB_NAME]);
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/source/embedder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698