Index: pkg/analysis_server/test/context_manager_test.dart |
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart |
index 244d9c2194466a44c3c7e3a9d3c5c3113deff900..4a4ec36fd3e4bebfc2919aa6f6bb238820ffd98c 100644 |
--- a/pkg/analysis_server/test/context_manager_test.dart |
+++ b/pkg/analysis_server/test/context_manager_test.dart |
@@ -129,7 +129,7 @@ class ContextManagerTest { |
return pumpEventQueue().then((_) { |
expect(manager.currentContextPaths.toList(), [projPath]); |
manager.now++; |
- manager.refresh(); |
+ manager.refresh(null); |
return pumpEventQueue().then((_) { |
expect(manager.currentContextPaths.toList(), [projPath]); |
expect(manager.currentContextTimestamps[projPath], manager.now); |
@@ -151,7 +151,7 @@ class ContextManagerTest { |
expect(manager.currentContextPaths.toSet(), |
[subdir1Path, subdir2Path, projPath].toSet()); |
manager.now++; |
- manager.refresh(); |
+ manager.refresh(null); |
return pumpEventQueue().then((_) { |
expect(manager.currentContextPaths.toSet(), |
[subdir1Path, subdir2Path, projPath].toSet()); |
@@ -162,6 +162,31 @@ class ContextManagerTest { |
}); |
} |
+ test_refresh_oneContext() { |
+ // create two contexts with pubspec.yaml files |
+ String pubspecPath = posix.join(projPath, 'pubspec.yaml'); |
+ resourceProvider.newFile(pubspecPath, 'pubspec1'); |
+ |
+ String proj2Path = '/my/proj2'; |
+ resourceProvider.newFolder(proj2Path); |
+ String pubspec2Path = posix.join(proj2Path, 'pubspec.yaml'); |
+ resourceProvider.newFile(pubspec2Path, 'pubspec2'); |
+ |
+ List<String> roots = <String>[projPath, proj2Path]; |
+ manager.setRoots(roots, <String>[], <String, String>{}); |
+ return pumpEventQueue().then((_) { |
+ expect(manager.currentContextPaths.toList(), unorderedEquals(roots)); |
+ int then = manager.now; |
+ manager.now++; |
+ manager.refresh([resourceProvider.getResource(proj2Path)]); |
+ return pumpEventQueue().then((_) { |
+ expect(manager.currentContextPaths.toList(), unorderedEquals(roots)); |
+ expect(manager.currentContextTimestamps[projPath], then); |
+ expect(manager.currentContextTimestamps[proj2Path], manager.now); |
+ }); |
+ }); |
+ } |
+ |
void test_setRoots_addFolderWithDartFile() { |
String filePath = posix.join(projPath, 'foo.dart'); |
resourceProvider.newFile(filePath, 'contents'); |