Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/accessibility/click-event.html |
| diff --git a/third_party/WebKit/LayoutTests/accessibility/click-event.html b/third_party/WebKit/LayoutTests/accessibility/click-event.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..65f2088edc8c1e8316096ef4f4c472ad9085ae1b |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/accessibility/click-event.html |
| @@ -0,0 +1,114 @@ |
| +<!DOCTYPE HTML> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| + |
| +<div id="wrapper1"> |
| + <button id="button1">Button</button> |
| +</div> |
| + |
| +<script> |
| +async_test(function(t) |
| +{ |
| + var axButton = accessibilityController.accessibleElementById("button1"); |
| + axButton.addNotificationListener(function(notification) { |
| + if (notification == 'Clicked') { |
| + document.getElementById("wrapper1").style.display = "none"; |
| + t.done(); |
| + } |
| + }); |
| + |
| + var button = document.getElementById("button1"); |
| + button.click(); |
| +}, "clicking a button via javascript sends an accessible click event"); |
| +</script> |
| + |
| +<div id="wrapper2"> |
| + <button id="button2">Button</button> |
| +</div> |
| + |
| +<script> |
| +async_test(function(t) |
| +{ |
| + var axButton = accessibilityController.accessibleElementById("button2"); |
| + axButton.addNotificationListener(function(notification) { |
| + if (notification == 'Clicked') { |
| + document.getElementById("wrapper2").style.display = "none"; |
| + t.done(); |
| + } |
| + }); |
| + |
| + eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); |
| + eventSender.mouseDown(); |
| + eventSender.mouseUp(); |
| +}, "clicking a button via mouse events sends an accessible click event"); |
| +</script> |
| + |
| +<div id="wrapper3"> |
| + <button id="button3">Button</button> |
| +</div> |
| + |
| +<script> |
| +async_test(function(t) |
| +{ |
| + var axButton = accessibilityController.accessibleElementById("button3"); |
| + axButton.addNotificationListener(function(notification) { |
| + if (notification == 'Clicked') { |
| + document.getElementById("wrapper3").style.display = "none"; |
| + t.done(); |
| + } |
| + }); |
| + |
| + var button = document.getElementById("button3"); |
| + button.focus(); |
| + eventSender.keyDown("\r"); |
| +}, "clicking a button via the keyboard sends an accessible click event"); |
| +</script> |
| + |
| +<div id="wrapper4"> |
| + <button id="button4">Button</button> |
| +</div> |
| + |
| +<script> |
| +async_test(function(t) |
| +{ |
| + var axButton = accessibilityController.accessibleElementById("button4"); |
| + axButton.addNotificationListener(function(notification) { |
| + if (notification == 'Clicked') { |
| + document.getElementById("wrapper4").style.display = "none"; |
| + t.done(); |
| + } |
| + }); |
| + |
| + axButton.press(); |
| +}, "clicking a button via accessibility sends an accessible click event"); |
| +</script> |
| + |
| +<div id="wrapper5"> |
| + <button id="button5">Button</button> |
| +</div> |
| + |
| +<script> |
| +async_test(function(t) |
| +{ |
| + var axButton = accessibilityController.accessibleElementById("button5"); |
| + axButton.addNotificationListener(function(notification) { |
| + if (notification == 'Clicked') { |
| + assert_unreached("There shouldn't be a Clicked notification."); |
| + } |
| + }); |
| + |
| + eventSender.dragMode = true; |
|
aboxhall
2016/02/08 18:07:12
Add another test for dragging into the button inst
dmazzoni
2016/02/08 21:34:46
Done.
|
| + eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); |
| + eventSender.mouseDown(); |
| + eventSender.leapForward(100); |
| + eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 100); |
| + eventSender.mouseUp(); |
| + |
| + // Make the test pass after a short delay. The test passes if the |
| + // accessible click event does not fire. |
| + window.setTimeout(function() { |
| + document.getElementById("wrapper5").style.display = "none"; |
| + t.done(); |
| + }, 200); |
|
aboxhall
2016/02/08 18:07:12
I suspect this timeout could be zero - the accessi
dmazzoni
2016/02/08 21:34:46
Good idea. Seems to work!
|
| +}, "dragging the mouse off a button does not send an accessible click event"); |
| +</script> |
|
aboxhall
2016/02/08 18:07:12
What about another test for touch? https://code.go
dmazzoni
2016/02/08 21:34:46
Good idea! Done.
|