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

Unified Diff: chrome/browser/sync/test_profile_sync_service.h

Issue 67683005: Clean up TestProfileSyncService and related tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test_profile_sync_service.h
diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h
index 63578346d3882a150b3bc763578cca4cf74dd1d5..22b20a46c498d30110a9d51dea8d9ea000abe1db 100644
--- a/chrome/browser/sync/test_profile_sync_service.h
+++ b/chrome/browser/sync/test_profile_sync_service.h
@@ -10,21 +10,18 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/invalidation/invalidator_storage.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
-#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/sync/glue/data_type_manager_impl.h"
#include "chrome/browser/sync/glue/sync_backend_host_impl.h"
-#include "chrome/browser/sync/profile_sync_components_factory_mock.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_prefs.h"
-#include "chrome/test/base/profile_mock.h"
-#include "google_apis/gaia/oauth2_token_service.h"
-#include "sync/internal_api/public/test/test_internal_components_factory.h"
#include "sync/test/engine/test_id_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
class Profile;
+class ProfileOAuth2TokenService;
+class ProfileSyncComponentsFactory;
+class ProfileSyncComponentsFactoryMock;
ACTION(ReturnNewDataTypeManager) {
return new browser_sync::DataTypeManagerImpl(arg0,
@@ -39,24 +36,12 @@ namespace browser_sync {
class SyncBackendHostForProfileSyncTest : public SyncBackendHostImpl {
public:
- // |synchronous_init| causes initialization to block until the syncapi has
- // completed setting itself up and called us back.
- // TOOD(akalin): Remove |synchronous_init| (http://crbug.com/140354).
SyncBackendHostForProfileSyncTest(
Profile* profile,
const base::WeakPtr<SyncPrefs>& sync_prefs,
- base::Closure& callback,
- bool set_initial_sync_ended_on_init,
- bool synchronous_init,
- bool fail_initial_download,
- syncer::StorageOption storage_option);
+ base::Closure& callback);
virtual ~SyncBackendHostForProfileSyncTest();
- MOCK_METHOD1(RequestNudge, void(const tracked_objects::Location&));
-
- virtual void UpdateCredentials(
- const syncer::SyncCredentials& credentials) OVERRIDE;
-
virtual void RequestConfigureSyncer(
syncer::ConfigureReason reason,
syncer::ModelTypeSet to_download,
@@ -69,66 +54,29 @@ class SyncBackendHostForProfileSyncTest : public SyncBackendHostImpl {
syncer::ModelTypeSet)>& ready_task,
const base::Closure& retry_callback) OVERRIDE;
- virtual void HandleInitializationSuccessOnFrontendLoop(
- const syncer::WeakHandle<syncer::JsBackend> js_backend,
- const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>
- debug_info_listener) OVERRIDE;
-
protected:
virtual void InitCore(scoped_ptr<DoInitializeOptions> options) OVERRIDE;
private:
-
-
// Invoked at the start of HandleSyncManagerInitializationOnFrontendLoop.
// Allows extra initialization work to be performed before the backend comes
// up.
base::Closure& callback_;
-
- // Saved closure in case we failed the initial download but then received
- // new credentials. Holds the results of
- // HandleSyncManagerInitializationOnFrontendLoop, and if
- // |fail_initial_download_| was true, finishes the initialization process
- // once we receive new credentials.
- base::Closure initial_download_closure_;
- bool fail_initial_download_;
-
- bool set_initial_sync_ended_on_init_;
- bool synchronous_init_;
- syncer::StorageOption storage_option_;
-
- base::WeakPtrFactory<SyncBackendHostForProfileSyncTest> weak_ptr_factory_;
};
} // namespace browser_sync
class TestProfileSyncService : public ProfileSyncService {
public:
- // TODO(tim): Remove |synchronous_backend_initialization|, and add ability to
- // inject TokenService alongside SigninManager.
TestProfileSyncService(
ProfileSyncComponentsFactory* factory,
Profile* profile,
SigninManagerBase* signin,
ProfileOAuth2TokenService* oauth2_token_service,
- ProfileSyncService::StartBehavior behavior,
- bool synchronous_backend_initialization);
+ ProfileSyncService::StartBehavior behavior);
virtual ~TestProfileSyncService();
- virtual void RequestAccessToken() OVERRIDE;
- virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
- const std::string& access_token,
- const base::Time& expiration_time) OVERRIDE;
- virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
- const GoogleServiceAuthError& error) OVERRIDE;
-
- virtual void OnBackendInitialized(
- const syncer::WeakHandle<syncer::JsBackend>& backend,
- const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
- debug_info_listener,
- bool success) OVERRIDE;
-
virtual void OnConfigureDone(
const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE;
@@ -140,16 +88,6 @@ class TestProfileSyncService : public ProfileSyncService {
ProfileSyncComponentsFactoryMock* components_factory_mock();
- // If this is called, configuring data types will require a syncer
- // nudge.
- void dont_set_initial_sync_ended_on_init();
- void set_synchronous_sync_configuration();
-
- // Fails initial download until a new auth token is provided.
- void fail_initial_download();
-
- void set_storage_option(syncer::StorageOption option);
-
// |callback| can be used to populate nodes before the OnBackendInitialized
// callback fires.
void set_backend_init_callback(const base::Closure& callback) {
@@ -158,12 +96,6 @@ class TestProfileSyncService : public ProfileSyncService {
syncer::TestIdFactory* id_factory();
- // Override of ProfileSyncService::GetBackendForTest() with a more
- // specific return type (since C++ supports covariant return types)
- // that is made public.
- virtual browser_sync::SyncBackendHostForProfileSyncTest*
- GetBackendForTest() OVERRIDE;
-
protected:
virtual void CreateBackend() OVERRIDE;
@@ -176,17 +108,7 @@ class TestProfileSyncService : public ProfileSyncService {
private:
syncer::TestIdFactory id_factory_;
- bool synchronous_backend_initialization_;
-
- // Set to true when a mock data type manager is being used and the configure
- // step is performed synchronously.
- bool synchronous_sync_configuration_;
-
base::Closure callback_;
- bool set_initial_sync_ended_on_init_;
-
- bool fail_initial_download_;
- syncer::StorageOption storage_option_;
};
#endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698