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

Side by Side Diff: LayoutTests/fast/events/page-visibility-iframe-propagation-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> 2 <body>
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 Page Visibility state events are propagated t o child frames."); 11 description("This test checks that Page Visibility state events are propagated t o child frames.");
12 12
13 var jsTestIsAsync = true; 13 var jsTestIsAsync = true;
14 14
15 function makePageVisible() { 15 function makePageVisible() {
16 if (window.layoutTestController) 16 if (window.layoutTestController)
17 layoutTestController.setPageVisibility("visible"); 17 layoutTestController.setPageVisibility("visible");
18 } 18 }
19 19
20 function makePageHidden() { 20 function makePageHidden() {
21 if (window.layoutTestController) 21 if (window.layoutTestController)
22 layoutTestController.setPageVisibility("hidden"); 22 layoutTestController.setPageVisibility("hidden");
23 } 23 }
24 24
25 function checkIsPageVisible() { 25 function checkIsPageVisible() {
26 debug("Main Page:"); 26 debug("Main Page:");
27 shouldBeEqualToString("document.webkitVisibilityState", "visible"); 27 shouldBeEqualToString("document.webkitVisibilityState", "visible");
28 shouldBeTrue("document.webkitIsVisible"); 28 shouldBeFalse("document.webkitHidden");
29 } 29 }
30 30
31 function checkIsPageHidden() { 31 function checkIsPageHidden() {
32 debug("Main Page:"); 32 debug("Main Page:");
33 shouldBeEqualToString("document.webkitVisibilityState", "hidden"); 33 shouldBeEqualToString("document.webkitVisibilityState", "hidden");
34 shouldBeFalse("document.webkitIsVisible"); 34 shouldBeTrue("document.webkitHidden");
35 } 35 }
36 36
37 function checkIsChildFrameVisible() { 37 function checkIsChildFrameVisible() {
38 debug("Child Frame:"); 38 debug("Child Frame:");
39 shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState", 39 shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState",
40 "visible"); 40 "visible");
41 shouldBeTrue("childFrame.contentDocument.webkitIsVisible"); 41 shouldBeFalse("childFrame.contentDocument.webkitHidden");
42 } 42 }
43 43
44 function checkIsChildFrameHidden() { 44 function checkIsChildFrameHidden() {
45 debug("Child Frame:"); 45 debug("Child Frame:");
46 shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState", 46 shouldBeEqualToString("childFrame.contentDocument.webkitVisibilityState",
47 "hidden"); 47 "hidden");
48 shouldBeFalse("childFrame.contentDocument.webkitIsVisible"); 48 shouldBeTrue("childFrame.contentDocument.webkitHidden");
49 } 49 }
50 50
51 // We will try to change the visibility states as: 51 // We will try to change the visibility states as:
52 // 0 - visible. (Initial - i.e. on load). 52 // 0 - visible. (Initial - i.e. on load).
53 // 1 - hidden 53 // 1 - hidden
54 // 2 - visible 54 // 2 - visible
55 var numVisibilityChanges = 0; 55 var numVisibilityChanges = 0;
56 56
57 var childFrame; 57 var childFrame;
58 58
59 function startTest() { 59 function startTest() {
60 childFrame = document.getElementById("childFrame"); 60 childFrame = document.getElementById("childFrame");
61 childFrame.contentDocument.addEventListener( 61 childFrame.contentDocument.addEventListener(
62 "webkitvisibilitystatechange", onChildFrameVisibilityChange, false); 62 "webkitvisibilitychange", onChildFrameVisibilityChange, false);
63 document.addEventListener("webkitvisibilitystatechange", 63 document.addEventListener("webkitvisibilitychange",
64 onVisibilityChange, false); 64 onVisibilityChange, false);
65 65
66 checkIsPageVisible(); 66 checkIsPageVisible();
67 checkIsChildFrameVisible(); 67 checkIsChildFrameVisible();
68 68
69 numVisibilityChanges++; 69 numVisibilityChanges++;
70 makePageHidden(); 70 makePageHidden();
71 } 71 }
72 72
73 var numFinishes = 0; 73 var numFinishes = 0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 var successfullyParsed = true; 117 var successfullyParsed = true;
118 118
119 </script> 119 </script>
120 120
121 <script src="../js/resources/js-test-post.js"></script> 121 <script src="../js/resources/js-test-post.js"></script>
122 122
123 <iframe id="childFrame" onload="startTest()"></iframe> 123 <iframe id="childFrame" onload="startTest()"></iframe>
124 </body> 124 </body>
125 </html> 125 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698