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

Unified Diff: ui/views/controls/button/custom_button_unittest.cc

Issue 2033433006: MacViews: Modify insertText handlers to correctly handle space key and simplify menu event dispatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 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/cocoa/bridged_content_view.mm ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698