3 This test checks the visibility API when a prerendered page is displayed.
6 <title>Prerender Visibility
</title>
8 <script src=
"prerender_visibility_shared.js"></script>
11 // Checks that no visibility change events have occurred, current visibility
12 // state is "prerender", and visibility state while the page was loading was
14 function DidPrerenderPass() {
15 return visibilityStates
.length
== 1 &&
16 hiddenValues
.length
== 1 &&
17 visibilityStates
[0] == 'prerender' &&
18 hiddenValues
[0] == true &&
19 document
.visibilityState
== 'prerender' &&
20 document
.hidden
== true;
23 // Checks that we've only had three visibility states:
24 // prerender -> hidden -> visible.
25 // Also checks current visibility state.
26 function DidDisplayPass() {
27 return visibilityStates
.length
== 3 &&
28 hiddenValues
.length
== 3 &&
29 visibilityStates
[1] == 'hidden' &&
30 hiddenValues
[1] == true &&
31 visibilityStates
[2] == 'visible' &&
32 hiddenValues
[2] == false &&
33 document
.visibilityState
== 'visible' &&
34 document
.hidden
== false;