1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43

content / test / data / gpu / functional_blank.html [blame]

<head>
<script>
let useAlternateContent = false;

let sz = 2;
let color = 255;

function tick() {
  let canvas = document.getElementById('canvas');
  let c = canvas.getContext('2d');
  if (useAlternateContent) {
    let fillStyle = 'rgba(' + color + ',0,0,1.0)';
    c.fillStyle = fillStyle;
    --color;
  } else {
    c.fillStyle = 'rgba(255,255,255,1.0)';
  }
  useAlternateContent = !useAlternateContent;
  c.fillRect(0, 0, sz, sz);
  setTimeout(tick, 1000);
}

function main() {
  if (window.domAutomationController) {
    domAutomationController.send("SUCCESS");
  }

  let canvas = document.getElementById('canvas');
  canvas.width = sz;
  canvas.height = sz;

  // This page is used in the main tab in a couple of dual-GPU tests
  // on macOS. When running on the passthrough command decoder and
  // ANGLE, ANGLE can only detect the need to switch GPUs upon context
  // switch. Schedule a small amount of periodic rasterization work so
  // that context switches occur in the GPU process.
  setTimeout(tick, 1000);
}
</script>
</head>
<body onload="main()">
<canvas id="canvas"></canvas>
</body>