WebKitTools:
[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 </script>
35 </head>
36 <body id="myBody" onload="backgroundCheck()">
37     <div id="other">
38         This test is to see if a remote file can include a local user stylesheet.
39         <br />
40         To run this test manually you must set your user style sheet in your Safari preferences
41         to LayoutTests/http/tests/security/resources/cssStyle.css
42         <br/>
43         If the background is yellow then the user stylesheet was loaded.
44     </div>
45     </br>
46     <div id="result">
47         Test not run correctly.
48     </div>
49 </body>
50 </html>