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', '*');"); |
}); |
} |