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/page-visibility | |
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/page-visibility')
12 files changed, 787 insertions, 0 deletions
diff --git a/testing/web-platform/tests/page-visibility/OWNERS b/testing/web-platform/tests/page-visibility/OWNERS new file mode 100644 index 000000000..56997198b --- /dev/null +++ b/testing/web-platform/tests/page-visibility/OWNERS @@ -0,0 +1,3 @@ +@plehegar +@igrigorik +@toddreifsteck diff --git a/testing/web-platform/tests/page-visibility/idlharness.html b/testing/web-platform/tests/page-visibility/idlharness.html new file mode 100644 index 000000000..c8086a1bc --- /dev/null +++ b/testing/web-platform/tests/page-visibility/idlharness.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Page Visibility IDL tests</title> +<link rel="author" title="W3C" href="http://www.w3.org/" /> +<link rel="help" href="http://www.w3.org/TR/page-visibility/#sec-document-interface"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/WebIDLParser.js"></script> +<script src="/resources/idlharness.js"></script> +</head> +<body> +<h1>Page Visibility IDL tests</h1> + +<pre id='untested_idl' style='display:none'> +interface Document { +}; +</pre> + +<pre id='idl'> +enum VisibilityState { "hidden", "visible", "prerender", "unloaded" }; + +partial interface Document { + readonly attribute boolean hidden; + readonly attribute VisibilityState visibilityState; +}; +</pre> + +<script> + +(function() { + var idl_array = new IdlArray(); + + idl_array.add_untested_idls(document.getElementById("untested_idl").textContent); + idl_array.add_idls(document.getElementById("idl").textContent); + + idl_array.add_objects({Document: ["window.document"]}); + + idl_array.test(); +})(); + +</script> + +<div id="log"></div> + +</body> +</html> diff --git a/testing/web-platform/tests/page-visibility/resources/blank_page_green.html b/testing/web-platform/tests/page-visibility/resources/blank_page_green.html new file mode 100644 index 000000000..b8a1947b7 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/blank_page_green.html @@ -0,0 +1,10 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Green Test Page</title> + </head> + <body style="background-color:#00FF00;"> + <h1>Placeholder</h1> + </body> +</html> diff --git a/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js b/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js new file mode 100644 index 000000000..d53d73b42 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js @@ -0,0 +1,121 @@ +/* +Distributed under both the W3C Test Suite License [1] and the W3C +3-clause BSD License [2]. To contribute to a W3C Test Suite, see the +policies and contribution forms [3]. + +[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license +[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license +[3] http://www.w3.org/2004/10/27-testcases +*/ + +// +// Helper Functions for PageVisibility W3C tests +// +var VISIBILITY_STATES = +{ + HIDDEN: "hidden", + VISIBLE: "visible" +}; + +var feature_check = false; + +// +// All test() functions in the WebPerf PageVis test suite should use pv_test() instead. +// +// pv_test() validates the document.hidden and document.visibilityState attributes +// exist prior to running tests and immediately shows a failure if they do not. +// + +function pv_test(func, msg, doc) +{ + if (!doc) + { + doc = document; + } + + // only run the feature check once, unless func == null, in which case, + // this call is intended as a feature check + if (!feature_check) + { + feature_check = true; + + var hiddenVal = doc.hidden; + var visStateVal = doc.visibilityState; + + // show a single error that the Page Visibility feature is undefined + test(function() + { + assert_true(hiddenVal !== undefined && hiddenVal != null, + "document.hidden is defined and not null.");}, + "document.hidden is defined and not null."); + + test(function() + { + assert_true(visStateVal !== undefined && hiddenVal != null, + "document.visibilityState is defined and not null.");}, + "document.visibilityState is defined and not null."); + + } + + if (func) + { + test(func, msg); + } +} + + +function test_feature_exists(doc, msg) +{ + if (!msg) + { + msg = ""; + } + var hiddenMsg = "document.hidden is defined" + msg + "."; + var stateMsg = "document.visibilityState is defined" + msg + "."; + pv_test(function(){assert_true(document.hidden !== undefined, hiddenMsg);}, hiddenMsg, doc); + pv_test(function(){assert_true(document.visibilityState !== undefined, stateMsg);}, stateMsg, doc); +} + +// +// Common helper functions +// + +function test_true(value, msg) +{ + pv_test(function() { assert_true(value, msg); }, msg); +} + +function test_equals(value, equals, msg) +{ + pv_test(function() { assert_equals(value, equals, msg); }, msg); +} + +// +// asynchronous test helper functions +// + +function add_async_result(test_obj, pass_state) +{ + // add assertion to manual test for the pass state + test_obj.step(function() { assert_true(pass_state) }); + + // end manual test + test_obj.done(); +} + +function add_async_result_assert(test_obj, func) +{ + // add assertion to manual test for the pass state + test_obj.step(func); + + // end manual test + test_obj.done(); +} + +var open_link; +function TabSwitch() +{ + //var open_link = window.open("http://www.bing.com"); + open_link = window.open('', '_blank'); + setTimeout(function() { open_link.close(); }, 2000); +} diff --git a/testing/web-platform/tests/page-visibility/test_attributes_exist.html b/testing/web-platform/tests/page-visibility/test_attributes_exist.html new file mode 100644 index 000000000..748161fdf --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_attributes_exist.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Page Visibility API Definition</title> + + <script type="text/javascript" src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript" src="resources/pagevistestharness.js"></script> + </head> + <body> + <h1>Description</h1> + <p>This test validates that all of the attributes associated with the Page Visibility feature exist + (but does not validate that their values are correct).</p> + + <div id="log"></div> + + <script type="text/javascript" > + test_feature_exists(); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/page-visibility/test_child_document.html b/testing/web-platform/tests/page-visibility/test_child_document.html new file mode 100644 index 000000000..77ec8f8fd --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_child_document.html @@ -0,0 +1,94 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Page Visibility API Child Document Test</title> + + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript" src="resources/pagevistestharness.js"></script> + + <style type="text/css"> + iframe + { + width:250px; + height:250px; + margin-left:5px; + } + + div.docs + { + position:relative; + float:left; + text-align:center; + margin:10px; + border:solid 1px black; + padding:3px; + } + </style> + + <script type="text/javascript" > + setup({explicit_done: true}); + + function onload_test() + { + pv_test(); + + var frames = document.getElementsByTagName("iframe"); + var doc, doc_name; + + for (var i = 0; i < frames.length; i++) + { + doc = frames[i].contentDocument; + doc_name = "IFrame with " + frames[i].id; + + pv_test(function() + { + test_feature_exists(doc, " for frame with " + frames[i].id); + }); + + test_equals(doc.visibilityState, VISIBILITY_STATES.VISIBLE, + "document.visibilityState for frame with " + + frames[i].id + " == " + + VISIBILITY_STATES.VISIBLE); + } + + done(); + } + </script> + </head> + <body onload="onload_test()"> + <h1>Description</h1> + <p>This test validates that, within child documents, all of the Page Visibility API attributes exist, + are read-only, and match the value of the attributes within the parent document.</p> + + <div id="log"></div> + + <br/> + + <div class="docs"> + IFrame with no style attribute + <br/> + <iframe id="no style attribute" src="resources/blank_page_green.html"> + iframes unsupported + </iframe> + </div> + + <div class="docs"> + IFrame with "display:none" style<br/> + <iframe id="'display:none' style" style="display:none" + src="resources/blank_page_green.html"> + iframes unsupported + </iframe> + </div> + + <div class="docs"> + IFrame with "visibility:hidden" style + <br/> + <iframe id="'visibility:hidden' style" style="visibility:hidden" + src="resources/blank_page_green.html"> + iframes unsupported + </iframe> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/page-visibility/test_default_view.html b/testing/web-platform/tests/page-visibility/test_default_view.html new file mode 100644 index 000000000..6e2f97084 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_default_view.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Page Visibility Null Default View Test</title> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript" src="resources/pagevistestharness.js"></script> + + <script type="text/javascript" > + setup({explicit_done: true}); + + function onload_test() + { + // inject a windowless subdocument as a child of the root document <html> element + var subDoc = document.implementation.createDocument('resources/blank_page_green.html', 'html', null); + + // Test precondition: ensure subdocument has a null default view + test_true(subDoc.defaultView == null, "windowless subdocument generated for test has a null default view"); + + // check that feature exists within subdocument + test_feature_exists(subDoc, 'windowless subdocument'); + + // check that the subdocument has a hidden visibility state + test_true(subDoc.hidden, + "hidden == true for windowless subdocuments with a null default view"); + test_equals(subDoc.visibilityState, VISIBILITY_STATES.HIDDEN, + "visibilityState == " + VISIBILITY_STATES.HIDDEN + + " for windowless subdocuments with a null default view"); + + done(); + } + </script> + </head> + <body onload="onload_test()"> + <h1>Description</h1> + <p>This test validates that document.hidden == false and + document.visibilityState == "visible" for windowless subdocuments.</p> + <div id="log"></div> + </body> +</html> diff --git a/testing/web-platform/tests/page-visibility/test_minimize-manual.html b/testing/web-platform/tests/page-visibility/test_minimize-manual.html new file mode 100644 index 000000000..28e848676 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_minimize-manual.html @@ -0,0 +1,188 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Page Visibility API Operation While Minimizing Browser Window</title> + <meta name="flags" content="interact" /> + <script type="text/javascript" src="/resources/testharness.js"></script> + <script type="text/javascript" src="resources/pagevistestharness.js"></script> + + </head> + <body> + <h1>Description</h1> + <p>This test validates that the page properly becomes hidden and visible due to minimizing, maximizing, and + restoring the browser window.</p> + + <h1>Manual Test Steps:</h1> + <p> + <ol> + <li> Ensure this page is the foreground and click the "Start Test"</li> + <li> Minimize the browser</li> + <li> Restore or maximize the browser</li> + </ol> + Note: This test will automatically timeout and fail if not completed within 60 seconds. + </p> + + <button onclick="start_test();">Start Test</button> + + <div id="log"></div> + + <br /> + IFrame with default style: + <br /> + <iframe id="childDocShown" src="resources/blank_page_green.html"> + iframes unsupported + </iframe> + <hr /> + IFrame with "display:none" style: + <br /> + <iframe id="childDocHidden" src="resources/blank_page_green.html" style="display:none"> + iframes unsupported + </iframe> + + <script type="text/javascript" > + var child_doc_shown = null; + var child_doc_hidden = null; + var transition_mode; + var manual_test = null; + + var expected_notification_count = 2; + var notification_count = new Array(); + var page_docs = new Array(); + var notification_handlers = new Array(); + var two_notifications = false; + + var PAGE_HIDDEN_VAL = "hidden"; + var PAGE_VISIBLE_VAL = "visible"; + + setup({ explicit_done: true }); + + function test_transition_init() + { + child_doc_shown = document.getElementById("childDocShown").contentDocument; + child_doc_hidden = document.getElementById("childDocHidden").contentDocument; + + // fill in data for page documents + page_docs.push([document, "document"]); + page_docs.push([child_doc_shown, "document.getElementById(\"childDocShown\").contentDocument"]); + page_docs.push([child_doc_hidden, "document.getElementById(\"childDocHidden\").contentDocument"]); + + notification_handlers[0] = function(){ VerifyNotification(0); }; + notification_handlers[1] = function(){ VerifyNotification(1); }; + notification_handlers[2] = function(){ VerifyNotification(2); }; + + for (var i in page_docs) + { + notification_count[i] = 0; + page_docs[i][0].addEventListener("visibilitychange", notification_handlers[i]); + } + + test_true(!document.hidden, "Page is visible on load."); + test_true((!child_doc_shown.hidden) && (!child_doc_hidden.hidden), + "All IFrame child documents are visible on load."); + + document.addEventListener("visibilitychange", notification_handlers[0]); + document.addEventListener("visibilitychange", VerifyTwoNotifications); + + manual_test = AddManual("Browser minimization has occurred."); + } + + function VerifyNotification(doc_index) + { + doc = page_docs[doc_index][0]; + docName = page_docs[doc_index][1]; + + notification_count[doc_index]++; + switch (notification_count[doc_index]) + { + case 1: + // First step, check page visibility after tab deselection / minimization. + // hidden should change to true; visibilityState should change to "hidden" + test_true(doc.hidden, docName + ".hidden == true (after browser frame minimization)"); + test_true(doc.visibilityState == PAGE_HIDDEN_VAL, + docName + ".visibilityState == \"hidden\" (after browser frame minimization)"); + + break; + + case 2: + //Second step, check page visibility after tab reselection / maximization / restoration. + // hidden should change to false; visibilityState should change to "visible" + test_true(!doc.hidden, + docName + ".hidden == false (after browser frame maximization / restoration)"); + test_true(doc.visibilityState == PAGE_VISIBLE_VAL, + docName + ".visibilityState == \"visible\" (after browser frame maximization / " + + "restoration)"); + + // perform tests specific to the main document + if (doc == document) + { + //Verify that a second registration to a different callback also occurred + test_true(two_notifications, "Two registrations (different callbacks) occurred."); + + //Verify that a second registration to the same callback did not occur + test_equals(notification_count[doc_index], + expected_notification_count, + "Two registrations (same callback) did not occur."); + + // pass the manual item associated with these tests + AddManualResult(manual_test, true); + + document.removeEventListener("visibilitychange", VerifyTwoNotifications); + + // schedule the rollup + setTimeout(VerifyAllNotifications, 200); + } + + //Remove all event listeners and verify that the event does not fire + doc.removeEventListener("visibilitychange", notification_handlers[doc_index]); + break; + case 3: + //This step should not have occurred since the event handlers were cleared + test_true(false, "Event did not fire when event listener is removed."); + + //On final step, schedule the rollup + setTimeout(done, 2000); + break; + + default: + break; + } + } + + function VerifyAllNotifications() + { + //On final step, schedule the rollup + setTimeout(done, 1000); + } + + function VerifyTwoNotifications() + { + //This is a duplicate registration on visibilitychange and + //should never get fired. Check that duplicate_notification + //is false to verify that this never occurred. + two_notifications = true; + } + + // Manual Test helper functions + function AddManual(test) + { + // add asynchronous test for manual tests + return async_test(test); + } + + function AddManualResult(oManualTest, passState) + { + // add assertion to manual test for the pass state + oManualTest.step(function() {assert_true(passState)}); + + // end manual test + oManualTest.done(); + } + + function start_test() + { + test_transition_init(); + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/page-visibility/test_read_only.html b/testing/web-platform/tests/page-visibility/test_read_only.html new file mode 100644 index 000000000..6d3702292 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_read_only.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Page Visibility API is Read Only</title> + + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript" src="resources/pagevistestharness.js"></script> + + <script type="text/javascript"> + setup({ explicit_done: true }); + function onload_test() + { + //check for feature definition first before attempting to overwrite + pv_test(); + + //Check document.hidden + document.hidden = "new value"; + test_true(document.hidden !== "new value", 'document.hidden is read only.'); + + //Check document.visibilityState + document.visibilityState = "new value"; + test_true(document.visibilityState !== "new value", + "document.visibilityState is read only."); + + done(); + } + </script> + </head> + <body onload="onload_test();"> + <h1>Description</h1> + <p>This test validates that the Page Visibility attributes are read only.</p> + + <div id="log"></div> + </body> +</html> diff --git a/testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html b/testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html new file mode 100644 index 000000000..c701e5078 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html @@ -0,0 +1,186 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Page Visibility API Operation While Changing Tabs</title> + <meta name="flags" content="interact" /> + <script type="text/javascript" src="/resources/testharness.js"></script> + <script type="text/javascript" src="resources/pagevistestharness.js"></script> + + </head> + <body> + <h1>Description</h1> + <p>This test validates that the page properly becomes hidden and visible due to switching tabs.</p> + + <h1>Manual Test Steps:</h1> + <p> + <ol> + <li> Ensure this page is the foreground and click the "Start Test"</li> + <li> Switch to another tab</li> + <li> Return to the current tab containing this test page</li> + </ol> + Note: This test will automatically timeout and fail if not completed within 60 seconds. + </p> + + <button onclick="start_test();">Start Test</button> + + <div id="log"></div> + + <br /> + IFrame with default style: + <br /> + <iframe id="childDocShown" src="resources/blank_page_green.html"> + iframes unsupported + </iframe> + <hr /> + IFrame with "display:none" style: + <br /> + <iframe id="childDocHidden" src="resources/blank_page_green.html" style="display:none"> + iframes unsupported + </iframe> + + <script type="text/javascript" > + var child_doc_shown = null; + var child_doc_hidden = null; + var transition_mode; + var manual_test = null; + + var expected_notification_count = 2; + var notification_count = new Array(); + var page_docs = new Array(); + var notification_handlers = new Array(); + var two_notifications = false; + + var PAGE_HIDDEN_VAL = "hidden"; + var PAGE_VISIBLE_VAL = "visible"; + + setup({ explicit_done: true }); + + function test_transition_init() + { + child_doc_shown = document.getElementById("childDocShown").contentDocument; + child_doc_hidden = document.getElementById("childDocHidden").contentDocument; + + // fill in data for page documents + page_docs.push([document, "document"]); + page_docs.push([child_doc_shown, "document.getElementById(\"childDocShown\").contentDocument"]); + page_docs.push([child_doc_hidden, "document.getElementById(\"childDocHidden\").contentDocument"]); + + notification_handlers[0] = function(){ VerifyNotification(0); }; + notification_handlers[1] = function(){ VerifyNotification(1); }; + notification_handlers[2] = function(){ VerifyNotification(2); }; + + for (var i in page_docs) + { + notification_count[i] = 0; + page_docs[i][0].addEventListener("visibilitychange", notification_handlers[i]); + } + + test_true(!document.hidden, "Page is visible on load."); + test_true((!child_doc_shown.hidden) && (!child_doc_hidden.hidden), + "All IFrame child documents are visible on load."); + + document.addEventListener("visibilitychange", notification_handlers[0]); + document.addEventListener("visibilitychange", VerifyTwoNotifications); + + manual_test = AddManual("Browser tab switch has occurred."); + } + + function VerifyNotification(doc_index) + { + doc = page_docs[doc_index][0]; + docName = page_docs[doc_index][1]; + + notification_count[doc_index]++; + switch (notification_count[doc_index]) + { + case 1: + // First step, check page visibility after tab deselection / minimization. + // hidden should change to true; visibilityState should change to "hidden" + test_true(doc.hidden, docName + ".hidden == true (after tab switch)"); + test_true(doc.visibilityState == PAGE_HIDDEN_VAL, + docName + ".visibilityState == \"hidden\" (after tab switch)"); + + break; + + case 2: + //Second step, check page visibility after tab reselection / maximization / restoration. + // hidden should change to false; visibilityState should change to "visible" + test_true(!doc.hidden, + docName + ".hidden == false (after return to original tab)"); + test_true(doc.visibilityState == PAGE_VISIBLE_VAL, + docName + ".visibilityState == \"visible\" (after return to original tab)"); + + // perform tests specific to the main document + if (doc == document) + { + //Verify that a second registration to a different callback also occurred + test_true(two_notifications, "Two registrations (different callbacks) occurred."); + + //Verify that a second registration to the same callback did not occur + test_equals(notification_count[doc_index], + expected_notification_count, + "Two registrations (same callback) did not occur."); + + // pass the manual item associated with these tests + AddManualResult(manual_test, true); + + document.removeEventListener("visibilitychange", VerifyTwoNotifications); + + // schedule the rollup + setTimeout(VerifyAllNotifications, 200); + } + + //Remove all event listeners and verify that the event does not fire + doc.removeEventListener("visibilitychange", notification_handlers[doc_index]); + break; + case 3: + //This step should not have occurred since the event handlers were cleared + test_true(false, "Event did not fire when event listener is removed."); + + //On final step, schedule the rollup + setTimeout(done, 2000); + break; + + default: + break; + } + } + + function VerifyAllNotifications() + { + //On final step, schedule the rollup + setTimeout(done, 1000); + } + + function VerifyTwoNotifications() + { + //This is a duplicate registration on visibilitychange and + //should never get fired. Check that duplicate_notification + //is false to verify that this never occurred. + two_notifications = true; + } + + // Manual Test helper functions + function AddManual(test) + { + // add asynchronous test for manual tests + return async_test(test); + } + + function AddManualResult(oManualTest, passState) + { + // add assertion to manual test for the pass state + oManualTest.step(function() {assert_true(passState)}); + + // end manual test + oManualTest.done(); + } + + function start_test() + { + test_transition_init(); + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/page-visibility/unload-1.html b/testing/web-platform/tests/page-visibility/unload-1.html new file mode 100644 index 000000000..b54851878 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/unload-1.html @@ -0,0 +1,17 @@ +<!doctype html> +<html> +<head><title>Document</title></head> +<body> +<h1>Document</h1> +<script> +onload = function() { + document.addEventListener("visibilitychange", onVisibilityChange, false); + opener.postMessage("close", "*"); +} + +function onVisibilityChange() { + opener.postMessage(document.visibilityState, "*"); +} +</script> +</body> +</html> diff --git a/testing/web-platform/tests/page-visibility/unload.html b/testing/web-platform/tests/page-visibility/unload.html new file mode 100644 index 000000000..48cf203cd --- /dev/null +++ b/testing/web-platform/tests/page-visibility/unload.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>visibilitychange fires on unload</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function(t) { + var w = window.open("unload-1.html"); + window.onmessage = t.step_func(function(event) { + if (event.data === "close") { + w.close(); + return; + } + assert_equals(event.data, "hidden"); + t.done(); + }); +}); +</script> |