blob: 1c1eab8215bc5386a3b1b39d73d65699174f0066 [file] [log] [blame]
<!DOCTYPE html>
<head>
<title>Cobalt preload state visibility test</title>
<script src='black_box_js_test_utils.js'></script>
</head>
<body>
<h1>
<span>ID element</span>
</h1>
<script>
// In preload mode, visibility should be "hidden" and window/document
// should not have focus.
assertEqual("hidden", document.visibilityState);
assertFalse(document.hasFocus());
// Wait for visibility change to verify visibilityState and having focus.
function handleVisibilityChange() {
assertEqual("visible", document.visibilityState);
assertFalse(document.hasFocus());
onEndTest();
}
document.addEventListener("visibilitychange", handleVisibilityChange);
setupFinished();
</script>
</body>