| 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 "ui/views/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 TEST_F(BubbleFrameViewTest, GetBoundsForClientViewWithClose) { | 138 TEST_F(BubbleFrameViewTest, GetBoundsForClientViewWithClose) { |
| 139 TestBubbleFrameView frame(this); | 139 TestBubbleFrameView frame(this); |
| 140 // TestBubbleFrameView::GetWidget() is responsible for creating the widget and | 140 // TestBubbleFrameView::GetWidget() is responsible for creating the widget and |
| 141 // widget delegate at first call, so it is called here for that side-effect. | 141 // widget delegate at first call, so it is called here for that side-effect. |
| 142 ignore_result(frame.GetWidget()); | 142 ignore_result(frame.GetWidget()); |
| 143 frame.widget_delegate()->SetShouldShowCloseButton(true); | 143 frame.widget_delegate()->SetShouldShowCloseButton(true); |
| 144 frame.ResetWindowControls(); | 144 frame.ResetWindowControls(); |
| 145 EXPECT_EQ(kArrow, frame.bubble_border()->arrow()); | 145 EXPECT_EQ(kArrow, frame.bubble_border()->arrow()); |
| 146 EXPECT_EQ(kColor, frame.bubble_border()->background_color()); | 146 EXPECT_EQ(kColor, frame.bubble_border()->background_color()); |
| 147 | 147 |
| 148 int margin_x = frame.content_margins().left(); | 148 gfx::Insets frame_insets = frame.GetInsets(); |
| 149 int margin_y = frame.content_margins().top() + | 149 gfx::Insets border_insets = frame.bubble_border()->GetInsets(); |
| 150 frame.GetCloseButtonForTest()->height(); | 150 EXPECT_EQ(border_insets.left() + frame_insets.left(), |
| 151 gfx::Insets insets = frame.bubble_border()->GetInsets(); | 151 frame.GetBoundsForClientView().x()); |
| 152 EXPECT_EQ(insets.left() + margin_x, frame.GetBoundsForClientView().x()); | 152 EXPECT_EQ(border_insets.top() + frame_insets.top(), |
| 153 EXPECT_EQ(insets.top() + margin_y, frame.GetBoundsForClientView().y()); | 153 frame.GetBoundsForClientView().y()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Tests that the arrow is mirrored as needed to better fit the screen. | 156 // Tests that the arrow is mirrored as needed to better fit the screen. |
| 157 TEST_F(BubbleFrameViewTest, GetUpdatedWindowBounds) { | 157 TEST_F(BubbleFrameViewTest, GetUpdatedWindowBounds) { |
| 158 TestBubbleFrameView frame(this); | 158 TestBubbleFrameView frame(this); |
| 159 gfx::Rect window_bounds; | 159 gfx::Rect window_bounds; |
| 160 | 160 |
| 161 gfx::Insets insets = frame.bubble_border()->GetInsets(); | 161 gfx::Insets insets = frame.bubble_border()->GetInsets(); |
| 162 int xposition = 95 - insets.width(); | 162 int xposition = 95 - insets.width(); |
| 163 | 163 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 maximum_rect.Inset(frame.bubble_border()->GetInsets()); | 482 maximum_rect.Inset(frame.bubble_border()->GetInsets()); |
| 483 | 483 |
| 484 // Should ignore the contents view's maximum size and use the preferred size. | 484 // Should ignore the contents view's maximum size and use the preferred size. |
| 485 gfx::Size expected_size(kPreferredClientWidth + kExpectedAdditionalWidth, | 485 gfx::Size expected_size(kPreferredClientWidth + kExpectedAdditionalWidth, |
| 486 kPreferredClientHeight + kExpectedAdditionalHeight); | 486 kPreferredClientHeight + kExpectedAdditionalHeight); |
| 487 EXPECT_EQ(expected_size, maximum_rect.size()); | 487 EXPECT_EQ(expected_size, maximum_rect.size()); |
| 488 #endif | 488 #endif |
| 489 } | 489 } |
| 490 | 490 |
| 491 } // namespace views | 491 } // namespace views |
| OLD | NEW |