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

Unified Diff: pkg/barback/test/package_graph/transform_test.dart

Issue 20625005: Support an additional edge case in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/lib/src/transform_node.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/test/package_graph/transform_test.dart
diff --git a/pkg/barback/test/package_graph/transform_test.dart b/pkg/barback/test/package_graph/transform_test.dart
index 26132587c8c396f37ecb7fee8bfcd5f81ae2d763..670848a50d81358d6e4bce2c0eb814e27279f322 100644
--- a/pkg/barback/test/package_graph/transform_test.dart
+++ b/pkg/barback/test/package_graph/transform_test.dart
@@ -432,6 +432,80 @@ main() {
});
});
+ test("restarts processing if a change to a new secondary input occurs during "
+ "processing", () {
+ var transformer = new ManyToOneTransformer("txt");
+ initGraph({
+ "app|foo.txt": "bar.inc",
+ "app|bar.inc": "bar"
+ }, {"app": [[transformer]]});
+
+ transformer.pauseApply();
+
+ updateSources(["app|foo.txt", "app|bar.inc"]);
+ // Wait for the transform to start.
+ schedule(() => transformer.started);
+
+ // Give the transform time to load bar.inc the first time.
+ schedule(pumpEventQueue);
+
+ // Now update the secondary input before the transform finishes.
+ modifyAsset("app|bar.inc", "baz");
+ schedule(() => updateSources(["app|bar.inc"]));
+ // Give bar.inc enough time to be loaded and marked available before the
+ // transformer completes.
+ schedule(pumpEventQueue);
+
+ schedule(transformer.resumeApply);
+
+ expectAsset("app|foo.out", "baz");
+ buildShouldSucceed();
+
+ schedule(() {
+ expect(transformer.numRuns, equals(2));
+ });
+ });
+
+ test("doesn't restart processing if a change to an old secondary input "
+ "occurs during processing", () {
+ var transformer = new ManyToOneTransformer("txt");
+ initGraph({
+ "app|foo.txt": "bar.inc",
+ "app|bar.inc": "bar",
+ "app|baz.inc": "baz"
+ }, {"app": [[transformer]]});
+
+ updateSources(["app|foo.txt", "app|bar.inc", "app|baz.inc"]);
+ expectAsset("app|foo.out", "bar");
+ buildShouldSucceed();
+
+ schedule(transformer.pauseApply);
+ modifyAsset("app|foo.txt", "baz.inc");
+ schedule(() {
+ updateSources(["app|foo.txt"]);
+ // Wait for the transform to start.
+ return transformer.started;
+ });
+
+ // Now update the old secondary input before the transform finishes.
+ modifyAsset("app|bar.inc", "new bar");
+ schedule(() => updateSources(["app|bar.inc"]));
+ // Give bar.inc enough time to be loaded and marked available before the
+ // transformer completes.
+ schedule(pumpEventQueue);
+
+ schedule(transformer.resumeApply);
+
+ expectAsset("app|foo.out", "baz");
+ buildShouldSucceed();
+
+ schedule(() {
+ // Should have run once the first time, then again when switching to
+ // baz.inc. Should not run a third time because of bar.inc being modified.
+ expect(transformer.numRuns, equals(2));
+ });
+ });
+
test("handles an output moving from one transformer to another", () {
// In the first run, "shared.out" is created by the "a.a" transformer.
initGraph({
« no previous file with comments | « pkg/barback/lib/src/transform_node.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698