Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chrome/browser/ui/cocoa/app_menu/app_menu_controller_unittest.mm

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 public: 53 public:
54 ~DummyRouter() override {} 54 ~DummyRouter() override {}
55 void StartRoutingTo( 55 void StartRoutingTo(
56 sync_sessions::LocalSessionEventHandler* handler) override {} 56 sync_sessions::LocalSessionEventHandler* handler) override {}
57 void Stop() override {} 57 void Stop() override {}
58 }; 58 };
59 59
60 class AppMenuControllerTest : public CocoaProfileTest { 60 class AppMenuControllerTest : public CocoaProfileTest {
61 public: 61 public:
62 AppMenuControllerTest() 62 AppMenuControllerTest()
63 : local_device_(new sync_driver::LocalDeviceInfoProviderMock( 63 : local_device_(new syncer::LocalDeviceInfoProviderMock(
64 "AppMenuControllerTest", 64 "AppMenuControllerTest",
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 }
71 70
72 void SetUp() override { 71 void SetUp() override {
73 CocoaProfileTest::SetUp(); 72 CocoaProfileTest::SetUp();
74 ASSERT_TRUE(browser()); 73 ASSERT_TRUE(browser());
75 74
76 controller_.reset([[AppMenuController alloc] initWithBrowser:browser()]); 75 controller_.reset([[AppMenuController alloc] initWithBrowser:browser()]);
77 fake_model_.reset(new MockAppMenuModel); 76 fake_model_.reset(new MockAppMenuModel);
78 77
79 sync_prefs_.reset(new sync_driver::SyncPrefs(profile()->GetPrefs())); 78 sync_prefs_.reset(new syncer::SyncPrefs(profile()->GetPrefs()));
80 manager_.reset(new sync_sessions::SessionsSyncManager( 79 manager_.reset(new sync_sessions::SessionsSyncManager(
81 ProfileSyncServiceFactory::GetForProfile(profile()) 80 ProfileSyncServiceFactory::GetForProfile(profile())
82 ->GetSyncClient() 81 ->GetSyncClient()
83 ->GetSyncSessionsClient(), 82 ->GetSyncSessionsClient(),
84 sync_prefs_.get(), local_device_.get(), 83 sync_prefs_.get(), local_device_.get(),
85 std::unique_ptr<sync_sessions::LocalSessionEventRouter>( 84 std::unique_ptr<sync_sessions::LocalSessionEventRouter>(
86 new DummyRouter()), 85 new DummyRouter()),
87 base::Closure(), base::Closure())); 86 base::Closure(), base::Closure()));
88 manager_->MergeDataAndStartSyncing( 87 manager_->MergeDataAndStartSyncing(
89 syncer::SESSIONS, syncer::SyncDataList(), 88 syncer::SESSIONS, syncer::SyncDataList(),
(...skipping 20 matching lines...) Expand all
110 109
111 AppMenuController* controller() { 110 AppMenuController* controller() {
112 return controller_.get(); 111 return controller_.get();
113 } 112 }
114 113
115 base::scoped_nsobject<AppMenuController> controller_; 114 base::scoped_nsobject<AppMenuController> controller_;
116 115
117 std::unique_ptr<MockAppMenuModel> fake_model_; 116 std::unique_ptr<MockAppMenuModel> fake_model_;
118 117
119 private: 118 private:
120 std::unique_ptr<sync_driver::SyncPrefs> sync_prefs_; 119 std::unique_ptr<syncer::SyncPrefs> sync_prefs_;
121 std::unique_ptr<sync_sessions::SessionsSyncManager> manager_; 120 std::unique_ptr<sync_sessions::SessionsSyncManager> manager_;
122 std::unique_ptr<sync_driver::LocalDeviceInfoProviderMock> local_device_; 121 std::unique_ptr<syncer::LocalDeviceInfoProviderMock> local_device_;
123 }; 122 };
124 123
125 TEST_F(AppMenuControllerTest, Initialized) { 124 TEST_F(AppMenuControllerTest, Initialized) {
126 EXPECT_TRUE([controller() menu]); 125 EXPECT_TRUE([controller() menu]);
127 EXPECT_GE([[controller() menu] numberOfItems], 5); 126 EXPECT_GE([[controller() menu] numberOfItems], 5);
128 } 127 }
129 128
130 TEST_F(AppMenuControllerTest, DispatchSimple) { 129 TEST_F(AppMenuControllerTest, DispatchSimple) {
131 base::scoped_nsobject<NSButton> button([[NSButton alloc] init]); 130 base::scoped_nsobject<NSButton> button([[NSButton alloc] init]);
132 [button setTag:IDC_ZOOM_PLUS]; 131 [button setTag:IDC_ZOOM_PLUS];
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 BrowserRemovedObserver observer; 262 BrowserRemovedObserver observer;
264 // This is normally called by ToolbarController, but since |controller_| is 263 // This is normally called by ToolbarController, but since |controller_| is
265 // not owned by one, call it here. 264 // not owned by one, call it here.
266 [controller_ browserWillBeDestroyed]; 265 [controller_ browserWillBeDestroyed];
267 CloseBrowserWindow(); 266 CloseBrowserWindow();
268 observer.WaitUntilBrowserRemoved(); 267 observer.WaitUntilBrowserRemoved();
269 // |controller_| is released in TearDown(). 268 // |controller_| is released in TearDown().
270 } 269 }
271 270
272 } // namespace 271 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/avatar_button_error_controller.cc ('k') | chrome/browser/ui/passwords/manage_passwords_view_utils_desktop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698