| <body> |
| <div id=logdiv></div> |
| <script> |
| if (window.internals) { |
| internals.settings.setVideoPlaybackRequiresUserGesture(false); |
| internals.settings.setRequiresUserGestureToLoadVideo(false); |
| } |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| const random = Math.floor(Math.random()*10000000000); |
| |
| function loadTestMedia() { |
| return new Promise((resolve) => { |
| const media = document.createElement("video"); |
| media.src = `/resources/test.mp4?${random}`; |
| media.oncanplaythrough = () => resolve(media); |
| media.autoplay = true; |
| document.body.appendChild(media); |
| }); |
| } |
| |
| function logResponses(media) |
| { |
| const ranges = internals.mediaResponseContentRanges(media); |
| const sources = internals.mediaResponseSources(media); |
| for (i = 0; i < Math.min(2, ranges.length); ++i) |
| logdiv.innerHTML += `Content range: ${ranges[i]}, Response source: ${sources[i]}<br>`; |
| } |
| |
| async function test() { |
| logdiv.innerHTML += "First load<br>"; |
| logResponses(await loadTestMedia()); |
| |
| logdiv.innerHTML += "Second Load<br>"; |
| logResponses(await loadTestMedia()); |
| |
| testRunner.notifyDone(); |
| } |
| |
| test(); |
| </script> |