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

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

Issue 2547953002: Only generate summaries in tests when necessary (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
« no previous file with comments | « no previous file | 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/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 587215de730438e57f3173be34f0603c35e642e7..3286a091f75a844ddacceb7b638efbb5dc4431ca 100644
--- a/pkg/analysis_server/test/mock_sdk.dart
+++ b/pkg/analysis_server/test/mock_sdk.dart
@@ -269,7 +269,9 @@ const Map<String, LibraryInfo> libraries = const {
*/
PackageBundle _bundle;
- MockSdk({resource.ResourceProvider resourceProvider})
+ MockSdk(
+ {bool generateSummaryFiles: false,
+ resource.ResourceProvider resourceProvider})
: provider = resourceProvider ?? new resource.MemoryResourceProvider() {
LIBRARIES.forEach((SdkLibrary library) {
provider.newFile(library.path, (library as MockSdkLibrary).content);
@@ -278,11 +280,13 @@ const Map<String, LibraryInfo> libraries = const {
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);
+ if (generateSummaryFiles) {
+ List<int> bytes = _computeLinkedBundleBytes();
+ provider.newFileWithBytes(
+ provider.convertPath('/lib/_internal/spec.sum'), bytes);
+ provider.newFileWithBytes(
+ provider.convertPath('/lib/_internal/strong.sum'), bytes);
+ }
}
@override
@@ -348,7 +352,15 @@ const Map<String, LibraryInfo> libraries = const {
@override
PackageBundle getLinkedBundle() {
if (_bundle == null) {
- _bundle = new PackageBundle.fromBuffer(_computeLinkedBundleBytes());
+ resource.File summaryFile =
+ provider.getFile(provider.convertPath('/lib/_internal/spec.sum'));
+ List<int> bytes;
+ if (summaryFile.exists) {
+ bytes = summaryFile.readAsBytesSync();
+ } else {
+ bytes = _computeLinkedBundleBytes();
+ }
+ _bundle = new PackageBundle.fromBuffer(bytes);
}
return _bundle;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698