| OLD | NEW |
| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return client_view_->bounds(); | 76 return client_view_->bounds(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Makes sure that the content view is sized correctly. Width must be at least | 79 // Makes sure that the content view is sized correctly. Width must be at least |
| 80 // the requested amount, but height should always match exactly. | 80 // the requested amount, but height should always match exactly. |
| 81 void CheckContentsIsSetToPreferredSize() { | 81 void CheckContentsIsSetToPreferredSize() { |
| 82 const gfx::Rect client_bounds = GetUpdatedClientBounds(); | 82 const gfx::Rect client_bounds = GetUpdatedClientBounds(); |
| 83 const gfx::Size preferred_size = this->GetPreferredSize(); | 83 const gfx::Size preferred_size = this->GetPreferredSize(); |
| 84 EXPECT_EQ(preferred_size.height(), this->bounds().height()); | 84 EXPECT_EQ(preferred_size.height(), this->bounds().height()); |
| 85 EXPECT_LE(preferred_size.width(), this->bounds().width()); | 85 EXPECT_LE(preferred_size.width(), this->bounds().width()); |
| 86 EXPECT_EQ(this->bounds().origin(), client_bounds.origin()); | 86 EXPECT_EQ(this->origin(), client_bounds.origin()); |
| 87 EXPECT_EQ(this->bounds().right(), client_bounds.right()); | 87 EXPECT_EQ(this->bounds().right(), client_bounds.right()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Sets the buttons to show in the dialog and refreshes the dialog. | 90 // Sets the buttons to show in the dialog and refreshes the dialog. |
| 91 void SetDialogButtons(int dialog_buttons) { | 91 void SetDialogButtons(int dialog_buttons) { |
| 92 dialog_buttons_ = dialog_buttons; | 92 dialog_buttons_ = dialog_buttons; |
| 93 client_view_->UpdateDialogButtons(); | 93 client_view_->UpdateDialogButtons(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Sets the extra view. | 96 // Sets the extra view. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 EXPECT_EQ(no_extra_view_size.width(), client_view()->bounds().width()); | 247 EXPECT_EQ(no_extra_view_size.width(), client_view()->bounds().width()); |
| 248 | 248 |
| 249 // Try with a reduced-size dialog. | 249 // Try with a reduced-size dialog. |
| 250 extra_view->SetVisible(true); | 250 extra_view->SetVisible(true); |
| 251 client_view()->SetBoundsRect(gfx::Rect(gfx::Point(0, 0), no_extra_view_size)); | 251 client_view()->SetBoundsRect(gfx::Rect(gfx::Point(0, 0), no_extra_view_size)); |
| 252 client_view()->Layout(); | 252 client_view()->Layout(); |
| 253 EXPECT_GT(width_of_extra_view, extra_view->bounds().width()); | 253 EXPECT_GT(width_of_extra_view, extra_view->bounds().width()); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace views | 256 } // namespace views |
| OLD | NEW |