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

Side by Side Diff: chrome/test/data/prerender/prerender_visibility_hidden_quick.html

Issue 8392041: Prerendered tabs use the same SessionStorage namespace as the tab that triggered the prerender. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove check Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <!--
3 This test checks the visibility API when a prerendered page is visited without
4 being displayed, before the page has finished loading.
5 -->
6 <head>
7 <title>Prerender Visibility Hidden Quick Switch</title>
8
9 <script>
10 // Checks visibility state while the page is still loading.
11 var lastState = document.webkitVisibilityState;
12 var loadingStatePassed = document.webkitHidden && lastState != 'visible';
13 var unexpectedStateChange = false;
14
15 function onVisibilityChange(event) {
16 if (lastState == 'hidden' ||
17 document.webkitVisibilityState != 'hidden') {
18 unexpectedStateChange = true;
19 return;
20 }
21 lastState = document.webkitVisibilityState;
22 }
23
24 document.addEventListener('webkitvisibilitychange',
25 onVisibilityChange,
26 false);
27
28 // Checks that either the first visibility state was 'prerender' and there
29 // was one and only one visibility change event to 'hidden', or visibility
30 // was always 'hidden'.
31 function DidDisplayPass() {
32 return loadingStatePassed &&
33 !unexpectedStateChange &&
34 'hidden' == document.webkitVisibilityState &&
35 document.webkitHidden;
36 }
37 </script>
38
39 </head>
40 <body></body>
41 </html>
42 <html>
43 <!--
44 This test checks the visibility API when a prerendered page is visited without
45 being displayed, before the page has finished loading.
46 -->
47 <head>
48 <title>Prerender Visibility Hidden Quick Switch</title>
49
50 <script>
51 // Checks visibility state while the page is still loading.
52 var lastState = document.webkitVisibilityState;
53 var loadingStatePassed = document.webkitHidden && lastState != 'visible';
54 var unexpectedStateChange = false;
55
56 function onVisibilityChange(event) {
57 if (lastState == 'hidden' ||
58 document.webkitVisibilityState != 'hidden') {
59 unexpectedStateChange = true;
60 return;
61 }
62 lastState = document.webkitVisibilityState;
63 }
64
65 document.addEventListener('webkitvisibilitychange',
66 onVisibilityChange,
67 false);
68
69 // Checks that either the first visibility state was 'prerender' and there
70 // was one and only one visibility change event to 'hidden', or visibility
71 // was always 'hidden'.
72 function DidDisplayPass() {
73 return loadingStatePassed &&
74 !unexpectedStateChange &&
75 'hidden' == document.webkitVisibilityState &&
76 document.webkitHidden;
77 }
78 </script>
79
80 </head>
81 <body></body>
82 </html>
OLDNEW
« no previous file with comments | « chrome/test/data/prerender/prerender_visibility_hidden.html ('k') | chrome/test/data/webui/net_internals/prerender_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698