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

Unified Diff: pkg/analysis_server/test/mock_sdk.dart

Issue 2542853003: Create summary files in MockSdk classes (Closed)
Patch Set: Created 4 years 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
Index: pkg/analysis_server/test/mock_sdk.dart
diff --git a/pkg/analysis_server/test/mock_sdk.dart b/pkg/analysis_server/test/mock_sdk.dart
index acb2095fc0c39442962eed293fd83d9699eaa983..bd12211376a2e221f1820c5b83fc13ea93f45653 100644
--- a/pkg/analysis_server/test/mock_sdk.dart
+++ b/pkg/analysis_server/test/mock_sdk.dart
@@ -274,8 +274,15 @@ const Map<String, LibraryInfo> libraries = const {
LIBRARIES.forEach((SdkLibrary library) {
provider.newFile(library.path, (library as MockSdkLibrary).content);
});
- provider.newFile('/lib/_internal/sdk_library_metadata/lib/libraries.dart',
+ provider.newFile(
+ provider.convertPath(
+ '/lib/_internal/sdk_library_metadata/lib/libraries.dart'),
librariesContent);
+ List<int> bytes = _computeLinkedBundleBytes();
+ provider.newFileWithBytes(
+ provider.convertPath('/lib/_internal/spec.sum'), bytes);
+ provider.newFileWithBytes(
+ provider.convertPath('/lib/_internal/strong.sum'), bytes);
}
@override
@@ -341,13 +348,7 @@ const Map<String, LibraryInfo> libraries = const {
@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());
scheglov 2016/12/02 01:15:52 If we already have these bytes in the file system,
Brian Wilkerson 2016/12/02 15:32:04 Probably so, but when I tried to use the stored by
}
return _bundle;
}
@@ -383,6 +384,18 @@ const Map<String, LibraryInfo> libraries = const {
// table above.
return null;
}
+
+ /**
+ * Compute the bytes in the linked bundle associated with this SDK.
+ */
+ 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 {

Powered by Google App Engine
This is Rietveld 408576698