Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / tab-restore-visibilty.html
1 <script>
2 var count = 0;
3
4 function setTitle() {
5   // document.title reports the DOM page visibility and RAF count.
6   document.title = document.visibilityState + ' ' + count++;
7
8   if (!window.ready)
9     setTimeout(setReady, count > 10 ? 0 : 100);
10 }
11
12 document.addEventListener('visibilitychange', setTitle);
13
14 (function changeTitle() {
15   window.requestAnimationFrame(changeTitle);
16   setTitle();
17 })();
18
19 function setReady() {
20   if (!window.ready)
21     sendReady();
22   window.ready = true;
23 }
24
25 function sendReady() {
26   if (window.domAutomationController) {
27     domAutomationController.setAutomationId(1);
28     domAutomationController.send("READY");
29   }
30 }
31 </script>