Chromium Code Reviews| Index: ui/views/controls/button/custom_button_unittest.cc |
| diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc |
| index 61c2a85627b09ac2f9e773e1909cff4cd4349042..d73a860bf0ef01d53bcc430270df4c23648f07d1 100644 |
| --- a/ui/views/controls/button/custom_button_unittest.cc |
| +++ b/ui/views/controls/button/custom_button_unittest.cc |
| @@ -584,4 +584,21 @@ TEST_F(CustomButtonTest, InkDropStaysHiddenWhileDragging) { |
| SetDraggedView(nullptr); |
| } |
| +// Todo(karandeepb): On Mac, button should get clicked on a Space key press (and |
|
tapted
2016/06/07 04:59:35
nit: button -> a button
karandeepb
2016/06/07 08:39:29
Done.
|
| +// not release). Modify this test after fixing crbug.com/607429. |
| +// Test that Space Key behaves correctly on a focused button. |
| +TEST_F(CustomButtonTest, ClickOnSpace) { |
| + button()->RequestFocus(); |
| + EXPECT_EQ(button(), widget()->GetFocusManager()->GetFocusedView()); |
| + |
| + ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow()); |
| + generator.PressKey(ui::VKEY_SPACE, ui::EF_NONE); |
| + EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state()); |
| + EXPECT_FALSE(button()->pressed()); |
| + |
| + generator.ReleaseKey(ui::VKEY_SPACE, ui::EF_NONE); |
| + EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state()); |
| + EXPECT_TRUE(button()->pressed()); |
| +} |
| + |
| } // namespace views |