Index: pkg/analyzer/test/src/task/dart_work_manager_test.dart |
diff --git a/pkg/analyzer/test/src/task/dart_work_manager_test.dart b/pkg/analyzer/test/src/task/dart_work_manager_test.dart |
index 65bf213a3b97aae9386115ec962aed412cc8fa37..79f307183c35e9f10330bc284c5a53ecc8de8ab6 100644 |
--- a/pkg/analyzer/test/src/task/dart_work_manager_test.dart |
+++ b/pkg/analyzer/test/src/task/dart_work_manager_test.dart |
@@ -347,6 +347,33 @@ class DartWorkManagerTest { |
expect(manager.getLibrariesContainingPart(part3), isEmpty); |
} |
+ void test_getLibrariesContainingPart_askResultProvider() { |
+ Source part1 = new TestSource('part1.dart'); |
+ Source part2 = new TestSource('part2.dart'); |
+ Source part3 = new TestSource('part3.dart'); |
+ Source library1 = new TestSource('library1.dart'); |
+ Source library2 = new TestSource('library2.dart'); |
+ // configure AnalysisContext mock |
+ when(context.aboutToComputeResult(anyObject, CONTAINING_LIBRARIES)) |
+ .thenInvoke((CacheEntry entry, ResultDescriptor result) { |
+ if (entry.target == part1) { |
+ entry.setValue(result, <Source>[library1, library2], []); |
+ return true; |
+ } |
+ if (entry.target == part2) { |
+ entry.setValue(result, <Source>[library2], []); |
+ return true; |
+ } |
+ return false; |
+ }); |
+ // getLibrariesContainingPart |
+ expect(manager.getLibrariesContainingPart(part1), |
+ unorderedEquals([library1, library2])); |
+ expect( |
+ manager.getLibrariesContainingPart(part2), unorderedEquals([library2])); |
+ expect(manager.getLibrariesContainingPart(part3), isEmpty); |
+ } |
+ |
void test_getLibrariesContainingPart_inSDK() { |
Source part = new _SourceMock('part.dart'); |
when(part.isInSystemLibrary).thenReturn(true); |
@@ -765,6 +792,11 @@ class DartWorkManagerTest { |
expect(manager.libraryPartsMap, isEmpty); |
} |
+ void test_unitIncrementallyResolved() { |
+ manager.unitIncrementallyResolved(source1, source2); |
+ expect_librarySourceQueue([source1]); |
+ } |
+ |
CacheEntry _getOrCreateEntry(Source source, [bool explicit = true]) { |
CacheEntry entry = cache.get(source); |
if (entry == null) { |