<html>
<head>
<title>User Stylesheet Test</title>
<script type="text/javascript">
    if (window.testRunner) {
        testRunner.dumpAsText();

        // This won't work outside of DRT!
        if (window.location.hash == '') {
            testRunner.waitUntilDone();
            var stylesheetLocation = testRunner.pathToLocalResource("file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css");
            testRunner.setUserStyleSheetLocation(stylesheetLocation);
            testRunner.setUserStyleSheetEnabled(true);
            location += '?#done';
        }
    }

    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 Passed: Local user stylesheet loaded.";
        } else {
            result.innerHTML = "Test Failed: Local user stylesheet not loaded into remote document.";
        }

        if (window.testRunner) {
            testRunner.setUserStyleSheetEnabled(false);
            testRunner.notifyDone();
        }
    }
</script>
</head>
<body id="myBody" onload="backgroundCheck()">
    <div id="other">
        This test is to see if a remote file can include a local user stylesheet.
        <br />
        To run this test manually you must set your user style sheet in your Safari preferences
        to LayoutTests/http/tests/security/resources/cssStyle.css
        <br/>
        If the background is yellow then the user stylesheet was loaded.
    </div>
    </br>
    <div id="result">
        Test not run correctly.
    </div>
</body>
</html>
