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

Unified Diff: ui/views/bubble/bubble_frame_view_unittest.cc

Issue 1774923002: MacViews: Fix failing bubble frame view tests after r375729. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_frame_view_unittest.cc
diff --git a/ui/views/bubble/bubble_frame_view_unittest.cc b/ui/views/bubble/bubble_frame_view_unittest.cc
index 552a13421c9096a77316ac3bd9882c873cec67f6..1ac39653b904f207c745b6baf8f5ce349b63b46e 100644
--- a/ui/views/bubble/bubble_frame_view_unittest.cc
+++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -30,8 +30,10 @@ const int kMaximumClientWidth = 300;
const int kMaximumClientHeight = 300;
const int kPreferredClientWidth = 150;
const int kPreferredClientHeight = 250;
-const int kExpectedBorderWidth = 22;
-const int kExpectedBorderHeight = 29;
karandeepb 2016/03/08 23:17:52 The constants kExpectedBorderHeight and kExpectedB
+
+// The following do not take bubble border into consideration.
+const int kExpectedNonClientWidth = 12;
+const int kExpectedNonClientHeight = 12;
class TestBubbleFrameViewWidgetDelegate : public WidgetDelegate {
public:
@@ -418,21 +420,26 @@ TEST_F(BubbleFrameViewTest, GetUpdatedWindowBoundsCenterArrows) {
TEST_F(BubbleFrameViewTest, GetPreferredSize) {
TestBubbleFrameView frame(this);
- gfx::Size preferred_size = frame.GetPreferredSize();
tapted 2016/03/08 23:38:09 what about something like gfx::Rect preferred_siz
karandeepb 2016/03/09 00:06:59 Done.
+
+ gfx::Size client_size(kPreferredClientWidth, kPreferredClientHeight);
+ gfx::Insets border_insets = frame.bubble_border()->GetInsets();
// Expect that a border has been added to the preferred size.
- EXPECT_EQ(kPreferredClientWidth + kExpectedBorderWidth,
- preferred_size.width());
- EXPECT_EQ(kPreferredClientHeight + kExpectedBorderHeight,
- preferred_size.height());
+ gfx::Size expected_size(
+ client_size.width() + kExpectedNonClientWidth + border_insets.width(),
+ client_size.height() + kExpectedNonClientHeight + border_insets.height());
+ EXPECT_EQ(expected_size, frame.GetPreferredSize());
}
TEST_F(BubbleFrameViewTest, GetMinimumSize) {
TestBubbleFrameView frame(this);
- gfx::Size minimum_size = frame.GetMinimumSize();
+
+ gfx::Size client_size(kMinimumClientWidth, kMinimumClientHeight);
+ gfx::Insets border_insets = frame.bubble_border()->GetInsets();
// Expect that a border has been added to the minimum size.
- EXPECT_EQ(kMinimumClientWidth + kExpectedBorderWidth, minimum_size.width());
- EXPECT_EQ(kMinimumClientHeight + kExpectedBorderHeight,
- minimum_size.height());
+ gfx::Size expected_size(
+ client_size.width() + kExpectedNonClientWidth + border_insets.width(),
+ client_size.height() + kExpectedNonClientHeight + border_insets.height());
+ EXPECT_EQ(expected_size, frame.GetMinimumSize());
}
TEST_F(BubbleFrameViewTest, GetMaximumSize) {
@@ -441,13 +448,15 @@ TEST_F(BubbleFrameViewTest, GetMaximumSize) {
#if defined(OS_WIN)
// On Windows, GetMaximumSize causes problems with DWM, so it should just be 0
// (unlimited). See http://crbug.com/506206.
- EXPECT_EQ(0, maximum_size.width());
- EXPECT_EQ(0, maximum_size.height());
+ EXPECT_EQ(gfx::Size(), maximum_size);
#else
// Should ignore the contents view's maximum size and use the preferred size.
- EXPECT_EQ(kPreferredClientWidth + kExpectedBorderWidth, maximum_size.width());
- EXPECT_EQ(kPreferredClientHeight + kExpectedBorderHeight,
- maximum_size.height());
+ gfx::Size client_size(kPreferredClientWidth, kPreferredClientHeight);
+ gfx::Insets border_insets = frame.bubble_border()->GetInsets();
+ gfx::Size expected_size(
+ client_size.width() + kExpectedNonClientWidth + border_insets.width(),
+ client_size.height() + kExpectedNonClientHeight + border_insets.height());
+ EXPECT_EQ(expected_size, maximum_size);
#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698