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

Side by Side Diff: chrome/browser/sync/test_profile_sync_service.h

Issue 15421011: Use OAuth2 token for sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove token prefetch. Move UMA counters. Fix some tests. Etc. Created 7 years, 6 months 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 #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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // inject TokenService alongside SigninManager. 117 // inject TokenService alongside SigninManager.
115 TestProfileSyncService( 118 TestProfileSyncService(
116 ProfileSyncComponentsFactory* factory, 119 ProfileSyncComponentsFactory* factory,
117 Profile* profile, 120 Profile* profile,
118 SigninManagerBase* signin, 121 SigninManagerBase* signin,
119 ProfileSyncService::StartBehavior behavior, 122 ProfileSyncService::StartBehavior behavior,
120 bool synchronous_backend_initialization); 123 bool synchronous_backend_initialization);
121 124
122 virtual ~TestProfileSyncService(); 125 virtual ~TestProfileSyncService();
123 126
127 virtual void RequestAccessToken() OVERRIDE;
128 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
129 const GoogleServiceAuthError& error) OVERRIDE;
130
124 virtual void OnBackendInitialized( 131 virtual void OnBackendInitialized(
125 const syncer::WeakHandle<syncer::JsBackend>& backend, 132 const syncer::WeakHandle<syncer::JsBackend>& backend,
126 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 133 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
127 debug_info_listener, 134 debug_info_listener,
128 bool success) OVERRIDE; 135 bool success) OVERRIDE;
129 136
130 virtual void OnConfigureDone( 137 virtual void OnConfigureDone(
131 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE; 138 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE;
132 139
133 // We implement our own version to avoid some DCHECKs. 140 // We implement our own version to avoid some DCHECKs.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // step is performed synchronously. 181 // step is performed synchronously.
175 bool synchronous_sync_configuration_; 182 bool synchronous_sync_configuration_;
176 183
177 base::Closure callback_; 184 base::Closure callback_;
178 bool set_initial_sync_ended_on_init_; 185 bool set_initial_sync_ended_on_init_;
179 186
180 bool fail_initial_download_; 187 bool fail_initial_download_;
181 syncer::StorageOption storage_option_; 188 syncer::StorageOption storage_option_;
182 }; 189 };
183 190
191
192 class FakeOAuth2TokenService : public ProfileOAuth2TokenService {
193 public:
194 explicit FakeOAuth2TokenService(net::URLRequestContextGetter* getter)
195 : ProfileOAuth2TokenService(getter) {}
196
197 virtual scoped_ptr<OAuth2TokenService::Request> StartRequest(
198 const OAuth2TokenService::ScopeSet& scopes,
199 OAuth2TokenService::Consumer* consumer);
200
201 static BrowserContextKeyedService* BuildTokenService(
202 content::BrowserContext* context);
203 };
204
184 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ 205 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698