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

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

Issue 1826433002: DialogClientView: Fix regression in Chrome Task Manager focusing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 f4f72eeffa56ca5d30dc541e6d2796d7ffdcdf65..f34c1f23b36731a8ca9b8f45ebeb42b949d33cb2 100644
--- a/ui/views/window/dialog_client_view_unittest.cc
+++ b/ui/views/window/dialog_client_view_unittest.cc
@@ -49,14 +49,16 @@ class DialogClientViewTest : public ViewsTestBase,
// testing::Test implementation.
void SetUp() override {
dialog_buttons_ = ui::DIALOG_BUTTON_NONE;
- contents_.reset(new StaticSizedView(gfx::Size(100, 200)));
- client_view_.reset(new TestDialogClientView(contents_.get(), this));
-
+ contents_ = new StaticSizedView(gfx::Size(100, 200));
+ client_view_.reset(new TestDialogClientView(contents_, this));
+ // Add |contents_| as a child of |client_view|. This is generally done when
+ // the client view is added to the view hierarchy.
+ client_view_->AddChildViewAt(contents_, 0);
ViewsTestBase::SetUp();
}
// DialogDelegateView implementation.
- View* GetContentsView() override { return contents_.get(); }
+ View* GetContentsView() override { return contents_; }
View* CreateExtraView() override { return extra_view_; }
bool GetExtraViewPadding(int* padding) override {
if (extra_view_padding_)
@@ -107,7 +109,7 @@ class DialogClientViewTest : public ViewsTestBase,
private:
// The contents of the dialog.
- scoped_ptr<View> contents_;
+ View* contents_;
// The DialogClientView that's being tested.
scoped_ptr<TestDialogClientView> client_view_;
// The bitmask of buttons to show in the dialog.
@@ -166,7 +168,7 @@ TEST_F(DialogClientViewTest, RemoveAndUpdateButtons) {
}
// Test that views inside the dialog client view have the correct focus order.
-TEST_F(DialogClientViewTest, SetupFocusChain) {
+TEST_F(DialogClientViewTest, FocusOrder) {
#if defined(OS_WIN) || defined(OS_CHROMEOS)
const bool kIsOkButtonOnLeftSide = true;
#else
@@ -202,6 +204,11 @@ TEST_F(DialogClientViewTest, SetupFocusChain) {
client_view()->GetContentsView()->GetNextFocusableView());
EXPECT_EQ(client_view()->cancel_button(), extra_view->GetNextFocusableView());
EXPECT_EQ(nullptr, client_view()->cancel_button()->GetNextFocusableView());
+
+ // Add a dummy view to the client view.
+ View* dummy_view = new StaticSizedView(gfx::Size(200, 200));
+ client_view()->AddChildView(dummy_view);
+ EXPECT_EQ(dummy_view, client_view()->cancel_button()->GetNextFocusableView());
}
// Test that the contents view gets its preferred size in the basic dialog
« ui/views/window/dialog_client_view.cc ('K') | « ui/views/window/dialog_client_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698