<head>
<script src="../../../resources/js-test-pre.js"></script>
<script>
description("Tests that the mute API implementation works as expected. This test needs to be run through WebKitTestRunner.");

jsTestIsAsync = true;

function createTestPlugin(testName)
{
    var plugin = document.createElement("embed");
    plugin.type = "application/x-webkit-test-netscape";
    plugin.setAttribute('test', testName);

    return plugin;
}

function runTest()
{
    if (!window.testRunner) {
        debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
        return;
    }

    plugin1 = createTestPlugin('set-muted');
    document.body.appendChild(plugin1);

    shouldBeFalse("plugin1.isMuted");
    shouldBeFalse("plugin1.cachedIsMuted");

    // Now set page to be muted.
    if (window.internals)
        window.internals.setPageMuted(true);

    shouldBeTrue("plugin1.isMuted");
    shouldBeTrue("plugin1.cachedIsMuted");

    plugin2 = createTestPlugin('set-muted');
    document.body.appendChild(plugin2);
    shouldBeTrue("plugin2.isMuted");
    shouldBeTrue("plugin2.cachedIsMuted");
    
    finishJSTest();
}
</script>
<script src="../../../resources/js-test-post.js"></script>
</head>
<body onload="runTest()">
</body>
