Chromium Code Reviews| Index: LayoutTests/fast/events/touch/gesture/gesture-tap-down-special-elements.html |
| diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-down-special-elements.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-special-elements.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3be9f5a6e4ba96214a0e31c619a2f7a610bd984f |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-special-elements.html |
| @@ -0,0 +1,206 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../../../../resources/js-test.js"></script> |
| +<style> |
| +#box { |
| + width: 300px; |
| + height: 50px; |
| +} |
| + |
| +#overflowBox { |
| + width: 300px; |
| + height: 600px; |
| +} |
| + |
| +#container { |
| + width: 300px; |
| + height: 50px; |
| + overflow-y: scroll; |
| + overflow-x: hidden; |
| + margin: 10px 0 10px 0; |
| +} |
| + |
| +#frame { |
| + width: 200px; |
| + height: 50px; |
| +} |
| + |
| +.interactive { background-color: blue; } |
| + |
| +.interactive:hover { background-color: red; } |
| + |
| +.interactive:active { background-color: green; } |
| + |
| +.interactive:hover:active { background-color: yellow; } |
| + |
| +</style> |
| +</head> |
| +<body onload="runTests()"> |
| + |
| +<select id="combobox" class="interactive"> |
| + <option value="1"> One </option> |
| + <option value="2"> Two </option> |
| + <option value="3"> Three </option> |
| + <option value="4"> Four </option> |
| + <option value="5"> Five </option> |
| + <option value="6"> Six </option> |
| + <option value="7"> Sever </option> |
| + <option value="8"> Eight </option> |
| + <option value="9"> Nine </option> |
| + <option value="10"> Ten </option> |
| + <option value="11"> Eleven </option> |
| + <option value="12"> Twelve </option> |
| + <option value="13"> Thirteen </option> |
| + <option value="14"> Fourteen </option> |
| + <option value="15"> Fifteen </option> |
| + <option value="16"> Sixteen </option> |
| + <option value="17"> Seventeen </option> |
| + <option value="18"> Eighteen </option> |
| + <option value="19"> Nineteen </option> |
| + <option value="20"> Twenty </option> |
| +</select> |
| + |
| +<select id="listbox" class="interactive" multiple="5"> |
| + <option value="1"> One </option> |
| + <option value="2"> Two </option> |
| + <option value="3"> Three </option> |
| + <option value="4"> Four </option> |
| + <option value="5"> Five </option> |
| + <option value="6"> Six </option> |
| + <option value="7"> Sever </option> |
| + <option value="8"> Eight </option> |
| + <option value="9"> Nine </option> |
| + <option value="10"> Ten </option> |
| +</select> |
| + |
| +<input type="text" id="textbox" class="interactive" value="The input element represents a typed data field, usually with a form control to allow the user to edit the data."/> |
| + |
| +<textarea id="textarea" class="interactive" rows="3"> |
| +The textarea element represents a multiline plain text edit control for the element's raw value. The contents of the control represent the control's default value. |
| + |
| +The raw value of a textarea control must be initially the empty string. |
| +</textarea> |
| + |
| +<iframe id="frame" src="resources/gesture-tap-down-iframe.html"></iframe> |
| + |
| +<p id="description"></p> |
| +<p>See http://crbug.com/316974 for details</p> |
| + |
| +<div id="console" style="clear:both; float: left"></div> |
| + |
| +<script> |
| +if (window.internals) { |
| + internals.settings.setViewportEnabled(true); |
| + internals.settings.setViewportMetaEnabled(true); |
| +} |
| + |
| +var color; |
| + |
| +function isBoxOfColor(e, givenColor) |
| +{ |
| + color = window.getComputedStyle(e).backgroundColor; |
| + if (color == givenColor) |
| + return true; |
| + |
| + testFailed('Box had backgroundColor: ' + color); |
| + return false; |
| +} |
| + |
| +function isBoxHoverActive(id) |
|
Rick Byers
2014/03/13 01:40:06
there's a bunch of copy-paste here from the other
Zeeshan Qureshi
2014/03/24 21:37:43
Done in separate CL: http://crrev.com/197923006
|
| +{ |
| + var e = document.getElementById(id); |
| + return isBoxOfColor(e, "rgb(255, 255, 0)"); |
| +} |
| + |
| +function isBoxDefault(id) |
| +{ |
| + var e = document.getElementById(id); |
| + return isBoxOfColor(e, "rgb(0, 0, 255)"); |
| +} |
| + |
| +function isFrameDefault() |
| +{ |
| + var e = document.getElementById('frame').contentDocument.body; |
| + return isBoxOfColor(e, "rgb(0, 0, 255)"); |
| +} |
| + |
| +function elementCenter(id) { |
| + var e = document.getElementById(id); |
| + return { |
| + x: e.offsetLeft + e.offsetWidth / 2, |
| + y: e.offsetTop + e.offsetHeight / 2 |
| + } |
| +} |
| + |
| +description("Tests gesture tapdown behaviour on different form elements."); |
| + |
| +function runTests() |
| +{ |
| + if (!window.eventSender) { |
| + debug('This test requires DRT.'); |
| + return; |
| + } |
| + |
| + if (!eventSender.gestureTapDown |
| + || !eventSender.gestureShowPress) { |
| + debug('Gesture events are not supported by this platform'); |
| + return; |
| + } |
| + |
| + // Insert meta tag after viewport has been enabled via internals |
| + var meta = document.createElement('meta'); |
| + meta.name = 'viewport'; |
| + meta.content = 'width=device-width, initial-scale=1, user-scalable=no'; |
| + document.head.appendChild(meta); |
| + |
| + var combobox = elementCenter("combobox"); |
| + debug("Scroll and Pinch are disabled on the page"); |
| + debug("Verify hover, active aren't initially set"); |
| + shouldBeTrue("isBoxDefault('combobox')"); |
| + eventSender.gestureTapDown(combobox.x, combobox.y); |
| + debug("combobox should always be activated on tapdown"); |
|
Rick Byers
2014/03/13 01:40:06
why? Is this something your CL changed, or has it
Zeeshan Qureshi
2014/03/24 21:37:43
A <select> tag with just 1 selectable item will ne
Rick Byers
2014/03/25 19:46:47
Why do you say "1 selectable item"? This combobox
|
| + shouldBeTrue("isBoxHoverActive('combobox')"); |
| + eventSender.gestureShowPress(combobox.x, combobox.y); |
|
Rick Byers
2014/03/13 01:40:06
should you check it's state after showPress too?
Zeeshan Qureshi
2014/03/24 21:37:43
Yes, just to make sure it's maintained.
|
| + eventSender.gestureTapCancel(combobox.x, combobox.y); |
| + |
| + var listbox = elementCenter("listbox"); |
| + debug("Verify hover, active aren't initially set"); |
| + shouldBeTrue("isBoxDefault('listbox')"); |
| + eventSender.gestureTapDown(listbox.x, listbox.y); |
| + debug("Overflow listbox should remain unchanged"); |
|
Rick Byers
2014/03/13 01:40:06
why? Does it change after showPress?
Zeeshan Qureshi
2014/03/24 21:37:43
See below.
|
| + shouldBeTrue("isBoxDefault('listbox')"); |
| + eventSender.gestureShowPress(listbox.x, listbox.y); |
| + eventSender.gestureTapCancel(listbox.x, listbox.y); |
| + |
| + var textbox = elementCenter("textbox") |
| + debug("Verify hover, active aren't initially set"); |
| + shouldBeTrue("isBoxDefault('textbox')"); |
| + eventSender.gestureTapDown(textbox.x, textbox.y); |
| + debug("Overflow textbox should remain unchanged"); |
|
Rick Byers
2014/03/13 01:40:06
because it supports scrolling? Does it go active
Zeeshan Qureshi
2014/03/24 21:37:43
Yes, see comment below.
|
| + shouldBeTrue("isBoxDefault('textbox')"); |
| + eventSender.gestureShowPress(textbox.x, textbox.y); |
| + eventSender.gestureTapCancel(textbox.x, textbox.y); |
| + |
| + var textarea = elementCenter("textarea"); |
| + debug("Verify hover, active aren't initially set"); |
| + shouldBeTrue("isBoxDefault('textarea')"); |
| + eventSender.gestureTapDown(textarea.x, textarea.y); |
| + debug("Overflow textarea should remain unchanged"); |
| + shouldBeTrue("isBoxDefault('textarea')"); |
| + eventSender.gestureShowPress(textarea.x, textarea.y); |
| + eventSender.gestureTapCancel(textarea.x, textarea.y); |
| + |
| + var frame = elementCenter("frame"); |
| + debug("Verify hover, active aren't initially set"); |
| + shouldBeTrue("isFrameDefault()"); |
| + eventSender.gestureTapDown(frame.x, frame.y); |
| + debug("Overflow iframe should remain unchanged"); |
| + shouldBeTrue("isFrameDefault()"); |
| + eventSender.gestureShowPress(frame.x, frame.y); |
|
Rick Byers
2014/03/13 01:40:06
We should have at least one test where doing a ges
Rick Byers
2014/03/13 01:40:06
It'll be active after the showPress, right?
Zeeshan Qureshi
2014/03/24 21:37:43
That functionality is tested in gesture-tap-active
Rick Byers
2014/03/25 19:46:47
Makes sense, thanks!
|
| + eventSender.gestureTapCancel(frame.x, frame.y); |
| +} |
| +</script> |
| +</body> |
| +</html> |
| + |