<!DOCTYPE html>

<html>
<head>
    <style>
        body {
            height: 2000px;
            width: 2000px;
        }
    </style>
    <script src="../../resources/js-test-pre.js"></script>
    <script>
        description("Test that uiController.zoomToScale() works.");

        window.jsTestIsAsync = true;

        function doAfterZooming()
        {
            shouldBe('internals.pageScaleFactor()', '2');
            finishJSTest();
        }
        
        function getUIScript()
        {
            return `(function() {
                uiController.zoomToScale(2, function() {
                    uiController.uiScriptComplete(uiController.zoomScale);
                });
            })();`;
        }

        function doTest()
        {
            if (window.testRunner)
                testRunner.runUIScript(getUIScript(), function(zoomScale) {
                    doAfterZooming();
                })
        }
        
        window.addEventListener('load', doTest, false);
    </script>
</head>
<body>
    <script src="../../resources/js-test-post.js"></script>
</body>
</html>
