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

Side by Side Diff: chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc

Issue 1422773004: [sync] Abstract most ProfileSyncService //chrome deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pss_chrome_signin_deps
Patch Set: Response to review Created 5 years, 1 month 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 <vector> 5 #include <vector>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 scoped_ptr<sync_driver::SyncApiComponentFactory> factory( 115 scoped_ptr<sync_driver::SyncApiComponentFactory> factory(
116 new ProfileSyncComponentsFactoryImpl( 116 new ProfileSyncComponentsFactoryImpl(
117 profile_.get(), command_line_.get(), 117 profile_.get(), command_line_.get(),
118 GetSyncServiceURL(*command_line_, chrome::GetChannel()), 118 GetSyncServiceURL(*command_line_, chrome::GetChannel()),
119 token_service, profile_->GetRequestContext())); 119 token_service, profile_->GetRequestContext()));
120 scoped_ptr<sync_driver::SyncClient> sync_client( 120 scoped_ptr<sync_driver::SyncClient> sync_client(
121 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass())); 121 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass()));
122 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService( 122 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService(
123 sync_client.Pass(), profile_.get(), 123 sync_client.Pass(), profile_.get(),
124 make_scoped_ptr<SigninManagerWrapper>(NULL), token_service, 124 make_scoped_ptr<SigninManagerWrapper>(NULL), token_service,
125 browser_sync::MANUAL_START, base::Bind(&EmptyNetworkTimeUpdate))); 125 browser_sync::MANUAL_START, base::Bind(&EmptyNetworkTimeUpdate),
126 profile_->GetPath(), profile_->GetRequestContext(),
127 profile_->GetDebugName(), chrome::GetChannel(),
128 content::BrowserThread::GetMessageLoopProxyForThread(
129 content::BrowserThread::DB),
130 content::BrowserThread::GetMessageLoopProxyForThread(
131 content::BrowserThread::FILE),
132 content::BrowserThread::GetBlockingPool()));
126 pss->GetSyncClient()->Initialize(pss.get()); 133 pss->GetSyncClient()->Initialize(pss.get());
127 DataTypeController::StateMap controller_states; 134 DataTypeController::StateMap controller_states;
128 pss->GetDataTypeControllerStates(&controller_states); 135 pss->GetDataTypeControllerStates(&controller_states);
129 EXPECT_EQ(DefaultDatatypesCount() - types.Size(), controller_states.size()); 136 EXPECT_EQ(DefaultDatatypesCount() - types.Size(), controller_states.size());
130 CheckDefaultDatatypesInMapExcept(&controller_states, types); 137 CheckDefaultDatatypesInMapExcept(&controller_states, types);
131 } 138 }
132 139
133 content::TestBrowserThreadBundle thread_bundle_; 140 content::TestBrowserThreadBundle thread_bundle_;
134 scoped_ptr<Profile> profile_; 141 scoped_ptr<Profile> profile_;
135 scoped_ptr<base::CommandLine> command_line_; 142 scoped_ptr<base::CommandLine> command_line_;
136 OAuth2TokenService::ScopeSet scope_set_; 143 OAuth2TokenService::ScopeSet scope_set_;
137 }; 144 };
138 145
139 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) { 146 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) {
140 ProfileOAuth2TokenService* token_service = 147 ProfileOAuth2TokenService* token_service =
141 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 148 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
142 scoped_ptr<sync_driver::SyncApiComponentFactory> factory( 149 scoped_ptr<sync_driver::SyncApiComponentFactory> factory(
143 new ProfileSyncComponentsFactoryImpl( 150 new ProfileSyncComponentsFactoryImpl(
144 profile_.get(), command_line_.get(), 151 profile_.get(), command_line_.get(),
145 GetSyncServiceURL(*command_line_, chrome::GetChannel()), 152 GetSyncServiceURL(*command_line_, chrome::GetChannel()),
146 token_service, profile_->GetRequestContext())); 153 token_service, profile_->GetRequestContext()));
147 scoped_ptr<sync_driver::SyncClient> sync_client( 154 scoped_ptr<sync_driver::SyncClient> sync_client(
148 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass())); 155 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass()));
149 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService( 156 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService(
150 sync_client.Pass(), profile_.get(), 157 sync_client.Pass(), profile_.get(),
151 make_scoped_ptr<SigninManagerWrapper>(NULL), token_service, 158 make_scoped_ptr<SigninManagerWrapper>(NULL), token_service,
152 browser_sync::MANUAL_START, base::Bind(&EmptyNetworkTimeUpdate))); 159 browser_sync::MANUAL_START, base::Bind(&EmptyNetworkTimeUpdate),
160 profile_->GetPath(), profile_->GetRequestContext(),
161 profile_->GetDebugName(), chrome::GetChannel(),
162 content::BrowserThread::GetMessageLoopProxyForThread(
163 content::BrowserThread::DB),
164 content::BrowserThread::GetMessageLoopProxyForThread(
165 content::BrowserThread::FILE),
166 content::BrowserThread::GetBlockingPool()));
153 pss->GetSyncClient()->Initialize(pss.get()); 167 pss->GetSyncClient()->Initialize(pss.get());
154 DataTypeController::StateMap controller_states; 168 DataTypeController::StateMap controller_states;
155 pss->GetDataTypeControllerStates(&controller_states); 169 pss->GetDataTypeControllerStates(&controller_states);
156 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size()); 170 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size());
157 CheckDefaultDatatypesInMapExcept(&controller_states, syncer::ModelTypeSet()); 171 CheckDefaultDatatypesInMapExcept(&controller_states, syncer::ModelTypeSet());
158 } 172 }
159 173
160 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) { 174 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) {
161 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL)); 175 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL));
162 } 176 }
163 177
164 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) { 178 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) {
165 TestSwitchDisablesType( 179 TestSwitchDisablesType(
166 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS)); 180 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS));
167 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698