| 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 "chrome/browser/sync/test_profile_sync_service.h" | 5 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/managed_mode/managed_user_signin_manager_wrapper.h" | 8 #include "chrome/browser/managed_mode/managed_user_signin_manager_wrapper.h" |
| 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 10 #include "chrome/browser/signin/signin_manager.h" | 10 #include "chrome/browser/signin/signin_manager.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 syncer::WeakHandle<syncer::JsEventHandler> | 94 syncer::WeakHandle<syncer::JsEventHandler> |
| 95 TestProfileSyncService::GetJsEventHandler() { | 95 TestProfileSyncService::GetJsEventHandler() { |
| 96 return syncer::WeakHandle<syncer::JsEventHandler>(); | 96 return syncer::WeakHandle<syncer::JsEventHandler>(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 TestProfileSyncService::TestProfileSyncService( | 99 TestProfileSyncService::TestProfileSyncService( |
| 100 ProfileSyncComponentsFactory* factory, | 100 ProfileSyncComponentsFactory* factory, |
| 101 Profile* profile, | 101 Profile* profile, |
| 102 SigninManagerBase* signin, | 102 SigninManagerBase* signin, |
| 103 ProfileOAuth2TokenService* oauth2_token_service, | 103 ProfileOAuth2TokenService* oauth2_token_service, |
| 104 ProfileSyncService::StartBehavior behavior) | 104 browser_sync::ProfileSyncServiceStartBehavior behavior) |
| 105 : ProfileSyncService(factory, | 105 : ProfileSyncService(factory, |
| 106 profile, | 106 profile, |
| 107 new ManagedUserSigninManagerWrapper(signin), | 107 new ManagedUserSigninManagerWrapper(signin), |
| 108 oauth2_token_service, | 108 oauth2_token_service, |
| 109 behavior) { | 109 behavior) { |
| 110 SetSyncSetupCompleted(); | 110 SetSyncSetupCompleted(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 TestProfileSyncService::~TestProfileSyncService() { | 113 TestProfileSyncService::~TestProfileSyncService() { |
| 114 } | 114 } |
| 115 | 115 |
| 116 // static | 116 // static |
| 117 BrowserContextKeyedService* TestProfileSyncService::TestFactoryFunction( | 117 BrowserContextKeyedService* TestProfileSyncService::TestFactoryFunction( |
| 118 content::BrowserContext* context) { | 118 content::BrowserContext* context) { |
| 119 Profile* profile = static_cast<Profile*>(context); | 119 Profile* profile = static_cast<Profile*>(context); |
| 120 SigninManagerBase* signin = | 120 SigninManagerBase* signin = |
| 121 SigninManagerFactory::GetForProfile(profile); | 121 SigninManagerFactory::GetForProfile(profile); |
| 122 ProfileOAuth2TokenService* oauth2_token_service = | 122 ProfileOAuth2TokenService* oauth2_token_service = |
| 123 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 123 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 124 ProfileSyncComponentsFactoryMock* factory = | 124 ProfileSyncComponentsFactoryMock* factory = |
| 125 new ProfileSyncComponentsFactoryMock(); | 125 new ProfileSyncComponentsFactoryMock(); |
| 126 return new TestProfileSyncService(factory, | 126 return new TestProfileSyncService(factory, |
| 127 profile, | 127 profile, |
| 128 signin, | 128 signin, |
| 129 oauth2_token_service, | 129 oauth2_token_service, |
| 130 ProfileSyncService::AUTO_START); | 130 browser_sync::AUTO_START); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // static | 133 // static |
| 134 TestProfileSyncService* TestProfileSyncService::BuildAutoStartAsyncInit( | 134 TestProfileSyncService* TestProfileSyncService::BuildAutoStartAsyncInit( |
| 135 Profile* profile, base::Closure callback) { | 135 Profile* profile, base::Closure callback) { |
| 136 TestProfileSyncService* sync_service = static_cast<TestProfileSyncService*>( | 136 TestProfileSyncService* sync_service = static_cast<TestProfileSyncService*>( |
| 137 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 137 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 138 profile, &TestProfileSyncService::TestFactoryFunction)); | 138 profile, &TestProfileSyncService::TestFactoryFunction)); |
| 139 ProfileSyncComponentsFactoryMock* components = | 139 ProfileSyncComponentsFactoryMock* components = |
| 140 sync_service->components_factory_mock(); | 140 sync_service->components_factory_mock(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 157 | 157 |
| 158 void TestProfileSyncService::OnConfigureDone( | 158 void TestProfileSyncService::OnConfigureDone( |
| 159 const browser_sync::DataTypeManager::ConfigureResult& result) { | 159 const browser_sync::DataTypeManager::ConfigureResult& result) { |
| 160 ProfileSyncService::OnConfigureDone(result); | 160 ProfileSyncService::OnConfigureDone(result); |
| 161 base::MessageLoop::current()->Quit(); | 161 base::MessageLoop::current()->Quit(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 UserShare* TestProfileSyncService::GetUserShare() const { | 164 UserShare* TestProfileSyncService::GetUserShare() const { |
| 165 return backend_->GetUserShare(); | 165 return backend_->GetUserShare(); |
| 166 } | 166 } |
| OLD | NEW |