| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 TEST_F(ToolbarControllerTest, BookmarkBubblePoint) { | 210 TEST_F(ToolbarControllerTest, BookmarkBubblePoint) { |
| 211 const NSPoint starPoint = [bar_ bookmarkBubblePoint]; | 211 const NSPoint starPoint = [bar_ bookmarkBubblePoint]; |
| 212 const NSRect barFrame = | 212 const NSRect barFrame = |
| 213 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; | 213 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; |
| 214 | 214 |
| 215 // Make sure the star is completely inside the location bar. | 215 // Make sure the star is completely inside the location bar. |
| 216 EXPECT_TRUE(NSPointInRect(starPoint, barFrame)); | 216 EXPECT_TRUE(NSPointInRect(starPoint, barFrame)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 TEST_F(ToolbarControllerTest, TranslateBubblePoint) { |
| 220 const NSPoint translatePoint = [bar_ translateBubblePoint]; |
| 221 const NSRect barFrame = |
| 222 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; |
| 223 EXPECT_TRUE(NSPointInRect(translatePoint, barFrame)); |
| 224 } |
| 225 |
| 219 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { | 226 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { |
| 220 base::scoped_nsobject<HitView> view( | 227 base::scoped_nsobject<HitView> view( |
| 221 [[HitView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]); | 228 [[HitView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]); |
| 222 [bar_ setView:view]; | 229 [bar_ setView:view]; |
| 223 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved | 230 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved |
| 224 location:NSMakePoint(10,10) | 231 location:NSMakePoint(10,10) |
| 225 modifierFlags:0 | 232 modifierFlags:0 |
| 226 timestamp:0 | 233 timestamp:0 |
| 227 windowNumber:0 | 234 windowNumber:0 |
| 228 context:nil | 235 context:nil |
| (...skipping 11 matching lines...) Expand all Loading... |
| 240 EXPECT_FALSE([bar_ hoverButtonForEvent:event]); | 247 EXPECT_FALSE([bar_ hoverButtonForEvent:event]); |
| 241 | 248 |
| 242 // Now! | 249 // Now! |
| 243 base::scoped_nsobject<GradientButtonCell> cell( | 250 base::scoped_nsobject<GradientButtonCell> cell( |
| 244 [[GradientButtonCell alloc] init]); | 251 [[GradientButtonCell alloc] init]); |
| 245 [button setCell:cell.get()]; | 252 [button setCell:cell.get()]; |
| 246 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]); | 253 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]); |
| 247 } | 254 } |
| 248 | 255 |
| 249 } // namespace | 256 } // namespace |
| OLD | NEW |