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

Unified Diff: pkg/analyzer/test/src/context/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 | « pkg/analysis_server/test/mock_sdk.dart ('k') | pkg/analyzer/test/src/summary/pub_summary_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45f6ef5bfb7d3b4c3c49f3f5ea9e91f27a0ea651..69e212eb9b8d9bfa8acb211787926323a18bd3d6 100644
--- a/pkg/analyzer/test/src/context/mock_sdk.dart
+++ b/pkg/analyzer/test/src/context/mock_sdk.dart
@@ -351,7 +351,7 @@ class MockSdk implements DartSdk {
PackageBundle _bundle;
MockSdk(
- {bool buildSummaries: true,
+ {bool generateSummaryFiles: false,
bool dartAsync: true,
resource.MemoryResourceProvider resourceProvider})
: provider = resourceProvider ?? new resource.MemoryResourceProvider(),
@@ -367,7 +367,7 @@ class MockSdk implements DartSdk {
provider.convertPath(
'$sdkRoot/lib/_internal/sdk_library_metadata/lib/libraries.dart'),
librariesContent);
- if (buildSummaries) {
+ if (generateSummaryFiles) {
List<int> bytes = _computeLinkedBundleBytes();
provider.newFileWithBytes(
provider.convertPath('/lib/_internal/spec.sum'), bytes);
@@ -431,7 +431,15 @@ class MockSdk implements DartSdk {
@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 | « pkg/analysis_server/test/mock_sdk.dart ('k') | pkg/analyzer/test/src/summary/pub_summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698