<script>
var count = 0;

function setTitle() {
  // document.title reports the DOM page visibility and RAF count.
  document.title = document.visibilityState + ' ' + count++;

  if (!window.ready)
    setTimeout(setReady, count > 10 ? 0 : 100);
}

document.addEventListener('visibilitychange', setTitle);

(function changeTitle() {
  window.requestAnimationFrame(changeTitle);
  setTitle();
})();

function setReady() {
  if (!window.ready)
    sendReady();
  window.ready = true;
}

function sendReady() {
  if (window.domAutomationController) {
    domAutomationController.setAutomationId(1);
    domAutomationController.send("READY");
  }
}
</script>

<script>
if (window.domAutomationController) {
  domAutomationController.setAutomationId(1);
  domAutomationController.send("READY");
}
</script>

Remove RAF driven setTitle code from tab-restore-visibility.html
Remove RAF driven setTitle code from tab-restore-visibility.html

tab-restore-visibility.html is used by tab visiblity tests:
  - SessionRestoreTest.RestoredTabsHaveCorrectVisibilityState
  - BrowserTabRestoreTest.DelegateRestoreTabDisposition
  - BrowserTabRestoreTest.RecentTabsMenuTabDisposition

The test updates the document title via RAF on each animation frame. When
updating the title takes longer than a single animation frame, this could
thrash the web page and it would never finish loading [1]. Remove the RAF
driven setTitle code to avoid thrashing. It is sufficent for the test page to
send a "READY" message though to domAutomationController once the page is ready
(running javascript) for tab visibility testing.

[1] https://codereview.chromium.org/797723010/#msg7

BUG=414527

Review URL: https://codereview.chromium.org/797723010

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#312527}
