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

Unified Diff: pkg/analyzer/test/src/context/builder_test.dart

Issue 2163003002: Add a hook to ContextBuilder needed by server (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/analyzer/lib/src/context/builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/context/builder_test.dart
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index 67e4b2620fea573cce89e323042c715abd668d26..50489e49effcbf2204eb3c406d740c90ca199f49 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -9,7 +9,9 @@ import 'dart:io' as io;
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/source/package_map_resolver.dart';
import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -226,6 +228,29 @@ bar:/pkg/bar
});
}
+ void test_createSourceFactory_fileProvider() {
+ withTempDir((io.Directory tempDir) {
+ createDefaultSdk(tempDir);
+ String rootPath = tempDir.path;
+ String projectPath = pathContext.join(rootPath, 'project');
+ String packageFilePath = pathContext.join(projectPath, '.packages');
+ String packageA = pathContext.join(rootPath, 'pkgs', 'a');
+ String packageB = pathContext.join(rootPath, 'pkgs', 'b');
+ createFile(
+ packageFilePath,
+ '''
+a:${pathContext.toUri(packageA)}
+b:${pathContext.toUri(packageB)}
+''');
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ UriResolver resolver = new ResourceUriResolver(resourceProvider);
+ builder.fileResolverProvider = (folder) => resolver;
+ SourceFactoryImpl factory =
+ builder.createSourceFactory(projectPath, options);
+ expect(factory.resolvers, contains(same(resolver)));
+ });
+ }
+
void test_createSourceFactory_noProvider_packages_embedder_extensions() {
withTempDir((io.Directory tempDir) {
createDefaultSdk(tempDir);
@@ -346,9 +371,18 @@ b:${pathContext.toUri(packageB)}
});
}
- @failingTest
- void test_createSourceFactory_provider() {
- fail('Incomplete test');
+ void test_createSourceFactory_packageProvider() {
+ withTempDir((io.Directory tempDir) {
+ createDefaultSdk(tempDir);
+ String rootPath = tempDir.path;
+ String projectPath = pathContext.join(rootPath, 'project');
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ UriResolver resolver = new PackageMapUriResolver(resourceProvider, {});
+ builder.packageResolverProvider = (folder) => resolver;
+ SourceFactoryImpl factory =
+ builder.createSourceFactory(projectPath, options);
+ expect(factory.resolvers, contains(same(resolver)));
+ });
}
@failingTest
« no previous file with comments | « pkg/analyzer/lib/src/context/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698