| OLD | NEW | 
|    1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2009 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" | 
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  233  |  233  | 
|  234   // The window frame (in window base coordinates). |  234   // The window frame (in window base coordinates). | 
|  235   NSRect all = [[[bar_ view] window] frame]; |  235   NSRect all = [[[bar_ view] window] frame]; | 
|  236   // The frame of the location bar in window base coordinates. |  236   // The frame of the location bar in window base coordinates. | 
|  237   NSRect locationFrame = |  237   NSRect locationFrame = | 
|  238       [locationBar convertRect:[locationBar bounds] toView:nil]; |  238       [locationBar convertRect:[locationBar bounds] toView:nil]; | 
|  239   // The frame of the location stack in window base coordinates.  The horizontal |  239   // The frame of the location stack in window base coordinates.  The horizontal | 
|  240   // coordinates here are used for the omnibox dropdown. |  240   // coordinates here are used for the omnibox dropdown. | 
|  241   gfx::Rect locationStackFrame = [bar_ locationStackBounds]; |  241   gfx::Rect locationStackFrame = [bar_ locationStackBounds]; | 
|  242  |  242  | 
|  243   // Make sure the location stack starts to the left of and ends to the right of |  243   // The location stack should be just within the border of the | 
|  244   // the location bar. |  244   // location bar. | 
|  245   EXPECT_LT(locationStackFrame.x(), NSMinX(locationFrame)); |  245   EXPECT_EQ(locationStackFrame.x(), NSMinX(locationFrame) + 1); | 
|  246   EXPECT_GT(locationStackFrame.right(), NSMaxX(locationFrame)); |  246   EXPECT_EQ(locationStackFrame.right(), NSMaxX(locationFrame) - 1); | 
|  247 } |  247 } | 
|  248  |  248  | 
|  249 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { |  249 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { | 
|  250   scoped_nsobject<HitView> view([[HitView alloc] |  250   scoped_nsobject<HitView> view([[HitView alloc] | 
|  251                                   initWithFrame:NSMakeRect(0,0,100,100)]); |  251                                   initWithFrame:NSMakeRect(0,0,100,100)]); | 
|  252   [bar_ setView:view]; |  252   [bar_ setView:view]; | 
|  253   NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved |  253   NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved | 
|  254                                       location:NSMakePoint(10,10) |  254                                       location:NSMakePoint(10,10) | 
|  255                                  modifierFlags:0 |  255                                  modifierFlags:0 | 
|  256                                      timestamp:0 |  256                                      timestamp:0 | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
|  269   [view setHitTestReturn:button]; |  269   [view setHitTestReturn:button]; | 
|  270   EXPECT_FALSE([bar_ hoverButtonForEvent:event]); |  270   EXPECT_FALSE([bar_ hoverButtonForEvent:event]); | 
|  271  |  271  | 
|  272   // Now! |  272   // Now! | 
|  273   scoped_nsobject<GradientButtonCell> cell([[GradientButtonCell alloc] init]); |  273   scoped_nsobject<GradientButtonCell> cell([[GradientButtonCell alloc] init]); | 
|  274   [button setCell:cell.get()]; |  274   [button setCell:cell.get()]; | 
|  275   EXPECT_TRUE([bar_ hoverButtonForEvent:nil]); |  275   EXPECT_TRUE([bar_ hoverButtonForEvent:nil]); | 
|  276 } |  276 } | 
|  277  |  277  | 
|  278 }  // namespace |  278 }  // namespace | 
| OLD | NEW |