OLD | NEW |
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 'package:analysis_server/src/context_manager.dart'; | 7 import 'package:analysis_server/src/context_manager.dart'; |
8 import 'reflective_tests.dart'; | 8 import 'reflective_tests.dart'; |
9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // pubspec.yaml files. | 99 // pubspec.yaml files. |
100 String subdir1Path = posix.join(projPath, 'subdir1'); | 100 String subdir1Path = posix.join(projPath, 'subdir1'); |
101 String subdir2Path = posix.join(projPath, 'subdir2'); | 101 String subdir2Path = posix.join(projPath, 'subdir2'); |
102 String pubspec1Path = posix.join(subdir1Path, 'pubspec.yaml'); | 102 String pubspec1Path = posix.join(subdir1Path, 'pubspec.yaml'); |
103 String pubspec2Path = posix.join(subdir2Path, 'pubspec.yaml'); | 103 String pubspec2Path = posix.join(subdir2Path, 'pubspec.yaml'); |
104 resourceProvider.newFile(pubspec1Path, 'pubspec'); | 104 resourceProvider.newFile(pubspec1Path, 'pubspec'); |
105 resourceProvider.newFile(pubspec2Path, 'pubspec'); | 105 resourceProvider.newFile(pubspec2Path, 'pubspec'); |
106 manager.setRoots(<String>[projPath], <String>[]); | 106 manager.setRoots(<String>[projPath], <String>[]); |
107 return pumpEventQueue().then((_) { | 107 return pumpEventQueue().then((_) { |
108 expect(manager.currentContextPaths.toSet(), | 108 expect(manager.currentContextPaths.toSet(), |
109 [projPath, subdir1Path, subdir2Path].toSet()); | 109 [subdir1Path, subdir2Path, projPath].toSet()); |
110 manager.now++; | 110 manager.now++; |
111 manager.refresh(); | 111 manager.refresh(); |
112 return pumpEventQueue().then((_) { | 112 return pumpEventQueue().then((_) { |
113 expect(manager.currentContextPaths.toSet(), | 113 expect(manager.currentContextPaths.toSet(), |
114 [projPath, subdir1Path, subdir2Path].toSet()); | 114 [subdir1Path, subdir2Path, projPath].toSet()); |
115 expect(manager.currentContextTimestamps[projPath], manager.now); | 115 expect(manager.currentContextTimestamps[projPath], manager.now); |
116 expect(manager.currentContextTimestamps[subdir1Path], manager.now); | 116 expect(manager.currentContextTimestamps[subdir1Path], manager.now); |
117 expect(manager.currentContextTimestamps[subdir2Path], manager.now); | 117 expect(manager.currentContextTimestamps[subdir2Path], manager.now); |
118 }); | 118 }); |
119 }); | 119 }); |
120 } | 120 } |
121 | 121 |
122 void test_setRoots_addFolderWithDartFile() { | 122 void test_setRoots_addFolderWithDartFile() { |
123 String filePath = posix.join(projPath, 'foo.dart'); | 123 String filePath = posix.join(projPath, 'foo.dart'); |
124 resourceProvider.newFile(filePath, 'contents'); | 124 resourceProvider.newFile(filePath, 'contents'); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 currentContextFilePaths.remove(path); | 748 currentContextFilePaths.remove(path); |
749 currentContextPackageMaps.remove(path); | 749 currentContextPackageMaps.remove(path); |
750 } | 750 } |
751 | 751 |
752 @override | 752 @override |
753 void updateContextPackageMap(Folder contextFolder, Map<String, | 753 void updateContextPackageMap(Folder contextFolder, Map<String, |
754 List<Folder>> packageMap) { | 754 List<Folder>> packageMap) { |
755 currentContextPackageMaps[contextFolder.path] = packageMap; | 755 currentContextPackageMaps[contextFolder.path] = packageMap; |
756 } | 756 } |
757 } | 757 } |
OLD | NEW |