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

Unified Diff: chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm

Issue 573143002: Mac: Give bubble windows an initial position before showing them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: setAnchorPoint Created 6 years, 3 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
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) {
« no previous file with comments | « chrome/browser/ui/cocoa/base_bubble_controller.mm ('k') | chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698