<html>
  <!--
  This test checks that video tags created by javascript are are deferred
  during prerendering and the autoplay is enabled during swap ins.
  -->
<head>
<title>Prerender for HTML5 Media Source Video.</title>
</head>

<body>
<video id="mediaEl" autoplay controls></video>

<script>
  var willPlay = true;
  var testNetworkEvents = false;
</script>

<script src="prerender_html5_common.js"></script>

<script>

  function onSourceOpen(e) {
    var srcBuffer = mediaSource.addSourceBuffer('video/webm; codecs="vp8"');
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'bear-320x240-video-only.webm');
    xhr.responseType = 'arraybuffer';
    xhr.addEventListener('load', function(e) {
      srcBuffer.append(new Uint8Array(e.target.response));
      mediaSource.endOfStream();
    });
    xhr.send();
  }

  var mediaSource = new WebKitMediaSource();
  mediaSource.addEventListener('webkitsourceopen', onSourceOpen);
  mediaEl.src = window.URL.createObjectURL(mediaSource);
</script>

</body>
</html>

<html>
  <!--
  This test checks that video tags created by javascript are are deferred
  during prerendering and the autoplay is enabled during swap ins.
  -->
<head>
<title>Prerender for HTML5 Media Source Video.</title>
</head>

<body>
<video id="mediaEl" autoplay controls></video>

<script>
  var willPlay = true;
  var testNetworkEvents = false;
</script>

<script src="prerender_html5_common.js"></script>

<script>

  function onSourceOpen(e) {
    var srcBuffer = mediaSource.addSourceBuffer('video/webm; codecs="vp8"');
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'bear-320x240-video-only.webm');
    xhr.responseType = 'arraybuffer';
    xhr.addEventListener('load', function(e) {
      srcBuffer.appendBuffer(new Uint8Array(e.target.response));
      srcBuffer.addEventListener('updateend', function(e) {
        mediaSource.endOfStream();
      });
    });
    xhr.send();
  }

  var mediaSource = new MediaSource();
  mediaSource.addEventListener('sourceopen', onSourceOpen);
  mediaEl.src = window.URL.createObjectURL(mediaSource);
</script>

</body>
</html>

Fix prerender test to use unprefixed MediaSource API.
Fix prerender test to use unprefixed MediaSource API.

The prefixed MediaSource implementation is being removed
so this prerender test that depends on it needs to be
migrated to the unprefixed API.

BUG=363444
TEST=PrerenderBrowserTest.PrerenderHTML5MediaSourceVideo

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@264274 0039d316-1c4b-4281-b951-d872f2087c98
