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

Unified Diff: pkg/barback/test/transformer/check_content_and_rename.dart

Issue 223553008: Only pass an AssetId to isPrimary and declareOutputs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix script_compactor Created 6 years, 8 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/barback/test/transformer/check_content.dart ('k') | pkg/barback/test/transformer/create_asset.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/test/transformer/check_content_and_rename.dart
diff --git a/pkg/barback/test/transformer/check_content_and_rename.dart b/pkg/barback/test/transformer/check_content_and_rename.dart
index a923911311637245b7feb7830eded9d2e660e8da..9fcdebb6c0e50a9b14c5280fc30e36afb6d10c26 100644
--- a/pkg/barback/test/transformer/check_content_and_rename.dart
+++ b/pkg/barback/test/transformer/check_content_and_rename.dart
@@ -21,15 +21,17 @@ class CheckContentAndRenameTransformer extends MockTransformer {
CheckContentAndRenameTransformer(this.oldExtension, this.oldContent,
this.newExtension, this.newContent);
- Future<bool> doIsPrimary(Asset asset) {
- if (asset.id.extension != '.$oldExtension') return new Future.value(false);
- return asset.readAsString().then((value) => value == oldContent);
- }
+ Future<bool> doIsPrimary(AssetId id) =>
+ new Future.value(id.extension != '.$oldExtension');
Future doApply(Transform transform) {
return getPrimary(transform).then((input) {
- transform.addOutput(new Asset.fromString(
- input.id.changeExtension('.$newExtension'), newContent));
+ return input.readAsString().then((contents) {
+ if (contents != oldContent) return;
+
+ transform.addOutput(new Asset.fromString(
+ input.id.changeExtension('.$newExtension'), newContent));
+ });
});
}
}
« no previous file with comments | « pkg/barback/test/transformer/check_content.dart ('k') | pkg/barback/test/transformer/create_asset.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698