| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/browser/command_updater.h" | 11 #include "chrome/browser/command_updater.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_command_controller.h" | 13 #include "chrome/browser/ui/browser_command_controller.h" |
| 14 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
| 15 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 16 #include "chrome/browser/ui/browser_list_observer.h" | 16 #include "chrome/browser/ui/browser_list_observer.h" |
| 17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 18 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 18 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 19 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 20 #import "chrome/browser/ui/cocoa/location_bar/translate_decoration.h" |
| 19 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 21 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 20 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" | 22 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" |
| 21 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
| 23 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 25 #import "testing/gtest_mac.h" | 27 #import "testing/gtest_mac.h" |
| 26 #include "testing/platform_test.h" | 28 #include "testing/platform_test.h" |
| 27 | 29 |
| 28 // An NSView that fakes out hitTest:. | 30 // An NSView that fakes out hitTest:. |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 TEST_F(ToolbarControllerTest, BookmarkBubblePoint) { | 340 TEST_F(ToolbarControllerTest, BookmarkBubblePoint) { |
| 339 const NSPoint starPoint = [bar_ bookmarkBubblePoint]; | 341 const NSPoint starPoint = [bar_ bookmarkBubblePoint]; |
| 340 const NSRect barFrame = | 342 const NSRect barFrame = |
| 341 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; | 343 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; |
| 342 | 344 |
| 343 // Make sure the star is completely inside the location bar. | 345 // Make sure the star is completely inside the location bar. |
| 344 EXPECT_TRUE(NSPointInRect(starPoint, barFrame)); | 346 EXPECT_TRUE(NSPointInRect(starPoint, barFrame)); |
| 345 } | 347 } |
| 346 | 348 |
| 347 TEST_F(ToolbarControllerTest, TranslateBubblePoint) { | 349 TEST_F(ToolbarControllerTest, TranslateBubblePoint) { |
| 348 const NSPoint translatePoint = [bar_ translateBubblePoint]; | 350 LocationBarViewMac* locationBarBridge = [bar_ locationBarBridge]; |
| 351 LocationBarDecoration* decoration = locationBarBridge->translate_decoration(); |
| 352 const NSPoint translatePoint = |
| 353 locationBarBridge->GetBubblePointForDecoration(decoration); |
| 349 const NSRect barFrame = | 354 const NSRect barFrame = |
| 350 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; | 355 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; |
| 351 EXPECT_TRUE(NSPointInRect(translatePoint, barFrame)); | 356 EXPECT_TRUE(NSPointInRect(translatePoint, barFrame)); |
| 352 } | 357 } |
| 353 | 358 |
| 354 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { | 359 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { |
| 355 base::scoped_nsobject<HitView> view( | 360 base::scoped_nsobject<HitView> view( |
| 356 [[HitView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]); | 361 [[HitView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]); |
| 357 NSView* toolbarView = [bar_ view]; | 362 NSView* toolbarView = [bar_ view]; |
| 358 [bar_ setView:view]; | 363 [bar_ setView:view]; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 void WaitUntilBrowserRemoved() { run_loop_.Run(); } | 398 void WaitUntilBrowserRemoved() { run_loop_.Run(); } |
| 394 void OnBrowserRemoved(Browser* browser) override { run_loop_.Quit(); } | 399 void OnBrowserRemoved(Browser* browser) override { run_loop_.Quit(); } |
| 395 | 400 |
| 396 private: | 401 private: |
| 397 base::RunLoop run_loop_; | 402 base::RunLoop run_loop_; |
| 398 | 403 |
| 399 DISALLOW_COPY_AND_ASSIGN(BrowserRemovedObserver); | 404 DISALLOW_COPY_AND_ASSIGN(BrowserRemovedObserver); |
| 400 }; | 405 }; |
| 401 | 406 |
| 402 } // namespace | 407 } // namespace |
| OLD | NEW |