<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="style-src 'none'; script-src 'unsafe-inline'">
<script>
if (window.testRunner)
    testRunner.dumpAsText();
</script>
</head>
<body>
<p>Tests that the CSS style of an element, in a user agent shadow tree, can be modified via the HTML style attribute when the page has CSP policy: <code>style-src 'none'</code>.</p>
<div id="shadow-host"></div>
<pre id="console"></pre>
<script>
function log(message)
{
    document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}

function runTest()
{
    if (!window.testRunner || !window.internals)
        return;

    var userAgentShadowRoot = internals.ensureUserAgentShadowRoot(document.getElementById("shadow-host"));
    var div = document.createElement("div");
    userAgentShadowRoot.appendChild(div);

    var expectedColor = "green";
    div.setAttribute("style", "background-color: " + expectedColor);

    if (div.style.backgroundColor === expectedColor)
        log("PASS modified CSS style of element.");
    else
        log("FAIL background-style of element should be " + expectedColor + ". Was " + div.style.backgroundColor + ".");
}

runTest();
</script>
</body>
</html>
