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

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

Issue 191223004: Add BaseTransform.consumePrimary to barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
Index: pkg/barback/test/transformer/mock.dart
diff --git a/pkg/barback/test/transformer/mock.dart b/pkg/barback/test/transformer/mock.dart
index 57d3f078644544760f1404be26f7d51f8183c282..413b5b0204893c01c09d0731bbf53533e4166467 100644
--- a/pkg/barback/test/transformer/mock.dart
+++ b/pkg/barback/test/transformer/mock.dart
@@ -56,6 +56,10 @@ abstract class MockTransformer extends Transformer {
/// that this is called.
Future<bool> get isRunning => schedule(() => _runningTransforms > 0);
+ /// If this is set to `true`, the transformer will consume its primary input
+ /// during [apply].
+ bool consumePrimary = false;
+
/// Pauses the schedule until this transformer begins running.
void waitUntilStarted() {
schedule(() => _started.future, "wait until $this starts");
@@ -176,6 +180,7 @@ abstract class MockTransformer extends Transformer {
_numRuns++;
if (_runningTransforms == 0) _started.complete();
_runningTransforms++;
+ if (consumePrimary) transform.consumePrimary();
return newFuture(() => doApply(transform)).then((_) {
if (_apply != null) return _apply.future;
}).whenComplete(() {

Powered by Google App Engine
This is Rietveld 408576698