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

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 1399873002: Issue 24538. Route SDK results into SDK context DartWorkManager. (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/generated/engine_test.dart ('k') | pkg/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index d4d31319514ec9f35a2c7f811383c3ea1f1cba4c..8875d92b09d0d63f933620b11bac97f93f33b873 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -1191,6 +1191,33 @@ export 'libA.dart';''');
fail("The added source was not in the list of library sources");
}
+ void test_getLibrarySources_inSDK() {
+ Source source = addSource(
+ '/test.dart',
+ r'''
+import 'dart:async';
+Stream S = null;
+''');
+ LibraryElement testLibrary = context.computeLibraryElement(source);
+ // prepare "Stream" ClassElement
+ ClassElement streamElement;
+ {
+ CompilationUnitElement testUnit = testLibrary.definingCompilationUnit;
+ InterfaceType streamType = testUnit.topLevelVariables[0].type;
+ streamElement = streamType.element;
+ }
+ // must be from SDK context
+ AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
+ expect(sdkContext, streamElement.context);
+ // must be in the "async" library
+ Source intSource = streamElement.source;
+ List<Source> coreLibraries = sdkContext.getLibrariesContaining(intSource);
+ expect(coreLibraries, hasLength(1));
+ Source coreSource = coreLibraries[0];
+ expect(coreSource.isInSystemLibrary, isTrue);
+ expect(coreSource.shortName, 'async.dart');
+ }
+
void test_getLineInfo() {
Source source = addSource(
"/test.dart",
« no previous file with comments | « pkg/analyzer/test/generated/engine_test.dart ('k') | pkg/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698