<pre id="console"></pre>
<script>
    function log(message)
    {
        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
    }

    if (window.testRunner) {
        testRunner.dumpAsText();
        var canvas1 = document.createElement("canvas");
        var context1 = canvas1.getContext("2d");

        testRunner.waitUntilDone();
        testRunner.setBackingScaleFactor(2, function() {
            var canvas2 = document.createElement("canvas");
            var context2 = canvas2.getContext("2d");

            log ("context1.webkitBackingStorePixelRatio is " + context1.webkitBackingStorePixelRatio);
            log ("context2.webkitBackingStorePixelRatio is " + context2.webkitBackingStorePixelRatio);

            testRunner.notifyDone();
        });
    } else {
        log ("When not run inside DumpRenderTree or WebKitTestRunner, this test just prints the value of");
        log ("backingStorePixelRatio. Please verify that it matches what you expect, based on the");
        log ("current configuration.\n");
        var canvas = document.createElement("canvas");
        var context = canvas.getContext("2d");
        log ("context.webkitBackingStorePixelRatio is " + context.webkitBackingStorePixelRatio);
    }
</script>
