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

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

Issue 2286923002: Convert analysis server over to use ContextBuilder (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: address comment, fix bugs, clean-up Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/analysis_abstract.dart ('k') | pkg/analysis_server/test/completion_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/analysis_server_test.dart
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index 1c2e212ba51442c2abffb2569cbc0af1d3dec2da..af36f04a87b37bdb9915981d3aaeed67501f44d3 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -137,6 +137,7 @@ import "../foo/foo.dart";
manager.processPlugins([plugin]);
channel = new MockServerChannel();
resourceProvider = new MemoryResourceProvider();
+ MockSdk sdk = new MockSdk(resourceProvider: resourceProvider);
packageMapProvider = new MockPackageMapProvider();
server = new AnalysisServer(
channel,
@@ -145,7 +146,7 @@ import "../foo/foo.dart";
null,
plugin,
new AnalysisServerOptions(),
- new DartSdkManager('', false, (_) => new MockSdk()),
+ new DartSdkManager('/', false, (_) => sdk),
InstrumentationService.NULL_SERVICE,
rethrowExceptions: true);
processRequiredPlugins();
@@ -286,29 +287,26 @@ import "../foo/foo.dart";
expect(pair.source, isNull);
}
- test_getContextSourcePair_package_inRoot() {
- String rootPath = '/my_package';
- String filePath = rootPath + '/lib/file.dart';
- Folder rootFolder = resourceProvider.newFolder(rootPath);
+ test_getContextSourcePair_simple() {
+ String dirPath = '/dir';
+ String filePath = dirPath + '/file.dart';
resourceProvider.newFile(filePath, 'library lib;');
-
- packageMapProvider.packageMap = <String, List<Folder>>{
- 'my_package': <Folder>[rootFolder]
- };
// create contexts
- server.setAnalysisRoots('0', [rootPath], [], {});
+ server.setAnalysisRoots('0', [dirPath], [], {});
// get pair
ContextSourcePair pair = server.getContextSourcePair(filePath);
- _assertContextOfFolder(pair.context, rootPath);
+ _assertContextOfFolder(pair.context, dirPath);
Source source = pair.source;
expect(source, isNotNull);
- expect(source.uri.scheme, 'package');
+ expect(source.uri.scheme, 'file');
expect(source.fullName, filePath);
}
- test_getContextSourcePair_simple() {
+ test_getContextSourcePair_withPackagesFile() {
String dirPath = '/dir';
- String filePath = dirPath + '/file.dart';
+ String packagesFilePath = dirPath + '/.packages';
+ resourceProvider.newFile(packagesFilePath, 'dir:lib/');
+ String filePath = dirPath + '/lib/file.dart';
resourceProvider.newFile(filePath, 'library lib;');
// create contexts
server.setAnalysisRoots('0', [dirPath], [], {});
@@ -317,7 +315,7 @@ import "../foo/foo.dart";
_assertContextOfFolder(pair.context, dirPath);
Source source = pair.source;
expect(source, isNotNull);
- expect(source.uri.scheme, 'file');
+ expect(source.uri.scheme, 'package');
expect(source.fullName, filePath);
}
« no previous file with comments | « pkg/analysis_server/test/analysis_abstract.dart ('k') | pkg/analysis_server/test/completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698