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

Side by Side Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 1277063002: In analysis server, favor package root setting over ".packages" file. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/lib/src/context_manager.dart ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library test.context.directory.manager; 5 library test.context.directory.manager;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/context_manager.dart'; 9 import 'package:analysis_server/src/context_manager.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 // smoketest resolution 574 // smoketest resolution
575 SourceFactory sourceFactory = callbacks.currentContext.sourceFactory; 575 SourceFactory sourceFactory = callbacks.currentContext.sourceFactory;
576 Source resolvedSource = 576 Source resolvedSource =
577 sourceFactory.resolveUri(source, 'package:unittest/unittest.dart'); 577 sourceFactory.resolveUri(source, 'package:unittest/unittest.dart');
578 expect(resolvedSource, isNotNull); 578 expect(resolvedSource, isNotNull);
579 expect(resolvedSource.fullName, 579 expect(resolvedSource.fullName,
580 equals('/home/somebody/.pub/cache/unittest-0.9.9/lib/unittest.dart')); 580 equals('/home/somebody/.pub/cache/unittest-0.9.9/lib/unittest.dart'));
581 } 581 }
582 582
583 void test_setRoots_addFolderWithPackagespecAndPackageRoot() {
584 // The package root should take priority.
585 String packagespecPath = posix.join(projPath, '.packages');
586 resourceProvider.newFile(packagespecPath,
587 'unittest:file:///home/somebody/.pub/cache/unittest-0.9.9/lib/');
588 String packageRootPath = '/package/root/';
589 manager.setRoots(<String>[projPath], <String>[],
590 <String, String>{projPath: packageRootPath});
591 expect(callbacks.currentContextPaths, hasLength(1));
592 expect(callbacks.currentContextPaths, contains(projPath));
593 expect(callbacks.currentContextDispositions[projPath].packageRoot,
594 packageRootPath);
595 }
596
583 void test_setRoots_addFolderWithPubspec() { 597 void test_setRoots_addFolderWithPubspec() {
584 String pubspecPath = posix.join(projPath, 'pubspec.yaml'); 598 String pubspecPath = posix.join(projPath, 'pubspec.yaml');
585 resourceProvider.newFile(pubspecPath, 'pubspec'); 599 resourceProvider.newFile(pubspecPath, 'pubspec');
586 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 600 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
587 // verify 601 // verify
588 expect(callbacks.currentContextPaths, hasLength(1)); 602 expect(callbacks.currentContextPaths, hasLength(1));
589 expect(callbacks.currentContextPaths, contains(projPath)); 603 expect(callbacks.currentContextPaths, contains(projPath));
590 expect(callbacks.currentContextFilePaths[projPath], hasLength(0)); 604 expect(callbacks.currentContextFilePaths[projPath], hasLength(0));
591 } 605 }
592 606
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 class TestUriResolver extends UriResolver { 1669 class TestUriResolver extends UriResolver {
1656 Map<Uri, Source> uriMap; 1670 Map<Uri, Source> uriMap;
1657 1671
1658 TestUriResolver(this.uriMap); 1672 TestUriResolver(this.uriMap);
1659 1673
1660 @override 1674 @override
1661 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 1675 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
1662 return uriMap[uri]; 1676 return uriMap[uri];
1663 } 1677 }
1664 } 1678 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698