1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Code shared by some of the visibility tests. Maintains a list of
6 // visibility states, starting with the state when this file was loaded.
7 // New states are added on each visibility change event.
9 // Array of previously observed visibility states.
10 var visibilityStates
= [document
.visibilityState
];
12 // Array of previously observed hidden values.
13 var hiddenValues
= [document
.hidden
];
15 // Record all visibility changes in corresponding arrays.
16 function onVisibilityChange(event
) {
17 visibilityStates
.push(document
.visibilityState
);
18 hiddenValues
.push(document
.hidden
);
21 document
.addEventListener("visibilitychange",