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

Unified Diff: tests/html/js_interop_1_test.dart

Issue 12040059: Converting tests over to using event streams. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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: tests/html/js_interop_1_test.dart
diff --git a/tests/html/js_interop_1_test.dart b/tests/html/js_interop_1_test.dart
index 3d63ac1be7b0ef2216cea965bda0b9205c94eebe..3bf095174740239a91dc491a6f9821586840b0ca 100644
--- a/tests/html/js_interop_1_test.dart
+++ b/tests/html/js_interop_1_test.dart
@@ -19,15 +19,16 @@ main() {
var callback;
test('js-to-dart-post-message', () {
- var onSuccess = expectAsync1((e) {
- window.on.message.remove(callback);
- });
- callback = (e) {
- if (e.data == 'hello') {
- onSuccess(e);
- }
- };
- window.on.message.add(callback);
+ var subscription = null;
+ var complete = false;
+ subscription = window.onMessage.listen(expectAsyncUntil1(
+ (e) {
+ if (e.data == 'hello') {
+ subscription.cancel();
+ complete = true;
+ }
+ },
+ () => complete));
injectSource("window.postMessage('hello', '*');");
});
}

Powered by Google App Engine
This is Rietveld 408576698