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/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/browser/sync/profile_sync_service.h" |
11 #include "chrome/browser/sync/profile_sync_service_factory.h" | 12 #include "chrome/browser/sync/profile_sync_service_factory.h" |
12 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" | 13 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
13 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
14 #include "chrome/browser/ui/browser_list_observer.h" | 15 #include "chrome/browser/ui/browser_list_observer.h" |
15 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 16 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
16 #include "chrome/browser/ui/cocoa/run_loop_testing.h" | 17 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 18 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
18 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" | 19 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" |
19 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" | 20 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" |
20 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" | 21 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" |
21 #include "chrome/browser/ui/toolbar/app_menu_model.h" | 22 #include "chrome/browser/ui/toolbar/app_menu_model.h" |
22 #include "chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h" | 23 #include "chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h" |
23 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" | 24 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
26 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
27 #include "components/sync_driver/local_device_info_provider_mock.h" | 28 #include "components/sync_driver/local_device_info_provider_mock.h" |
| 29 #include "components/sync_driver/sync_client.h" |
28 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
29 #include "sync/api/fake_sync_change_processor.h" | 31 #include "sync/api/fake_sync_change_processor.h" |
30 #include "sync/api/sync_error_factory_mock.h" | 32 #include "sync/api/sync_error_factory_mock.h" |
31 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
33 #include "testing/gtest_mac.h" | 35 #include "testing/gtest_mac.h" |
34 #include "testing/platform_test.h" | 36 #include "testing/platform_test.h" |
35 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
36 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
37 | 39 |
(...skipping 28 matching lines...) Expand all Loading... |
66 } | 68 } |
67 | 69 |
68 void SetUp() override { | 70 void SetUp() override { |
69 CocoaProfileTest::SetUp(); | 71 CocoaProfileTest::SetUp(); |
70 ASSERT_TRUE(browser()); | 72 ASSERT_TRUE(browser()); |
71 | 73 |
72 controller_.reset([[WrenchMenuController alloc] initWithBrowser:browser()]); | 74 controller_.reset([[WrenchMenuController alloc] initWithBrowser:browser()]); |
73 fake_model_.reset(new MockAppMenuModel); | 75 fake_model_.reset(new MockAppMenuModel); |
74 | 76 |
75 manager_.reset(new browser_sync::SessionsSyncManager( | 77 manager_.reset(new browser_sync::SessionsSyncManager( |
76 profile(), | 78 ProfileSyncServiceFactory::GetForProfile(profile()) |
77 local_device_.get(), | 79 ->GetSyncClient() |
78 scoped_ptr<browser_sync::LocalSessionEventRouter>( | 80 ->GetSyncSessionsClient(), |
79 new DummyRouter()), | 81 profile(), local_device_.get(), |
80 scoped_ptr<browser_sync::SyncedWindowDelegatesGetter>( | 82 scoped_ptr<browser_sync::LocalSessionEventRouter>(new DummyRouter()))); |
81 new browser_sync::BrowserSyncedWindowDelegatesGetter()))); | |
82 manager_->MergeDataAndStartSyncing( | 83 manager_->MergeDataAndStartSyncing( |
83 syncer::SESSIONS, | 84 syncer::SESSIONS, |
84 syncer::SyncDataList(), | 85 syncer::SyncDataList(), |
85 scoped_ptr<syncer::SyncChangeProcessor>( | 86 scoped_ptr<syncer::SyncChangeProcessor>( |
86 new syncer::FakeSyncChangeProcessor), | 87 new syncer::FakeSyncChangeProcessor), |
87 scoped_ptr<syncer::SyncErrorFactory>( | 88 scoped_ptr<syncer::SyncErrorFactory>( |
88 new syncer::SyncErrorFactoryMock)); | 89 new syncer::SyncErrorFactoryMock)); |
89 } | 90 } |
90 | 91 |
91 void RegisterRecentTabs(RecentTabsBuilderTestHelper* helper) { | 92 void RegisterRecentTabs(RecentTabsBuilderTestHelper* helper) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 BrowserRemovedObserver observer; | 258 BrowserRemovedObserver observer; |
258 // This is normally called by ToolbarController, but since |controller_| is | 259 // This is normally called by ToolbarController, but since |controller_| is |
259 // not owned by one, call it here. | 260 // not owned by one, call it here. |
260 [controller_ browserWillBeDestroyed]; | 261 [controller_ browserWillBeDestroyed]; |
261 CloseBrowserWindow(); | 262 CloseBrowserWindow(); |
262 observer.WaitUntilBrowserRemoved(); | 263 observer.WaitUntilBrowserRemoved(); |
263 // |controller_| is released in TearDown(). | 264 // |controller_| is released in TearDown(). |
264 } | 265 } |
265 | 266 |
266 } // namespace | 267 } // namespace |
OLD | NEW |