summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_controller_unittest.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 03:57:04 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 03:57:04 +0000
commit22f5aaa21ecb93bef8b0171b50137e5bc1c838bd (patch)
tree7f24b41dfecfc230155d4f29a3071024d5292738 /chrome/browser/cocoa/toolbar_controller_unittest.mm
parente3c6f51fcf256b17a1469c00b1f3fd7e6be0f914 (diff)
downloadchromium_src-22f5aaa21ecb93bef8b0171b50137e5bc1c838bd.zip
chromium_src-22f5aaa21ecb93bef8b0171b50137e5bc1c838bd.tar.gz
chromium_src-22f5aaa21ecb93bef8b0171b50137e5bc1c838bd.tar.bz2
[Mac] The autocomplete popup now gets its position from the toolbar controller,
rather than simply growing its width by 2*height. BUG=None TEST=The autocomplete popup should continue to appear in the same location. Review URL: http://codereview.chromium.org/173439 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24586 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller_unittest.mm')
-rw-r--r--chrome/browser/cocoa/toolbar_controller_unittest.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller_unittest.mm b/chrome/browser/cocoa/toolbar_controller_unittest.mm
index 091bddc..a39481b 100644
--- a/chrome/browser/cocoa/toolbar_controller_unittest.mm
+++ b/chrome/browser/cocoa/toolbar_controller_unittest.mm
@@ -256,5 +256,26 @@ TEST_F(ToolbarControllerTest, StarButtonInWindowCoordinates) {
EXPECT_TRUE(NSContainsRect(all, star));
}
+TEST_F(ToolbarControllerTest, AutocompletePopupPosition) {
+ NSView* locationBar = [[bar_ toolbarViews] objectAtIndex:kLocationIndex];
+
+ // The window frame (in window base coordinates).
+ NSRect all = [[[bar_ view] window] frame];
+ // The frame of the location bar in window base coordinates.
+ NSRect locationFrame =
+ [locationBar convertRect:[locationBar bounds] toView:nil];
+ // The frame of the popup in window base coordinates.
+ gfx::Rect popupFrame = [bar_ autocompletePopupPosition];
+
+ // Make sure the popup starts to the left of and ends to the right of the
+ // location bar.
+ EXPECT_LT(popupFrame.x(), NSMinX(locationFrame));
+ EXPECT_GT(popupFrame.right(), NSMaxX(locationFrame));
+
+ // Make sure the popup frame is positioned at the bottom of the location bar.
+ EXPECT_EQ(popupFrame.bottom(), NSMinY(locationFrame));
+}
+
+
} // namespace