Chromium Code Reviews| 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..bb10a1d54321c379a988bfea9276021f0908ff1f 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,26 @@ 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_); |
|
msw
2017/06/29 19:26:12
nit: test handling the action while the menu is sh
tapted
2017/06/30 06:04:47
doing this requires an interactive_ui_test (menus
|
| + |
| + combobox_->SetEnabled(false); |
| + combobox_->HandleAccessibleAction(data); |
| + EXPECT_EQ(1, menu_show_count_); // No change. |
| + |
| + data.action = ui::AX_ACTION_BLUR; |
|
msw
2017/06/29 19:26:12
Should this also test AX_ACTION_SHOW_CONTEXT_MENU,
tapted
2017/06/30 06:04:47
AX_ACTION_SHOW_CONTEXT_MENU was actually tested in
|
| + combobox_->HandleAccessibleAction(data); |
|
msw
2017/06/29 19:26:12
Maybe test other actions, like blur, before disabl
tapted
2017/06/30 06:04:47
Done.
|
| + EXPECT_EQ(1, menu_show_count_); // No change. |
| +} |
| + |
| TEST_F(ComboboxTest, NotifyOnClickWithSpaceKeyActionStyle) { |
| InitCombobox(nullptr, Combobox::STYLE_ACTION); |