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

Unified Diff: lib/src/utils.dart

Issue 971103002: Add BrowserManager and IframeTest for communicating with browser tests. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Fix errors Created 5 years, 10 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 | « lib/src/runner/browser/iframe_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 6b0939fe5ccf805bcf9ffb33e5e9d86b045eb1c1..a1199bcd583894bb94bb6406be404ab506d712ec 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -63,3 +63,13 @@ List flatten(Iterable nested) {
helper(nested);
return result;
}
+
+/// Returns a sink that maps events sent to [original] using [fn].
+StreamSink mapSink(StreamSink original, fn(event)) {
+ var controller = new StreamController(sync: true);
+ controller.stream.listen(
+ (event) => original.add(fn(event)),
+ onError: (error, stackTrace) => original.addError(error, stackTrace),
+ onDone: () => original.close());
+ return controller.sink;
+}
« no previous file with comments | « lib/src/runner/browser/iframe_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698