| Index: ui/views/window/dialog_client_view_unittest.cc
|
| diff --git a/ui/views/window/dialog_client_view_unittest.cc b/ui/views/window/dialog_client_view_unittest.cc
|
| index a8d3d8d79c222a876312009c96f65ee9328bfbb9..996b423e595e010e2bafc22a4c158078a3c70f79 100644
|
| --- a/ui/views/window/dialog_client_view_unittest.cc
|
| +++ b/ui/views/window/dialog_client_view_unittest.cc
|
| @@ -405,4 +405,29 @@ TEST_F(DialogClientViewTest, LinkedWidths) {
|
| EXPECT_EQ(20, boring_view->width());
|
| }
|
|
|
| +// Ensures that the focus of the button remains after a dialog update.
|
| +TEST_F(DialogClientViewTest, FocusUpdate) {
|
| + // Test with just an ok button.
|
| + SetDialogButtons(ui::DIALOG_BUTTON_OK);
|
| + EXPECT_FALSE(client_view()->ok_button()->HasFocus());
|
| + client_view()->ok_button()->RequestFocus(); // Set focus.
|
| + EXPECT_TRUE(client_view()->ok_button()->HasFocus());
|
| + client_view()->UpdateDialogButtons();
|
| + EXPECT_TRUE(client_view()->ok_button()->HasFocus());
|
| +}
|
| +
|
| +// Ensures that the focus of the button remains after a dialog update that
|
| +// contains multiple buttons.
|
| +TEST_F(DialogClientViewTest, FocusMultipleButtons) {
|
| + // Test with ok and cancel buttons.
|
| + SetDialogButtons(ui::DIALOG_BUTTON_CANCEL | ui::DIALOG_BUTTON_OK);
|
| + EXPECT_FALSE(client_view()->ok_button()->HasFocus());
|
| + EXPECT_FALSE(client_view()->cancel_button()->HasFocus());
|
| + client_view()->cancel_button()->RequestFocus(); // Set focus.
|
| + EXPECT_FALSE(client_view()->ok_button()->HasFocus());
|
| + EXPECT_TRUE(client_view()->cancel_button()->HasFocus());
|
| + client_view()->UpdateDialogButtons();
|
| + EXPECT_TRUE(client_view()->cancel_button()->HasFocus());
|
| +}
|
| +
|
| } // namespace views
|
|
|