Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: LayoutTests/fast/events/page-visibility-iframe-move-test.html

Issue 7065057: Merge 87802 - 2011-06-01 Shishir Agrawal <shishir@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <body onload="startTest()"> 2 <body onload="startTest()">
3 3
4 <p id="description"></p> 4 <p id="description"></p>
5 <div id="console"></div> 5 <div id="console"></div>
6 6
7 <script src="../js/resources/js-test-pre.js"></script> 7 <script src="../js/resources/js-test-pre.js"></script>
8 8
9 <script> 9 <script>
10 10
11 description("This test checks that an iframe that moves between pages with diffe rent visibility will have the correct visibility value."); 11 description("This test checks that an iframe that moves between pages with diffe rent visibility will have the correct visibility value.");
12 12
13 var jsTestIsAsync = true; 13 var jsTestIsAsync = true;
14 14
15 var window2, iframe; 15 var window2, iframe;
16 var numVisibilityChanges = 0; 16 var numVisibilityChanges = 0;
17 17
18 function window2Loaded() { 18 function window2Loaded() {
19 debug("Window 2 Loaded"); 19 debug("Window 2 Loaded");
20 20
21 iframe = window2.document.getElementById("iframe"); 21 iframe = window2.document.getElementById("iframe");
22 22
23 shouldBeTrue("window.document.webkitIsVisible"); 23 shouldBeFalse("window.document.webkitHidden");
24 shouldBeTrue("window2.document.webkitIsVisible"); 24 shouldBeFalse("window2.document.webkitHidden");
25 shouldBeTrue("iframe.contentDocument.webkitIsVisible"); 25 shouldBeFalse("iframe.contentDocument.webkitHidden");
26 26
27 // Change the visibility of the current page to invisible. 27 // Change the visibility of the current page to invisible.
28 if (window.layoutTestController) { 28 if (window.layoutTestController) {
29 numVisibilityChanges++; 29 numVisibilityChanges++;
30 window.layoutTestController.setPageVisibility("hidden"); 30 window.layoutTestController.setPageVisibility("hidden");
31 } 31 }
32 } 32 }
33 33
34 function onVisibilityChange() { 34 function onVisibilityChange() {
35 shouldBeFalse("window.document.webkitIsVisible"); 35 shouldBeTrue("window.document.webkitHidden");
36 shouldBeTrue("window2.document.webkitIsVisible"); 36 shouldBeFalse("window2.document.webkitHidden");
37 shouldBeTrue("iframe.contentDocument.webkitIsVisible"); 37 shouldBeFalse("iframe.contentDocument.webkitHidden");
38 38
39 window.document.adoptNode(iframe); 39 window.document.adoptNode(iframe);
40 window.document.body.appendChild(iframe); 40 window.document.body.appendChild(iframe);
41 debug("Adopted iframe to Window 1"); 41 debug("Adopted iframe to Window 1");
42 42
43 shouldBeFalse("window.document.webkitIsVisible"); 43 shouldBeTrue("window.document.webkitHidden");
44 shouldBeTrue("window2.document.webkitIsVisible"); 44 shouldBeFalse("window2.document.webkitHidden");
45 shouldBeFalse("iframe.contentDocument.webkitIsVisible"); 45 shouldBeTrue("iframe.contentDocument.webkitHidden");
46 46
47 window2.close(); 47 window2.close();
48 48
49 finishTest(); 49 finishTest();
50 } 50 }
51 51
52 function startTest() { 52 function startTest() {
53 if (window.layoutTestController) { 53 if (window.layoutTestController) {
54 layoutTestController.waitUntilDone(); 54 layoutTestController.waitUntilDone();
55 layoutTestController.setCanOpenWindows(); 55 layoutTestController.setCanOpenWindows();
56 } 56 }
57 57
58 debug("Window 1 Loaded"); 58 debug("Window 1 Loaded");
59 document.addEventListener("webkitvisibilitystatechange", 59 document.addEventListener("webkitvisibilitychange",
60 onVisibilityChange, false); 60 onVisibilityChange, false);
61 61
62 window2 = window.open("resources/page-visibility-iframe-move-new-page.html") ; 62 window2 = window.open("resources/page-visibility-iframe-move-new-page.html") ;
63 window2.addEventListener("load", window2Loaded, false); 63 window2.addEventListener("load", window2Loaded, false);
64 } 64 }
65 65
66 function finishTest() { 66 function finishTest() {
67 if (window.layoutTestController) { 67 if (window.layoutTestController) {
68 layoutTestController.resetPageVisibility(); 68 layoutTestController.resetPageVisibility();
69 } 69 }
70 finishJSTest(); 70 finishJSTest();
71 } 71 }
72 72
73 var successfullyParsed = true; 73 var successfullyParsed = true;
74 74
75 </script> 75 </script>
76 76
77 <script src="../js/resources/js-test-post.js"></script> 77 <script src="../js/resources/js-test-post.js"></script>
78 78
79 </body> 79 </body>
80 </html> 80 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698