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

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

Issue 1410013008: [Sync] Remove some http-related chrome deps from SyncBackendHostImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "chrome/browser/sync/chrome_sync_client.h" 12 #include "chrome/browser/sync/chrome_sync_client.h"
13 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" 13 #include "chrome/browser/sync/profile_sync_components_factory_impl.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 14 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/browser/sync/profile_sync_service_factory.h" 15 #include "chrome/browser/sync/profile_sync_service_factory.h"
16 #include "chrome/browser/sync/profile_sync_test_util.h"
16 #include "chrome/common/channel_info.h" 17 #include "chrome/common/channel_info.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/testing_profile.h" 19 #include "chrome/test/base/testing_profile.h"
19 #include "components/signin/core/browser/profile_oauth2_token_service.h" 20 #include "components/signin/core/browser/profile_oauth2_token_service.h"
20 #include "components/sync_driver/data_type_controller.h" 21 #include "components/sync_driver/data_type_controller.h"
21 #include "components/sync_driver/signin_manager_wrapper.h" 22 #include "components/sync_driver/signin_manager_wrapper.h"
22 #include "components/sync_driver/sync_util.h" 23 #include "components/sync_driver/sync_util.h"
23 #include "content/public/test/test_browser_thread_bundle.h" 24 #include "content/public/test/test_browser_thread_bundle.h"
24 #include "google_apis/gaia/gaia_constants.h" 25 #include "google_apis/gaia/gaia_constants.h"
25 #include "google_apis/gaia/oauth2_token_service.h" 26 #include "google_apis/gaia/oauth2_token_service.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 GetSyncServiceURL(*command_line_, chrome::GetChannel()); 112 GetSyncServiceURL(*command_line_, chrome::GetChannel());
112 ProfileOAuth2TokenService* token_service = 113 ProfileOAuth2TokenService* token_service =
113 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 114 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
114 scoped_ptr<sync_driver::SyncApiComponentFactory> factory( 115 scoped_ptr<sync_driver::SyncApiComponentFactory> factory(
115 new ProfileSyncComponentsFactoryImpl( 116 new ProfileSyncComponentsFactoryImpl(
116 profile_.get(), command_line_.get(), 117 profile_.get(), command_line_.get(),
117 GetSyncServiceURL(*command_line_, chrome::GetChannel()), 118 GetSyncServiceURL(*command_line_, chrome::GetChannel()),
118 token_service, profile_->GetRequestContext())); 119 token_service, profile_->GetRequestContext()));
119 scoped_ptr<sync_driver::SyncClient> sync_client( 120 scoped_ptr<sync_driver::SyncClient> sync_client(
120 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass())); 121 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass()));
121 scoped_ptr<ProfileSyncService> pss( 122 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService(
122 new ProfileSyncService(sync_client.Pass(), profile_.get(), 123 sync_client.Pass(), profile_.get(),
123 make_scoped_ptr<SigninManagerWrapper>(NULL), 124 make_scoped_ptr<SigninManagerWrapper>(NULL), token_service,
124 token_service, browser_sync::MANUAL_START)); 125 browser_sync::MANUAL_START, base::Bind(&EmptyNetworkTimeUpdate)));
125 pss->GetSyncClient()->Initialize(pss.get()); 126 pss->GetSyncClient()->Initialize(pss.get());
126 DataTypeController::StateMap controller_states; 127 DataTypeController::StateMap controller_states;
127 pss->GetDataTypeControllerStates(&controller_states); 128 pss->GetDataTypeControllerStates(&controller_states);
128 EXPECT_EQ(DefaultDatatypesCount() - types.Size(), controller_states.size()); 129 EXPECT_EQ(DefaultDatatypesCount() - types.Size(), controller_states.size());
129 CheckDefaultDatatypesInMapExcept(&controller_states, types); 130 CheckDefaultDatatypesInMapExcept(&controller_states, types);
130 } 131 }
131 132
132 content::TestBrowserThreadBundle thread_bundle_; 133 content::TestBrowserThreadBundle thread_bundle_;
133 scoped_ptr<Profile> profile_; 134 scoped_ptr<Profile> profile_;
134 scoped_ptr<base::CommandLine> command_line_; 135 scoped_ptr<base::CommandLine> command_line_;
135 OAuth2TokenService::ScopeSet scope_set_; 136 OAuth2TokenService::ScopeSet scope_set_;
136 }; 137 };
137 138
138 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) { 139 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) {
139 ProfileOAuth2TokenService* token_service = 140 ProfileOAuth2TokenService* token_service =
140 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 141 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
141 scoped_ptr<sync_driver::SyncApiComponentFactory> factory( 142 scoped_ptr<sync_driver::SyncApiComponentFactory> factory(
142 new ProfileSyncComponentsFactoryImpl( 143 new ProfileSyncComponentsFactoryImpl(
143 profile_.get(), command_line_.get(), 144 profile_.get(), command_line_.get(),
144 GetSyncServiceURL(*command_line_, chrome::GetChannel()), 145 GetSyncServiceURL(*command_line_, chrome::GetChannel()),
145 token_service, profile_->GetRequestContext())); 146 token_service, profile_->GetRequestContext()));
146 scoped_ptr<sync_driver::SyncClient> sync_client( 147 scoped_ptr<sync_driver::SyncClient> sync_client(
147 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass())); 148 new browser_sync::ChromeSyncClient(profile_.get(), factory.Pass()));
148 scoped_ptr<ProfileSyncService> pss( 149 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService(
149 new ProfileSyncService(sync_client.Pass(), profile_.get(), 150 sync_client.Pass(), profile_.get(),
150 make_scoped_ptr<SigninManagerWrapper>(NULL), 151 make_scoped_ptr<SigninManagerWrapper>(NULL), token_service,
151 token_service, browser_sync::MANUAL_START)); 152 browser_sync::MANUAL_START, base::Bind(&EmptyNetworkTimeUpdate)));
152 pss->GetSyncClient()->Initialize(pss.get()); 153 pss->GetSyncClient()->Initialize(pss.get());
153 DataTypeController::StateMap controller_states; 154 DataTypeController::StateMap controller_states;
154 pss->GetDataTypeControllerStates(&controller_states); 155 pss->GetDataTypeControllerStates(&controller_states);
155 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size()); 156 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size());
156 CheckDefaultDatatypesInMapExcept(&controller_states, syncer::ModelTypeSet()); 157 CheckDefaultDatatypesInMapExcept(&controller_states, syncer::ModelTypeSet());
157 } 158 }
158 159
159 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) { 160 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) {
160 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL)); 161 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL));
161 } 162 }
162 163
163 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) { 164 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) {
164 TestSwitchDisablesType( 165 TestSwitchDisablesType(
165 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS)); 166 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS));
166 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_mock.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698