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

Side by Side Diff: ui/views/window/dialog_client_view_unittest.cc

Issue 2660553005: Harmony - convert hung renderer dialog. (Closed)
Patch Set: disable dialog test on osx Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/views/window/dialog_client_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ui/base/ui_base_types.h" 8 #include "ui/base/ui_base_types.h"
9 #include "ui/views/controls/button/label_button.h" 9 #include "ui/views/controls/button/label_button.h"
10 #include "ui/views/style/platform_style.h" 10 #include "ui/views/style/platform_style.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 public: 47 public:
48 DialogClientViewTest() 48 DialogClientViewTest()
49 : dialog_buttons_(ui::DIALOG_BUTTON_NONE), 49 : dialog_buttons_(ui::DIALOG_BUTTON_NONE),
50 extra_view_(nullptr) {} 50 extra_view_(nullptr) {}
51 ~DialogClientViewTest() override {} 51 ~DialogClientViewTest() override {}
52 52
53 // testing::Test implementation. 53 // testing::Test implementation.
54 void SetUp() override { 54 void SetUp() override {
55 dialog_buttons_ = ui::DIALOG_BUTTON_NONE; 55 dialog_buttons_ = ui::DIALOG_BUTTON_NONE;
56 client_view_.reset(new TestDialogClientView(this)); 56 client_view_.reset(new TestDialogClientView(this));
57 // Add this i.e. the contents view as a child of |client_view_|. This is 57 // Add this (i.e. the contents view) as a child of |client_view_|. This is
58 // generally done when the client view is added to the view hierarchy. 58 // generally done when the client view is added to the view hierarchy.
59 client_view_->AddChildViewAt(this, 0); 59 client_view_->AddChildViewAt(this, 0);
60 ViewsTestBase::SetUp(); 60 ViewsTestBase::SetUp();
61 } 61 }
62 62
63 // DialogDelegateView implementation. 63 // DialogDelegateView implementation.
64 View* CreateExtraView() override { return extra_view_; } 64 View* CreateExtraView() override { return extra_view_; }
65 bool GetExtraViewPadding(int* padding) override { 65 bool GetExtraViewPadding(int* padding) override {
66 if (extra_view_padding_) 66 if (extra_view_padding_)
67 *padding = *extra_view_padding_; 67 *padding = *extra_view_padding_;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 TEST_F(DialogClientViewTest, ContentsSize) { 217 TEST_F(DialogClientViewTest, ContentsSize) {
218 CheckContentsIsSetToPreferredSize(); 218 CheckContentsIsSetToPreferredSize();
219 EXPECT_EQ(GetContentsView()->bounds().bottom(), 219 EXPECT_EQ(GetContentsView()->bounds().bottom(),
220 client_view()->bounds().bottom()); 220 client_view()->bounds().bottom());
221 } 221 }
222 222
223 // Test the effect of the button strip on layout. 223 // Test the effect of the button strip on layout.
224 TEST_F(DialogClientViewTest, LayoutWithButtons) { 224 TEST_F(DialogClientViewTest, LayoutWithButtons) {
225 SetDialogButtons(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL); 225 SetDialogButtons(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL);
226 CheckContentsIsSetToPreferredSize(); 226 CheckContentsIsSetToPreferredSize();
227
227 EXPECT_LT(GetContentsView()->bounds().bottom(), 228 EXPECT_LT(GetContentsView()->bounds().bottom(),
228 client_view()->bounds().bottom()); 229 client_view()->bounds().bottom());
229 gfx::Size no_extra_view_size = client_view()->bounds().size(); 230 gfx::Size no_extra_view_size = client_view()->bounds().size();
230 231
231 View* extra_view = new StaticSizedView(gfx::Size(200, 200)); 232 View* extra_view = new StaticSizedView(gfx::Size(200, 200));
232 SetExtraView(extra_view); 233 SetExtraView(extra_view);
233 CheckContentsIsSetToPreferredSize(); 234 CheckContentsIsSetToPreferredSize();
234 EXPECT_GT(client_view()->bounds().height(), no_extra_view_size.height()); 235 EXPECT_GT(client_view()->bounds().height(), no_extra_view_size.height());
235 int width_of_dialog = client_view()->bounds().width(); 236 int width_of_dialog = client_view()->bounds().width();
236 int width_of_extra_view = extra_view->bounds().width(); 237 int width_of_extra_view = extra_view->bounds().width();
(...skipping 10 matching lines...) Expand all
247 EXPECT_EQ(no_extra_view_size.width(), client_view()->bounds().width()); 248 EXPECT_EQ(no_extra_view_size.width(), client_view()->bounds().width());
248 249
249 // Try with a reduced-size dialog. 250 // Try with a reduced-size dialog.
250 extra_view->SetVisible(true); 251 extra_view->SetVisible(true);
251 client_view()->SetBoundsRect(gfx::Rect(gfx::Point(0, 0), no_extra_view_size)); 252 client_view()->SetBoundsRect(gfx::Rect(gfx::Point(0, 0), no_extra_view_size));
252 client_view()->Layout(); 253 client_view()->Layout();
253 EXPECT_GT(width_of_extra_view, extra_view->bounds().width()); 254 EXPECT_GT(width_of_extra_view, extra_view->bounds().width());
254 } 255 }
255 256
256 } // namespace views 257 } // namespace views
OLDNEW
« no previous file with comments | « 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