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

Side by Side Diff: chrome/browser/cocoa/toolbar_controller_unittest.mm

Issue 1578021: Shift omnibox dropdown in and up on Windows, and square off the top, so it co... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/scoped_nsobject.h" 7 #import "base/scoped_nsobject.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
11 #import "chrome/browser/cocoa/gradient_button_cell.h" 11 #import "chrome/browser/cocoa/gradient_button_cell.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 TEST_F(ToolbarControllerTest, StarIconInWindowCoordinates) { 221 TEST_F(ToolbarControllerTest, StarIconInWindowCoordinates) {
222 NSRect star = [bar_ starIconInWindowCoordinates]; 222 NSRect star = [bar_ starIconInWindowCoordinates];
223 NSRect all = [[[bar_ view] window] frame]; 223 NSRect all = [[[bar_ view] window] frame];
224 224
225 // Make sure the star is completely inside the window rect 225 // Make sure the star is completely inside the window rect
226 EXPECT_TRUE(NSContainsRect(all, star)); 226 EXPECT_TRUE(NSContainsRect(all, star));
227 } 227 }
228 228
229 TEST_F(ToolbarControllerTest, BubblePosition) {
230 NSView* locationBar = [[bar_ toolbarViews] objectAtIndex:kLocationIndex];
231
232 // The window frame (in window base coordinates).
233 NSRect all = [[[bar_ view] window] frame];
234 // The frame of the location bar in window base coordinates.
235 NSRect locationFrame =
236 [locationBar convertRect:[locationBar bounds] toView:nil];
237 // The frame of the location stack in window base coordinates. The horizontal
238 // coordinates here are used for the omnibox dropdown.
239 gfx::Rect locationStackFrame = [bar_ locationStackBounds];
240
241 // The location stack should be just within the border of the
242 // location bar.
243 EXPECT_EQ(locationStackFrame.x(), NSMinX(locationFrame) + 1);
244 EXPECT_EQ(locationStackFrame.right(), NSMaxX(locationFrame) - 1);
245 }
246
247 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { 229 TEST_F(ToolbarControllerTest, HoverButtonForEvent) {
248 scoped_nsobject<HitView> view([[HitView alloc] 230 scoped_nsobject<HitView> view([[HitView alloc]
249 initWithFrame:NSMakeRect(0,0,100,100)]); 231 initWithFrame:NSMakeRect(0,0,100,100)]);
250 [bar_ setView:view]; 232 [bar_ setView:view];
251 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved 233 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved
252 location:NSMakePoint(10,10) 234 location:NSMakePoint(10,10)
253 modifierFlags:0 235 modifierFlags:0
254 timestamp:0 236 timestamp:0
255 windowNumber:0 237 windowNumber:0
256 context:nil 238 context:nil
(...skipping 10 matching lines...) Expand all
267 [view setHitTestReturn:button]; 249 [view setHitTestReturn:button];
268 EXPECT_FALSE([bar_ hoverButtonForEvent:event]); 250 EXPECT_FALSE([bar_ hoverButtonForEvent:event]);
269 251
270 // Now! 252 // Now!
271 scoped_nsobject<GradientButtonCell> cell([[GradientButtonCell alloc] init]); 253 scoped_nsobject<GradientButtonCell> cell([[GradientButtonCell alloc] init]);
272 [button setCell:cell.get()]; 254 [button setCell:cell.get()];
273 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]); 255 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]);
274 } 256 }
275 257
276 } // namespace 258 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698