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

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

Issue 1405643002: Issue 24566. Main AnalysisContext.getLibrariesContaining() should work also for SDK sources. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/test/src/context/context_test.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 469d5f35022417c761f31de4488a270344b1e7bb..8dd7dbc87f06318f3cc8a1958073486f98c4d17b 100644
--- a/pkg/analyzer/test/src/task/dart_work_manager_test.dart
+++ b/pkg/analyzer/test/src/task/dart_work_manager_test.dart
@@ -332,6 +332,32 @@ class DartWorkManagerTest {
expect(manager.getLibrariesContainingPart(part3), isEmpty);
}
+ void test_getLibrariesContainingPart_inSDK() {
+ Source part = new _SourceMock('part.dart');
+ when(part.isInSystemLibrary).thenReturn(true);
+ // SDK work manager
+ DartWorkManager sdkDartWorkManagerMock = new _DartWorkManagerMock();
+ when(sdkDartWorkManagerMock.getLibrariesContainingPart(part))
+ .thenReturn([source2, source3]);
+ // SDK context mock
+ InternalAnalysisContext sdkContextMock = new _InternalAnalysisContextMock();
+ when(sdkContextMock.workManagers).thenReturn([sdkDartWorkManagerMock]);
+ // SDK mock
+ DartSdk sdkMock = new _DartSdkMock();
+ when(sdkMock.context).thenReturn(sdkContextMock);
+ // SourceFactory mock
+ SourceFactory sourceFactory = new _SourceFactoryMock();
+ when(sourceFactory.dartSdk).thenReturn(sdkMock);
+ when(context.sourceFactory).thenReturn(sourceFactory);
+ // SDK source mock
+ Source source = new _SourceMock('test.dart');
+ when(source.source).thenReturn(source);
+ when(source.isInSystemLibrary).thenReturn(true);
+ // validate
+ expect(manager.getLibrariesContainingPart(part),
+ unorderedEquals([source2, source3]));
+ }
+
void test_getNextResult_hasLibraries_firstIsError() {
entry1.setErrorState(caughtException, [LIBRARY_ERRORS_READY]);
manager.librarySourceQueue.addAll([source1, source2]);
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698