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

Unified Diff: pkg/analyzer/test/src/task/dart_work_manager_test.dart

Issue 2184243002: Add a couple of new tests for DartWorkManager. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart_work_manager.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « pkg/analyzer/lib/src/task/dart_work_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698