Index: chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
diff --git a/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
index b70143268c02a490cd31f79ac8d3ecb6cfb41e3d..4b28ace7ed27fcb8ee70b116d0e06c155d7a67a1 100644 |
--- a/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
+++ b/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
@@ -232,6 +232,20 @@ TEST_F(BaseBubbleControllerTest, AnchorAlignCenterArrow) { |
EXPECT_GE(NSMaxY(frame), kAnchorPointY); |
} |
+// Test that the window is given an initial position before being shown. This |
+// ensures offscreen initialization is done using correct screen metrics. |
+TEST_F(BaseBubbleControllerTest, PositionedBeforeShow) { |
+ // Verify default alignment settings, used when initialized in SetUp(). |
+ EXPECT_EQ(info_bubble::kTopRight, [[controller_ bubble] arrowLocation]); |
+ EXPECT_EQ(info_bubble::kAlignArrowToAnchor, [[controller_ bubble] alignment]); |
+ |
+ // Verify the default frame (positioned relative to the test_window() origin). |
+ NSRect frame = [[controller_ window] frame]; |
+ EXPECT_EQ(NSMaxX(frame) - info_bubble::kBubbleArrowXOffset - |
+ floorf(info_bubble::kBubbleArrowWidth / 2.0), kAnchorPointX); |
+ EXPECT_EQ(NSMaxY(frame), kAnchorPointY); |
+} |
+ |
// Tests that when a new window gets key state (and the bubble resigns) that |
// the key window changes. |
TEST_F(BaseBubbleControllerTest, ResignKeyCloses) { |