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

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

Issue 2812093002: Simplify PackageMapUriResolver - one folder, return any file, or null. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | pkg/analyzer/lib/source/package_map_resolver.dart » ('j') | 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:analysis_server/src/utilities/null_string_sink.dart'; 10 import 'package:analysis_server/src/utilities/null_string_sink.dart';
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 List<AnalysisDriver> drivers = manager 433 List<AnalysisDriver> drivers = manager
434 .getDriversInAnalysisRoot(resourceProvider.newFolder(projPath)); 434 .getDriversInAnalysisRoot(resourceProvider.newFolder(projPath));
435 expect(drivers, hasLength(1)); 435 expect(drivers, hasLength(1));
436 expect(drivers[0], isNotNull); 436 expect(drivers[0], isNotNull);
437 } else { 437 } else {
438 List<AnalysisContext> contextsInAnalysisRoot = 438 List<AnalysisContext> contextsInAnalysisRoot =
439 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 439 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
440 expect(contextsInAnalysisRoot, hasLength(1)); 440 expect(contextsInAnalysisRoot, hasLength(1));
441 expect(contextsInAnalysisRoot[0], isNotNull); 441 expect(contextsInAnalysisRoot[0], isNotNull);
442 } 442 }
443 Source result = sourceFactory.forUri('package:foo/foo.dart'); 443 Source result = sourceFactory.forUri('dart:async');
444 expect(result, isNotNull); 444 expect(result, isNotNull);
445 expect(result.exists(), isFalse);
446 } 445 }
447 446
448 void test_setRoots_addFolderWithDartFileInSubfolder() { 447 void test_setRoots_addFolderWithDartFileInSubfolder() {
449 String filePath = path.posix.join(projPath, 'foo', 'bar.dart'); 448 String filePath = path.posix.join(projPath, 'foo', 'bar.dart');
450 resourceProvider.newFile(filePath, 'contents'); 449 resourceProvider.newFile(filePath, 'contents');
451 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 450 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
452 // verify 451 // verify
453 Iterable<String> filePaths = callbacks.currentFilePaths; 452 Iterable<String> filePaths = callbacks.currentFilePaths;
454 expect(filePaths, hasLength(1)); 453 expect(filePaths, hasLength(1));
455 expect(filePaths, contains(filePath)); 454 expect(filePaths, contains(filePath));
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2900 class TestUriResolver extends UriResolver { 2899 class TestUriResolver extends UriResolver {
2901 Map<Uri, Source> uriMap; 2900 Map<Uri, Source> uriMap;
2902 2901
2903 TestUriResolver(this.uriMap); 2902 TestUriResolver(this.uriMap);
2904 2903
2905 @override 2904 @override
2906 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2905 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2907 return uriMap[uri]; 2906 return uriMap[uri];
2908 } 2907 }
2909 } 2908 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/source/package_map_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698