This test ensures that a focus ring is drawn.
<canvas id="canvas" class="output" width="30" height="30">
    <button id="button1"></button>
</canvas>
<div id="console"></div>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

var button1 = document.getElementById("button1");
var canvas = document.getElementById("canvas").getContext("2d");
canvas.beginPath();
canvas.rect(10, 10, 10, 10);
canvas.drawFocusIfNeeded(button1);
var imagedata = canvas.getImageData(0, 0, 30, 30);
var total = 0;
for(var x = 0; x < 30 * 30 * 4; x++)
    total += imagedata.data[x];

if (total != 0)
    document.getElementById("console").innerHTML = "TEST PASSED";
else
{
    button1.focus();
    canvas.drawFocusIfNeeded(button1);
    imagedata = canvas.getImageData(0, 0, 30, 30);
    for(var x = 0; x < 30 * 30* 4; x++)
        total += imagedata.data[x];

    if (total != 0)
        document.getElementById("console").innerHTML = "TEST PASSED";
    else
        document.getElementById("console").innerHTML = "TEST FAILED";
}
</script>
