LayoutTests:
[WebKit-https.git] / LayoutTests / http / tests / security / local-user-CSS-from-remote.html
1 <html>
2     <head>
3         <title>User Stylesheet Test</title>
4         <script type="text/javascript">
5             if (window.layoutTestController) {
6                 layoutTestController.dumpAsText();
7
8                 // This won't work outside of DRT!
9                 if (window.location.hash == '') {
10                     layoutTestController.waitUntilDone();
11                     layoutTestController.setUserStyleSheetLocation("file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css");
12                     layoutTestController.setUserStyleSheetEnabled(true);
13                     location += '?#done';
14                 }
15             }
16
17             function backgroundCheck() {
18                 var result = document.getElementById("result");
19                 var myBody = document.getElementById("myBody");
20                 
21                 var style = document.defaultView.getComputedStyle(myBody, null);
22                 var bgColor = style.getPropertyValue("background-color");
23                 if (bgColor[4] == 2) {
24                     result.innerHTML = "Test Passed: Local user stylesheet loaded.";
25                 } else {
26                     result.innerHTML = "Test Failed: Local user stylesheet not loaded into remote document.";
27                 }
28
29                 if (window.layoutTestController) {
30                     layoutTestController.setUserStyleSheetEnabled(false);
31                     layoutTestController.notifyDone();
32                 }
33
34             }
35         </script>
36     </head>
37     <body id="myBody" onload="backgroundCheck()">
38         <div id="other">
39             This test is to see if a remote file can include a local user stylesheet.
40             <br />
41             To run this test manually you must set your user style sheet in your Safari preferences
42             to LayoutTests/http/tests/security/resources/cssStyle.css
43             <br/>
44             If the background is yellow then the user stylesheet was loaded.
45         </div>
46         </br>
47         <div id="result">
48             Test not run correctly.
49         </div>
50     </body>
51 </html>