Skip media source tests since the feature is not enabled on Windows.
[WebKit-https.git] / LayoutTests / fast / forms / input-autofilled.html
1 <html>
2 <head>
3     <script src="../../resources/js-test-pre.js"></script>
4     <script>
5     function test() {
6         if (window.testRunner) {
7             testRunner.dumpAsText();
8         }
9
10         var tf = document.getElementById('tf');
11         var computedStyle = document.defaultView.getComputedStyle(tf);
12         var originalForeground = computedStyle.color;
13         var originalBackground = computedStyle.backgroundColor;
14
15         if (window.internals) {
16             window.internals.setAutofilled(tf, true);
17         }
18
19         // Both the foreground and background colors should change.
20         computedStyle = document.defaultView.getComputedStyle(tf);
21         var autofilledForeground = computedStyle.color;
22         var autofilledBackground = computedStyle.backgroundColor;
23         if (autofilledForeground == originalForeground) {
24             testFailed('Foreground color did not change when autofilled.');
25             return;
26         }
27         if (autofilledBackground == originalBackground) {
28             testFailed('Background color did not change when autofilled.');
29             return;
30         }
31
32         if (window.internals) {
33             window.internals.setAutofilled(tf, false);
34         }
35
36         // Colors should be restored.
37         computedStyle = document.defaultView.getComputedStyle(tf);
38         if (computedStyle.color != originalForeground) {
39             testFailed('Foreground color did not revert when un-autofilled.');
40             return;
41         }
42         if (computedStyle.backgroundColor != originalBackground) {
43             testFailed('Background color did not revert when un-autofilled.');
44             return;
45         }
46
47         testPassed('');
48     }
49     </script>
50
51     <style>
52     #tf {
53       color: #FFFFFF;
54       background-color: #FFFFFF;
55     }
56     </style>
57 </head>
58 <body onload="test()">
59     This tests that foreground and background colors properly change for autofilled inputs.  It can only be run using DumpRenderTree.<br>
60     <form name="fm">
61         <input type="text" id="tf" value="Field value" />
62     </form>
63     <div id="console"></div>
64 </body>
65 </html>