Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / search-disabled-readonly.html
blob955b3cf44c1ed45682218bf22689552f96ffa911
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/common.js"></script>
6 </head>
7 <body>
8 <input id="search_input" type="search" />
9 <div id="console">
10 <p>
11 This tests the behavior of a cancel button in search input forms.
12 </p>
13 </div>
14 <script>
15 function click(position) {
16 if (!eventSender)
17 return;
18 eventSender.mouseMoveTo(position.x, position.y);
19 eventSender.mouseDown();
20 eventSender.mouseMoveTo(position.x, position.y);
21 eventSender.mouseUp();
22 eventSender.leapForward(1000);
25 function keydown(character) {
26 if (!eventSender)
27 return;
28 eventSender.keyDown(character);
29 eventSender.leapForward(1000);
32 function setInputAttributes(input, value, disabled, readonly) {
33 input.value = value;
34 input.disabled = disabled;
35 input.readOnly = !!readonly;
38 if (window.testRunner) {
39 var input = $("search_input");
40 var cancelButtonPosition = searchCancelButtonPosition(input);
41 var middleButtonPosition = {};
42 middleButtonPosition.x = input.offsetLeft + input.offsetWidth / 2;
43 middleButtonPosition.y = input.offsetTop + input.offsetHeight / 2;
44 var enabled = false;
45 var disabled = true;
46 var readonly = true;
48 debug("Test on the input form with disabled=false and readonly=false");
50 setInputAttributes(input, "foo", enabled);
51 debug("Click the cancel button:");
52 click(cancelButtonPosition);
53 shouldBe('input.value', '""');
54 debug("... and then input one character:");
55 keydown("b");
56 shouldBe('input.value', '"b"');
58 setInputAttributes(input, "foo", enabled);
59 debug("Click the center of the form:");
60 click(middleButtonPosition);
61 shouldBe('input.value', '"foo"');
62 debug("... and then input one character:");
63 keydown("b");
64 shouldBe('input.value', '"foob"');
66 debug("");
67 debug("Test on the input form with disabled=false and readonly=true");
69 setInputAttributes(input, "foo", enabled, readonly);
70 debug("Click the cancel button:");
71 click(cancelButtonPosition);
72 shouldBe('input.value', '"foo"');
73 debug("... and then input one character:");
74 keydown("b");
75 shouldBe('input.value', '"foo"');
77 setInputAttributes(input, "foo", enabled, readonly);
78 debug("Click the center of the form:");
79 click(middleButtonPosition);
80 shouldBe('input.value', '"foo"');
81 debug("... and then input one character:");
82 keydown("b");
83 shouldBe('input.value', '"foo"');
85 debug("");
86 debug("Test on the input form with disabled=true and readonly=false");
88 setInputAttributes(input, "foo", disabled);
89 debug("Click the cancel button:");
90 click(cancelButtonPosition);
91 shouldBe('input.value', '"foo"');
92 debug("... and then input one character:");
93 keydown("b");
94 shouldBe('input.value', '"foo"');
96 setInputAttributes(input, "foo", disabled);
97 debug("Click the center of the form:");
98 click(middleButtonPosition);
99 shouldBe('input.value', '"foo"');
100 debug("... and then input one character:");
101 keydown("b");
102 shouldBe('input.value', '"foo"');
104 debug("");
105 debug("Test on the input form with disabled=true and readonly=true");
107 setInputAttributes(input, "foo", disabled, readonly);
108 debug("Click the cancel button:");
109 click(cancelButtonPosition);
110 shouldBe('input.value', '"foo"');
111 debug("... and then input one character:");
112 keydown("b");
113 shouldBe('input.value', '"foo"');
115 setInputAttributes(input, "foo", disabled, readonly);
116 debug("Click the center of the form:");
117 click(middleButtonPosition);
118 shouldBe('input.value', '"foo"');
119 debug("... and then input one character:");
120 keydown("b");
121 shouldBe('input.value', '"foo"');
123 debug("");
125 </script>
126 </body>
127 </html>