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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // inject TokenService alongside SigninManager. | 124 // inject TokenService alongside SigninManager. |
122 TestProfileSyncService( | 125 TestProfileSyncService( |
123 ProfileSyncComponentsFactory* factory, | 126 ProfileSyncComponentsFactory* factory, |
124 Profile* profile, | 127 Profile* profile, |
125 SigninManagerBase* signin, | 128 SigninManagerBase* signin, |
126 ProfileSyncService::StartBehavior behavior, | 129 ProfileSyncService::StartBehavior behavior, |
127 bool synchronous_backend_initialization); | 130 bool synchronous_backend_initialization); |
128 | 131 |
129 virtual ~TestProfileSyncService(); | 132 virtual ~TestProfileSyncService(); |
130 | 133 |
| 134 virtual void RequestAccessToken() OVERRIDE; |
| 135 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 136 const GoogleServiceAuthError& error) OVERRIDE; |
| 137 |
131 virtual void OnBackendInitialized( | 138 virtual void OnBackendInitialized( |
132 const syncer::WeakHandle<syncer::JsBackend>& backend, | 139 const syncer::WeakHandle<syncer::JsBackend>& backend, |
133 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 140 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
134 debug_info_listener, | 141 debug_info_listener, |
135 bool success) OVERRIDE; | 142 bool success) OVERRIDE; |
136 | 143 |
137 virtual void OnConfigureDone( | 144 virtual void OnConfigureDone( |
138 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE; | 145 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE; |
139 | 146 |
140 // We implement our own version to avoid some DCHECKs. | 147 // We implement our own version to avoid some DCHECKs. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // step is performed synchronously. | 188 // step is performed synchronously. |
182 bool synchronous_sync_configuration_; | 189 bool synchronous_sync_configuration_; |
183 | 190 |
184 base::Closure callback_; | 191 base::Closure callback_; |
185 bool set_initial_sync_ended_on_init_; | 192 bool set_initial_sync_ended_on_init_; |
186 | 193 |
187 bool fail_initial_download_; | 194 bool fail_initial_download_; |
188 syncer::StorageOption storage_option_; | 195 syncer::StorageOption storage_option_; |
189 }; | 196 }; |
190 | 197 |
| 198 |
| 199 class FakeOAuth2TokenService : public ProfileOAuth2TokenService { |
| 200 public: |
| 201 explicit FakeOAuth2TokenService(net::URLRequestContextGetter* getter) |
| 202 : ProfileOAuth2TokenService(getter) {} |
| 203 |
| 204 virtual scoped_ptr<OAuth2TokenService::Request> StartRequest( |
| 205 const OAuth2TokenService::ScopeSet& scopes, |
| 206 OAuth2TokenService::Consumer* consumer) OVERRIDE; |
| 207 |
| 208 static BrowserContextKeyedService* BuildTokenService( |
| 209 content::BrowserContext* context); |
| 210 }; |
| 211 |
191 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 212 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |