<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="initial-scale=1">
<title>Video Context Loss Test</title>
<style type="text/css">
.nomargin {
margin: 0px auto;
}
</style>
<script>
var video;
var QueryString = function() {
var params = {};
var r = /([^&=]+)=?([^&]*)/g;
function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
var match;
while (match = r.exec(window.location.search.substring(1)))
params[d(match[1])] = d(match[2]);
return params;
}();
function CrashGpuProcess() {
video.removeEventListener('canplaythrough', CrashGpuProcess, false);
var canvas = document.createElement('canvas');
var gl = canvas.getContext('webgl');
var tickle = setInterval(function() { gl.getParameter(gl.VERSION); }, 250);
canvas.addEventListener('webglcontextlost', function(e) {
clearInterval(tickle);
video.addEventListener('ended', function(e) {
domAutomationController.send('SUCCESS');
}, false);
video.play();
}, false);
chrome.gpuBenchmarking.crashGpuProcess();
}
function Main() {
video = document.getElementById('video');
video.addEventListener('canplaythrough', CrashGpuProcess, false);
video.addEventListener('error', function(e) {
console.log('Video playback failed: ' + e.code + ', "' + e.message + '"');
domAutomationController.send('ERROR');
}, false);
video.poster = 'single_face.jpg';
video.preload = 'metadata';
video.src = QueryString.src;
}
</script>
</head>
<body onload="Main()">
<div id="container" style="position:absolute; top:0px; left:0px">
<video class="nomargin" id="video" width="240" height="135"></video>
</div>
</body>
</html>