Chromium Code Reviews| Index: pkg/analyzer/test/src/context/mock_sdk.dart |
| diff --git a/pkg/analyzer/test/src/context/mock_sdk.dart b/pkg/analyzer/test/src/context/mock_sdk.dart |
| index 464dec037785d7894801e1dc3a182316d2a20489..3d5ee7d9753f036d01cd155576de37fdcc275b73 100644 |
| --- a/pkg/analyzer/test/src/context/mock_sdk.dart |
| +++ b/pkg/analyzer/test/src/context/mock_sdk.dart |
| @@ -351,7 +351,9 @@ class MockSdk implements DartSdk { |
| PackageBundle _bundle; |
| MockSdk( |
| - {bool dartAsync: true, resource.MemoryResourceProvider resourceProvider}) |
| + {bool buildSummaries: true, |
| + bool dartAsync: true, |
| + resource.MemoryResourceProvider resourceProvider}) |
| : provider = resourceProvider ?? new resource.MemoryResourceProvider(), |
| sdkLibraries = dartAsync ? _LIBRARIES : [_LIB_CORE], |
| uriMap = dartAsync ? FULL_URI_MAP : NO_ASYNC_URI_MAP { |
| @@ -365,6 +367,13 @@ class MockSdk implements DartSdk { |
| provider.convertPath( |
| '$sdkRoot/lib/_internal/sdk_library_metadata/lib/libraries.dart'), |
| librariesContent); |
| + if (buildSummaries) { |
| + List<int> bytes = _computeLinkedBundleBytes(); |
| + provider.newFileWithBytes( |
| + provider.convertPath('/lib/_internal/spec.sum'), bytes); |
| + provider.newFileWithBytes( |
| + provider.convertPath('/lib/_internal/strong.sum'), bytes); |
| + } |
| } |
| @override |
| @@ -422,13 +431,7 @@ class MockSdk implements DartSdk { |
| @override |
| PackageBundle getLinkedBundle() { |
| if (_bundle == null) { |
| - List<Source> librarySources = sdkLibraries |
| - .map((SdkLibrary library) => mapDartUri(library.shortName)) |
| - .toList(); |
| - List<int> bytes = new SummaryBuilder( |
| - librarySources, context, context.analysisOptions.strongMode) |
| - .build(); |
| - _bundle = new PackageBundle.fromBuffer(bytes); |
| + _bundle = new PackageBundle.fromBuffer(_computeLinkedBundleBytes()); |
| } |
| return _bundle; |
| } |
| @@ -467,6 +470,18 @@ class MockSdk implements DartSdk { |
| String newContent = updateContent(content); |
| provider.updateFile(path, newContent); |
| } |
| + |
| + /** |
| + * Compute the bytes in the linked bundle associated with this SDK. |
|
scheglov
2016/12/02 01:15:52
"in the" -> "of the"?
Brian Wilkerson
2016/12/02 15:32:04
Done
|
| + */ |
| + List<int> _computeLinkedBundleBytes() { |
| + List<Source> librarySources = sdkLibraries |
| + .map((SdkLibrary library) => mapDartUri(library.shortName)) |
| + .toList(); |
| + return new SummaryBuilder( |
| + librarySources, context, context.analysisOptions.strongMode) |
| + .build(); |
| + } |
| } |
| class _MockSdkLibrary implements SdkLibrary { |