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

Unified Diff: ui/views/window/dialog_delegate_unittest.cc

Issue 2607923002: MacViews: Handle Space and Return keys correctly for Buttons. (Closed)
Patch Set: -- Created 3 years, 12 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
« ui/views/style/platform_style.h ('K') | « ui/views/style/platform_style_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/dialog_delegate_unittest.cc
diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc
index 771d201ff9ad3dd4c3939bcebd41c24ec70eff70..77fc67bd1c59556810cda8f15135d60038fdc65a 100644
--- a/ui/views/window/dialog_delegate_unittest.cc
+++ b/ui/views/window/dialog_delegate_unittest.cc
@@ -142,8 +142,6 @@ class DialogTest : public ViewsTestBase {
TEST_F(DialogTest, AcceptAndCancel) {
DialogClientView* client_view = dialog()->GetDialogClientView();
- LabelButton* ok_button = client_view->ok_button();
- LabelButton* cancel_button = client_view->cancel_button();
// Check that return/escape accelerators accept/close dialogs.
EXPECT_EQ(dialog()->input(), dialog()->GetFocusManager()->GetFocusedView());
@@ -156,17 +154,17 @@ TEST_F(DialogTest, AcceptAndCancel) {
SimulateKeyEvent(escape_event);
dialog()->CheckAndResetStates(false, false, true);
- // Check ok and cancel button behavior on a directed return key events.
- ok_button->OnKeyPressed(return_event);
- dialog()->CheckAndResetStates(false, true, false);
- cancel_button->OnKeyPressed(return_event);
- dialog()->CheckAndResetStates(true, false, false);
-
- // Check that return accelerators cancel dialogs if cancel is focused.
+ // Check that return accelerators cancel dialogs if cancel is focused, except
+ // on Mac where return should perform the default action.
+ LabelButton* cancel_button = client_view->cancel_button();
tapted 2017/01/04 04:54:31 can we keep the old tests as well? (on non-mac at
karandeepb 2017/01/04 06:14:45 Done. I didn't think these tests were appropriate
cancel_button->RequestFocus();
EXPECT_EQ(cancel_button, dialog()->GetFocusManager()->GetFocusedView());
SimulateKeyEvent(return_event);
+#if defined(OS_MACOSX)
+ dialog()->CheckAndResetStates(false, true, false);
+#else
dialog()->CheckAndResetStates(true, false, false);
+#endif
// Check that escape can be overridden.
dialog()->set_should_handle_escape(true);
« ui/views/style/platform_style.h ('K') | « ui/views/style/platform_style_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698