chromium/third_party/blink/web_tests/http/tests/security/local-CSS-from-remote.html

<html>
<head>
<script>
    function test() {
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        var localStyleSheetLocation = "file:///tmp/web_tests/http/tests/security/resources/cssStyle.css";
        if (window.testRunner)
            localStyleSheetLocation = testRunner.pathToLocalResource(localStyleSheetLocation);

        var localLinkElement = document.createElement("link");
        localLinkElement.setAttribute("type", "text/css");
        localLinkElement.setAttribute("rel", "stylesheet");
        localLinkElement.setAttribute("href", localStyleSheetLocation);

        document.documentElement.firstChild.appendChild(localLinkElement);

        // Unfortunately link tags do not have load events, so we cannot simply make a load handler.
        window.setTimeout(backgroundCheck, 1);
        window.setTimeout(function() {
            if (window.testRunner)
                testRunner.notifyDone();
        }, 5000);
    }

    function backgroundCheck() {
        var result = document.getElementById("result");
        var myBody = document.getElementById("myBody");
        var style = document.defaultView.getComputedStyle(myBody, null);
        var bgColor = style.getPropertyValue("background-color");
        if (bgColor[4] == 2) {
            result.innerHTML = "Test Failed: Local CSS remotely loaded.";
            window.setTimeout(backgroundCheck, 1);
        } else {
            result.innerHTML = "Test Passed: Local CSS not remotely loaded.";
            if (window.testRunner)
                testRunner.notifyDone();
        }
    }
</script>
</head>
<body id="myBody" onload="test()">
    <div id="other">
        This test is to see if a remote file can include a local CSS style.
        <br/>
        Currently this test cannot be run manually on Windows because we do not have
        a function like pathToLocalResource() outside of DRT.
        <br/>
        <br/>
        If the background is yellow then the CSS was loaded.
    </div>
    </br>
    <div id="result">
        Test not run correctly.
    </div>
</body>
</html>