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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/mac/scoped_nsobject.h" | 6 #include "base/mac/scoped_nsobject.h" |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/sync/profile_sync_service_factory.h" | 10 #include "chrome/browser/sync/profile_sync_service_factory.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // short-circuits the parent destructor to avoid this crash. | 45 // short-circuits the parent destructor to avoid this crash. |
46 tab_strip_model_ = NULL; | 46 tab_strip_model_ = NULL; |
47 } | 47 } |
48 MOCK_METHOD2(ExecuteCommand, void(int command_id, int event_flags)); | 48 MOCK_METHOD2(ExecuteCommand, void(int command_id, int event_flags)); |
49 }; | 49 }; |
50 | 50 |
51 class DummyRouter : public browser_sync::LocalSessionEventRouter { | 51 class DummyRouter : public browser_sync::LocalSessionEventRouter { |
52 public: | 52 public: |
53 virtual ~DummyRouter() {} | 53 virtual ~DummyRouter() {} |
54 virtual void StartRoutingTo( | 54 virtual void StartRoutingTo( |
55 browser_sync::LocalSessionEventHandler* handler) OVERRIDE {} | 55 browser_sync::LocalSessionEventHandler* handler) override {} |
56 virtual void Stop() OVERRIDE {} | 56 virtual void Stop() override {} |
57 }; | 57 }; |
58 | 58 |
59 class WrenchMenuControllerTest | 59 class WrenchMenuControllerTest |
60 : public CocoaProfileTest { | 60 : public CocoaProfileTest { |
61 public: | 61 public: |
62 WrenchMenuControllerTest() | 62 WrenchMenuControllerTest() |
63 : local_device_(new sync_driver::LocalDeviceInfoProviderMock( | 63 : local_device_(new sync_driver::LocalDeviceInfoProviderMock( |
64 "WrenchMenuControllerTest", | 64 "WrenchMenuControllerTest", |
65 "Test Machine", | 65 "Test Machine", |
66 "Chromium 10k", | 66 "Chromium 10k", |
67 "Chrome 10k", | 67 "Chrome 10k", |
68 sync_pb::SyncEnums_DeviceType_TYPE_LINUX, | 68 sync_pb::SyncEnums_DeviceType_TYPE_LINUX, |
69 "device_id")) { | 69 "device_id")) { |
70 } | 70 } |
71 | 71 |
72 virtual ~WrenchMenuControllerTest() {} | 72 virtual ~WrenchMenuControllerTest() {} |
73 | 73 |
74 virtual void SetUp() OVERRIDE { | 74 virtual void SetUp() override { |
75 CocoaProfileTest::SetUp(); | 75 CocoaProfileTest::SetUp(); |
76 ASSERT_TRUE(browser()); | 76 ASSERT_TRUE(browser()); |
77 | 77 |
78 controller_.reset([[WrenchMenuController alloc] initWithBrowser:browser()]); | 78 controller_.reset([[WrenchMenuController alloc] initWithBrowser:browser()]); |
79 fake_model_.reset(new MockWrenchMenuModel); | 79 fake_model_.reset(new MockWrenchMenuModel); |
80 | 80 |
81 manager_.reset(new browser_sync::SessionsSyncManager( | 81 manager_.reset(new browser_sync::SessionsSyncManager( |
82 profile(), | 82 profile(), |
83 local_device_.get(), | 83 local_device_.get(), |
84 scoped_ptr<browser_sync::LocalSessionEventRouter>( | 84 scoped_ptr<browser_sync::LocalSessionEventRouter>( |
85 new DummyRouter()))); | 85 new DummyRouter()))); |
86 manager_->MergeDataAndStartSyncing( | 86 manager_->MergeDataAndStartSyncing( |
87 syncer::SESSIONS, | 87 syncer::SESSIONS, |
88 syncer::SyncDataList(), | 88 syncer::SyncDataList(), |
89 scoped_ptr<syncer::SyncChangeProcessor>( | 89 scoped_ptr<syncer::SyncChangeProcessor>( |
90 new syncer::FakeSyncChangeProcessor), | 90 new syncer::FakeSyncChangeProcessor), |
91 scoped_ptr<syncer::SyncErrorFactory>( | 91 scoped_ptr<syncer::SyncErrorFactory>( |
92 new syncer::SyncErrorFactoryMock)); | 92 new syncer::SyncErrorFactoryMock)); |
93 } | 93 } |
94 | 94 |
95 void RegisterRecentTabs(RecentTabsBuilderTestHelper* helper) { | 95 void RegisterRecentTabs(RecentTabsBuilderTestHelper* helper) { |
96 helper->ExportToSessionsSyncManager(manager_.get()); | 96 helper->ExportToSessionsSyncManager(manager_.get()); |
97 } | 97 } |
98 | 98 |
99 browser_sync::OpenTabsUIDelegate* GetOpenTabsDelegate() { | 99 browser_sync::OpenTabsUIDelegate* GetOpenTabsDelegate() { |
100 return manager_.get(); | 100 return manager_.get(); |
101 } | 101 } |
102 | 102 |
103 virtual void TearDown() OVERRIDE { | 103 virtual void TearDown() override { |
104 fake_model_.reset(); | 104 fake_model_.reset(); |
105 controller_.reset(); | 105 controller_.reset(); |
106 manager_.reset(); | 106 manager_.reset(); |
107 CocoaProfileTest::TearDown(); | 107 CocoaProfileTest::TearDown(); |
108 } | 108 } |
109 | 109 |
110 WrenchMenuController* controller() { | 110 WrenchMenuController* controller() { |
111 return controller_.get(); | 111 return controller_.get(); |
112 } | 112 } |
113 | 113 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model | 234 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model |
235 // it's observing. | 235 // it's observing. |
236 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { | 236 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { |
237 [controller_ menuNeedsUpdate:[controller_ menu]]; | 237 [controller_ menuNeedsUpdate:[controller_ menu]]; |
238 // If the delete order is wrong then the test will crash on exit. | 238 // If the delete order is wrong then the test will crash on exit. |
239 } | 239 } |
240 | 240 |
241 } // namespace | 241 } // namespace |
OLD | NEW |