<!DOCTYPE html>
<html>
  <head>
    <script src="resources/webgl-test-utils.js"> </script>
    <script>
    function runTest()
    {
      if (sessionStorage.count == 10) {
        delete sessionStorage.count;
        if (window.testRunner)
          testRunner.notifyDone();
      } else {
        var canvas = document.getElementById('webgl-canvas');
        var gl = WebGLTestUtils.create3DContext(canvas);
        gl.clearColor(1, 0, 0, 1);
        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

        canvas.width = canvas.clientWidth;
        canvas.height = canvas.clientHeight;

        if (!sessionStorage.count)
          sessionStorage.count = 0;
        sessionStorage.count++;

        setTimeout(function() { location.reload(); }, 0);
      }
    }
    if (window.testRunner) {
      testRunner.dumpAsText();
      testRunner.waitUntilDone();
    }

    window.onpageshow = runTest;
    </script>
  </head>
  <body>
    <div>PASS. You didn't crash.</div>
    <canvas id="webgl-canvas" width="100px" height="100px"></canvas>
  </body>
</html>

