| 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 #include "base/memory/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #include "base/strings/sys_string_conversions.h" | 6 #include "base/strings/sys_string_conversions.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/sync/glue/session_model_associator.h" | 10 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 11 #include "chrome/browser/sync/profile_sync_service_factory.h" | 11 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 13 #include "chrome/browser/ui/cocoa/run_loop_testing.h" | 13 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
| 14 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 14 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 15 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" | 15 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 virtual void TearDown() OVERRIDE { | 55 virtual void TearDown() OVERRIDE { |
| 56 fake_model_.reset(); | 56 fake_model_.reset(); |
| 57 controller_.reset(); | 57 controller_.reset(); |
| 58 CocoaProfileTest::TearDown(); | 58 CocoaProfileTest::TearDown(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 WrenchMenuController* controller() { | 61 WrenchMenuController* controller() { |
| 62 return controller_.get(); | 62 return controller_.get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 scoped_nsobject<WrenchMenuController> controller_; | 65 base::scoped_nsobject<WrenchMenuController> controller_; |
| 66 | 66 |
| 67 scoped_ptr<MockWrenchMenuModel> fake_model_; | 67 scoped_ptr<MockWrenchMenuModel> fake_model_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 TEST_F(WrenchMenuControllerTest, Initialized) { | 70 TEST_F(WrenchMenuControllerTest, Initialized) { |
| 71 EXPECT_TRUE([controller() menu]); | 71 EXPECT_TRUE([controller() menu]); |
| 72 EXPECT_GE([[controller() menu] numberOfItems], 5); | 72 EXPECT_GE([[controller() menu] numberOfItems], 5); |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST_F(WrenchMenuControllerTest, DispatchSimple) { | 75 TEST_F(WrenchMenuControllerTest, DispatchSimple) { |
| 76 scoped_nsobject<NSButton> button([[NSButton alloc] init]); | 76 base::scoped_nsobject<NSButton> button([[NSButton alloc] init]); |
| 77 [button setTag:IDC_ZOOM_PLUS]; | 77 [button setTag:IDC_ZOOM_PLUS]; |
| 78 | 78 |
| 79 // Set fake model to test dispatching. | 79 // Set fake model to test dispatching. |
| 80 EXPECT_CALL(*fake_model_, ExecuteCommand(IDC_ZOOM_PLUS, 0)); | 80 EXPECT_CALL(*fake_model_, ExecuteCommand(IDC_ZOOM_PLUS, 0)); |
| 81 [controller() setModel:fake_model_.get()]; | 81 [controller() setModel:fake_model_.get()]; |
| 82 | 82 |
| 83 [controller() dispatchWrenchMenuCommand:button.get()]; | 83 [controller() dispatchWrenchMenuCommand:button.get()]; |
| 84 chrome::testing::NSRunLoopRunAllPending(); | 84 chrome::testing::NSRunLoopRunAllPending(); |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model | 191 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model |
| 192 // it's observing. | 192 // it's observing. |
| 193 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { | 193 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { |
| 194 chrome::EnableInstantExtendedAPIForTesting(); | 194 chrome::EnableInstantExtendedAPIForTesting(); |
| 195 [controller_ menuNeedsUpdate:[controller_ menu]]; | 195 [controller_ menuNeedsUpdate:[controller_ menu]]; |
| 196 // If the delete order is wrong then the test will crash on exit. | 196 // If the delete order is wrong then the test will crash on exit. |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace | 199 } // namespace |
| OLD | NEW |