| <!DOCTYPE HTML> |
| <html> |
| <head> |
| <title>Example with iframe that consolidates tests via fetch_tests_from_window</title> |
| <script src="../../testharness.js"></script> |
| <script src="../../testharnessreport.js"></script> |
| <script> |
| var parent_test = async_test("Test executing in parent context"); |
| </script> |
| </head> |
| <body onload="parent_test.done()"> |
| <h1>Fetching Tests From a Child Context</h1> |
| <p>This test demonstrates the use of <tt>fetch_tests_from_window</tt> to pull |
| tests from an <tt>iframe</tt> into the primary document.</p> |
| <p>The test suite will not complete until tests in the child context have finished |
| executing</p> |
| <div id="log"></div> |
| |
| <iframe id="childContext" src="promise-async.html" style="display:none"></iframe> |
| <!-- promise-async.html has async tests with promises --> |
| |
| <script> |
| var childContext = document.getElementById("childContext"); |
| fetch_tests_from_window(childContext.contentWindow); |
| </script> |
| <script type="text/json" id="expected"> |
| { |
| "summarized_status": { |
| "status_string": "OK", |
| "message": null, |
| "stack": null |
| }, |
| "summarized_tests": [ |
| { |
| "status_string": "PASS", |
| "name": "Promise rejection", |
| "properties": {}, |
| "message": null, |
| "stack": null |
| }, |
| { |
| "status_string": "PASS", |
| "name": "Promise resolution", |
| "properties": {}, |
| "message": null, |
| "stack": null |
| }, |
| { |
| "status_string": "FAIL", |
| "name": "Promises and test assertion failures (should fail)", |
| "properties": {}, |
| "message": "assert_true: This failure is expected expected true got false", |
| "stack": "(implementation-defined)" |
| }, |
| { |
| "status_string": "PASS", |
| "name": "Promises are supported in your browser", |
| "properties": {}, |
| "message": null, |
| "stack": null |
| }, |
| { |
| "status_string": "PASS", |
| "name": "Promises resolution chaining", |
| "properties": {}, |
| "message": null, |
| "stack": null |
| }, |
| { |
| "status_string": "PASS", |
| "name": "Test executing in parent context", |
| "properties": {}, |
| "message": null, |
| "stack": null |
| }, |
| { |
| "status_string": "PASS", |
| "name": "Use of step_func with Promises", |
| "properties": {}, |
| "message": null, |
| "stack": null |
| }, |
| { |
| "status_string": "FAIL", |
| "name": "Use of unreached_func with Promises (should fail)", |
| "properties": {}, |
| "message": "assert_unreached: This failure is expected Reached unreachable code", |
| "stack": "(implementation-defined)" |
| } |
| ], |
| "type": "complete" |
| } |
| </script> |
| </body> |
| </html> |