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

Side by Side Diff: LayoutTests/fast/events/page-visibility-transition-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 Page Visibility state values are correct and the event changes are fired correctly."); 11 description("This test checks that Page Visibility state values are correct and the event changes are fired correctly.");
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 shouldBeEqualToString("document.webkitVisibilityState", "visible"); 26 shouldBeEqualToString("document.webkitVisibilityState", "visible");
27 shouldBeTrue("document.webkitIsVisible"); 27 shouldBeFalse("document.webkitHidden");
28 } 28 }
29 29
30 function checkIsPageHidden() { 30 function checkIsPageHidden() {
31 shouldBeEqualToString("document.webkitVisibilityState", "hidden"); 31 shouldBeEqualToString("document.webkitVisibilityState", "hidden");
32 shouldBeFalse("document.webkitIsVisible"); 32 shouldBeTrue("document.webkitHidden");
33 } 33 }
34 34
35 // We will try to change the visibility states as: 35 // We will try to change the visibility states as:
36 // 0 - visible. (Initial - i.e. on load). 36 // 0 - visible. (Initial - i.e. on load).
37 // 1 - hidden (should fire event). 37 // 1 - hidden (should fire event).
38 // 2 - hidden (no event). 38 // 2 - hidden (no event).
39 // 3 - visible (should fire event). 39 // 3 - visible (should fire event).
40 var numVisibilityChanges = 0; 40 var numVisibilityChanges = 0;
41 41
42 function startTest() { 42 function startTest() {
43 document.addEventListener( 43 document.addEventListener(
44 "webkitvisibilitystatechange", onVisibilityChange, false); 44 "webkitvisibilitychange", onVisibilityChange, false);
45 checkIsPageVisible(); 45 checkIsPageVisible();
46 numVisibilityChanges++; 46 numVisibilityChanges++;
47 makePageHidden(); 47 makePageHidden();
48 } 48 }
49 49
50 function finishTest() { 50 function finishTest() {
51 if (window.layoutTestController) { 51 if (window.layoutTestController) {
52 layoutTestController.resetPageVisibility(); 52 layoutTestController.resetPageVisibility();
53 } 53 }
54 finishJSTest(); 54 finishJSTest();
(...skipping 25 matching lines...) Expand all
80 } 80 }
81 81
82 var successfullyParsed = true; 82 var successfullyParsed = true;
83 83
84 </script> 84 </script>
85 85
86 <script src="../js/resources/js-test-post.js"></script> 86 <script src="../js/resources/js-test-post.js"></script>
87 87
88 </body> 88 </body>
89 </html> 89 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698