2 <body onload="startTest()">
4 <script src="../js/resources/js-test-pre.js"></script>
8 description("This test checks that an iframe that moves between pages with different visibility will have the correct visibility value.");
10 var jsTestIsAsync = true;
13 var numVisibilityChanges = 0;
15 function window2Loaded() {
16 debug("Window 2 Loaded");
18 iframe = window2.document.getElementById("iframe");
20 shouldBeFalse("window.document.webkitHidden");
21 shouldBeFalse("window2.document.webkitHidden");
22 shouldBeFalse("iframe.contentDocument.webkitHidden");
24 // Change the visibility of the current page to invisible.
25 if (window.layoutTestController) {
26 numVisibilityChanges++;
27 window.layoutTestController.setPageVisibility("hidden");
31 function onVisibilityChange() {
32 shouldBeTrue("window.document.webkitHidden");
33 shouldBeFalse("window2.document.webkitHidden");
34 shouldBeFalse("iframe.contentDocument.webkitHidden");
36 window.document.adoptNode(iframe);
37 window.document.body.appendChild(iframe);
38 debug("Adopted iframe to Window 1");
40 shouldBeTrue("window.document.webkitHidden");
41 shouldBeFalse("window2.document.webkitHidden");
42 shouldBeTrue("iframe.contentDocument.webkitHidden");
49 function startTest() {
50 if (window.layoutTestController) {
51 layoutTestController.waitUntilDone();
52 layoutTestController.setCanOpenWindows();
55 debug("Window 1 Loaded");
56 document.addEventListener("webkitvisibilitychange",
57 onVisibilityChange, false);
59 window2 = window.open("resources/page-visibility-iframe-move-new-page.html");
60 window2.addEventListener("load", window2Loaded, false);
63 function finishTest() {
64 if (window.layoutTestController) {
65 layoutTestController.resetPageVisibility();
72 <script src="../js/resources/js-test-post.js"></script>