diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/resources/examples/apisample12.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/resources/examples/apisample12.html')
-rw-r--r-- | testing/web-platform/tests/resources/examples/apisample12.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resources/examples/apisample12.html b/testing/web-platform/tests/resources/examples/apisample12.html new file mode 100644 index 000000000..785d57b2b --- /dev/null +++ b/testing/web-platform/tests/resources/examples/apisample12.html @@ -0,0 +1,67 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>Example with iframe that notifies containing document via cross document messaging</title> +<script src="../testharness.js"></script> +<script src="../testharnessreport.js"></script> +</head> +<body> +<h1>Notifications From Tests Running In An IFRAME</h1> +<p>A test is run inside an <tt>iframe</tt> with a same origin document. The +containing document should receive messages via <tt>postMessage</tt>/ +<tt>onmessage</tt> as the tests progress inside the <tt>iframe</tt>. A single +passing test is expected in the summary below. +</p> +<div id="log"></div> + +<script> +var t = async_test("Containing document receives messages"); +var start_received = false; +var result_received = false; +var completion_received = false; + +// These are the messages that are expected to be seen while running the tests +// in the IFRAME. +var expected_messages = [ + t.step_func( + function(message) { + assert_equals(message.data.type, "start"); + assert_own_property(message.data, "properties"); + }), + + t.step_func( + function(message) { + assert_equals(message.data.type, "test_state"); + assert_equals(message.data.test.status, message.data.test.NOTRUN); + }), + + t.step_func( + function(message) { + assert_equals(message.data.type, "result"); + assert_equals(message.data.test.status, message.data.test.PASS); + }), + + t.step_func( + function(message) { + assert_equals(message.data.type, "complete"); + assert_equals(message.data.tests.length, 1); + assert_equals(message.data.tests[0].status, + message.data.tests[0].PASS); + assert_equals(message.data.status.status, message.data.status.OK); + t.done(); + }), + + t.unreached_func("Too many messages received") +]; + +on_event(window, + "message", + function(message) { + var handler = expected_messages.shift(); + handler(message); + }); +</script> +<iframe src="apisample6.html" style="display:none"> + <!-- apisample6 implements a file_is_test test. --> +</iframe> +</body> |