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

Unified Diff: ui/views/controls/combobox/combobox_unittest.cc

Issue 2944083004: MacViews a11y: Support the "Show menu" action in Textfield and Combobox. (Closed)
Patch Set: more interesting test Created 3 years, 6 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
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/menu/menu_runner_impl_cocoa.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/combobox/combobox_unittest.cc
diff --git a/ui/views/controls/combobox/combobox_unittest.cc b/ui/views/controls/combobox/combobox_unittest.cc
index 31a0c159ddf6c5a6e87c883b8220c7f486878131..93d0d98653ea47474f3d35dff1bd625295247cd8 100644
--- a/ui/views/controls/combobox/combobox_unittest.cc
+++ b/ui/views/controls/combobox/combobox_unittest.cc
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
+#include "ui/accessibility/ax_action_data.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/base/models/combobox_model.h"
@@ -642,6 +643,36 @@ TEST_F(ComboboxTest, NotifyOnClickWithSpaceKey) {
EXPECT_FALSE(listener.on_perform_action_called());
}
+// Test that accessibility action events show the combobox dropdown.
+TEST_F(ComboboxTest, ShowViaAccessibleAction) {
+ InitCombobox(nullptr, Combobox::STYLE_NORMAL);
+
+ ui::AXActionData data;
+ data.action = ui::AX_ACTION_DO_DEFAULT;
+
+ EXPECT_EQ(0, menu_show_count_);
+ combobox_->HandleAccessibleAction(data);
+ EXPECT_EQ(1, menu_show_count_);
+
+ // AX_ACTION_SHOW_CONTEXT_MENU is specifically for a context menu (e.g. right-
+ // click). Combobox should ignore it.
+ data.action = ui::AX_ACTION_SHOW_CONTEXT_MENU;
+ combobox_->HandleAccessibleAction(data);
+ EXPECT_EQ(1, menu_show_count_); // No change.
+
+ data.action = ui::AX_ACTION_BLUR;
+ combobox_->HandleAccessibleAction(data);
+ EXPECT_EQ(1, menu_show_count_); // No change.
+
+ combobox_->SetEnabled(false);
+ combobox_->HandleAccessibleAction(data);
+ EXPECT_EQ(1, menu_show_count_); // No change.
+
+ data.action = ui::AX_ACTION_SHOW_CONTEXT_MENU;
+ combobox_->HandleAccessibleAction(data);
+ EXPECT_EQ(1, menu_show_count_); // No change.
+}
+
TEST_F(ComboboxTest, NotifyOnClickWithSpaceKeyActionStyle) {
InitCombobox(nullptr, Combobox::STYLE_ACTION);
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/menu/menu_runner_impl_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698