Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE HTML>
<html>
<head>
<title>Example with iframe that consolidates errors via fetch_tests_from_window</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/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 is expected to fail due to an unhandled exception in the
child context.</p>
<div id="log"></div>
<iframe id="childContext" src="uncaught-exception-handle.html" style="display:none"></iframe>
<!-- apisample4.html is a failing suite due to an unhandled Error. -->
<script>
var childContext = document.getElementById("childContext");
fetch_tests_from_window(childContext.contentWindow);
</script>
<script type="text/json" id="expected">
{
"summarized_status": {
"status_string": "ERROR",
"message": "Error in remote: Error: Example Error"
},
"summarized_tests": [
{
"status_string": "PASS",
"name": "Test executing in parent context",
"properties": {},
"message": null
},
{
"status_string": "NOTRUN",
"name": "This should show a harness status of 'Error' and a test status of 'Not Run'",
"properties": {},
"message": null
}
],
"type": "complete"
}
</script>
</body>
</html>