Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: third_party/WebKit/LayoutTests/accessibility/click-event.html

Issue 1655153003: Fire an accessible click event when a web node is clicked on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fire_clicked_event
Patch Set: Added test for tap Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..65c89258d650e78fc467560e0e1488b4e765beec
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/accessibility/click-event.html
@@ -0,0 +1,163 @@
+<!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;
+ 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);
+}, "dragging the mouse off a button does not send an accessible click event");
+</script>
+
+<div id="wrapper6">
+ <button id="button6">Button</button>
+</div>
+
+<script>
+async_test(function(t)
+{
+ var axButton = accessibilityController.accessibleElementById("button6");
+ axButton.addNotificationListener(function(notification) {
+ if (notification == 'Clicked') {
+ assert_unreached("There shouldn't be a Clicked notification.");
+ }
+ });
+
+ eventSender.dragMode = true;
+ eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 100);
+ eventSender.mouseDown();
+ eventSender.leapForward(100);
+ eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10);
+ 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("wrapper6").style.display = "none";
+ t.done();
+ }, 0);
+}, "dragging the mouse onto a button does not send an accessible click event");
+</script>
+
+<div id="wrapper7">
+ <button id="button7">Button</button>
+</div>
+
+<script>
+async_test(function(t)
+{
+ var axButton = accessibilityController.accessibleElementById("button7");
+ axButton.addNotificationListener(function(notification) {
+ if (notification == 'Clicked') {
+ document.getElementById("wrapper7").style.display = "none";
+ t.done();
+ }
+ });
+
+ eventSender.gestureTap(axButton.x + 10, axButton.y + 10);
+}, "tapping on a button with a touch event sends an accessible click event");
+</script>
« no previous file with comments | « content/renderer/accessibility/blink_ax_enum_conversion.cc ('k') | third_party/WebKit/Source/core/dom/AXObjectCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698