| 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 #ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/invalidation/invalidator_storage.h" | 13 #include "chrome/browser/invalidation/invalidator_storage.h" |
| 14 #include "chrome/browser/signin/oauth2_token_service.h" |
| 15 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 14 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 17 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
| 15 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 18 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 16 #include "chrome/browser/sync/profile_sync_service.h" | 19 #include "chrome/browser/sync/profile_sync_service.h" |
| 17 #include "chrome/browser/sync/sync_prefs.h" | 20 #include "chrome/browser/sync/sync_prefs.h" |
| 18 #include "chrome/test/base/profile_mock.h" | 21 #include "chrome/test/base/profile_mock.h" |
| 19 #include "sync/internal_api/public/test/test_internal_components_factory.h" | 22 #include "sync/internal_api/public/test/test_internal_components_factory.h" |
| 20 #include "sync/test/engine/test_id_factory.h" | 23 #include "sync/test/engine/test_id_factory.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 22 | 25 |
| 23 class Profile; | 26 class Profile; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // inject TokenService alongside SigninManager. | 122 // inject TokenService alongside SigninManager. |
| 120 TestProfileSyncService( | 123 TestProfileSyncService( |
| 121 ProfileSyncComponentsFactory* factory, | 124 ProfileSyncComponentsFactory* factory, |
| 122 Profile* profile, | 125 Profile* profile, |
| 123 SigninManagerBase* signin, | 126 SigninManagerBase* signin, |
| 124 ProfileSyncService::StartBehavior behavior, | 127 ProfileSyncService::StartBehavior behavior, |
| 125 bool synchronous_backend_initialization); | 128 bool synchronous_backend_initialization); |
| 126 | 129 |
| 127 virtual ~TestProfileSyncService(); | 130 virtual ~TestProfileSyncService(); |
| 128 | 131 |
| 132 virtual void RequestAccessToken() OVERRIDE; |
| 133 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 134 const GoogleServiceAuthError& error) OVERRIDE; |
| 135 |
| 129 virtual void OnBackendInitialized( | 136 virtual void OnBackendInitialized( |
| 130 const syncer::WeakHandle<syncer::JsBackend>& backend, | 137 const syncer::WeakHandle<syncer::JsBackend>& backend, |
| 131 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 138 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
| 132 debug_info_listener, | 139 debug_info_listener, |
| 133 bool success) OVERRIDE; | 140 bool success) OVERRIDE; |
| 134 | 141 |
| 135 virtual void OnConfigureDone( | 142 virtual void OnConfigureDone( |
| 136 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE; | 143 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE; |
| 137 | 144 |
| 138 // We implement our own version to avoid some DCHECKs. | 145 // We implement our own version to avoid some DCHECKs. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // step is performed synchronously. | 186 // step is performed synchronously. |
| 180 bool synchronous_sync_configuration_; | 187 bool synchronous_sync_configuration_; |
| 181 | 188 |
| 182 base::Closure callback_; | 189 base::Closure callback_; |
| 183 bool set_initial_sync_ended_on_init_; | 190 bool set_initial_sync_ended_on_init_; |
| 184 | 191 |
| 185 bool fail_initial_download_; | 192 bool fail_initial_download_; |
| 186 syncer::StorageOption storage_option_; | 193 syncer::StorageOption storage_option_; |
| 187 }; | 194 }; |
| 188 | 195 |
| 196 |
| 197 class FakeOAuth2TokenService : public ProfileOAuth2TokenService { |
| 198 public: |
| 199 explicit FakeOAuth2TokenService(net::URLRequestContextGetter* getter) |
| 200 : ProfileOAuth2TokenService(getter) {} |
| 201 |
| 202 virtual scoped_ptr<OAuth2TokenService::Request> StartRequest( |
| 203 const OAuth2TokenService::ScopeSet& scopes, |
| 204 OAuth2TokenService::Consumer* consumer) OVERRIDE; |
| 205 |
| 206 static BrowserContextKeyedService* BuildTokenService( |
| 207 content::BrowserContext* context); |
| 208 }; |
| 209 |
| 189 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 210 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |