| 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 cb9e46fb4e1f5d372d9541656e07c87c2b3d25c0..9d990f7bc51f5f9809fcddbc412ce157b31673d2 100644
|
| --- a/chrome/browser/sync/test_profile_sync_service.h
|
| +++ b/chrome/browser/sync/test_profile_sync_service.h
|
| @@ -11,6 +11,9 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "chrome/browser/invalidation/invalidator_storage.h"
|
| +#include "chrome/browser/signin/oauth2_token_service.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/profile_sync_components_factory_mock.h"
|
| #include "chrome/browser/sync/profile_sync_service.h"
|
| @@ -30,6 +33,20 @@ ACTION(ReturnNewDataTypeManager) {
|
|
|
| namespace browser_sync {
|
|
|
| +// MessageLoopRunner::Run() may be called multiple times recursively. Only first
|
| +// call will execute MessageLoop::current()->Run().
|
| +class MessageLoopRunner {
|
| + public:
|
| + MessageLoopRunner();
|
| + ~MessageLoopRunner();
|
| +
|
| + void Run();
|
| + void Quit();
|
| +
|
| + private:
|
| + bool running_;
|
| +};
|
| +
|
| class SyncBackendHostForProfileSyncTest : public SyncBackendHost {
|
| public:
|
| // |synchronous_init| causes initialization to block until the syncapi has
|
| @@ -45,7 +62,8 @@ class SyncBackendHostForProfileSyncTest : public SyncBackendHost {
|
| bool set_initial_sync_ended_on_init,
|
| bool synchronous_init,
|
| bool fail_initial_download,
|
| - syncer::StorageOption storage_option);
|
| + syncer::StorageOption storage_option,
|
| + MessageLoopRunner* message_loop_runner);
|
| virtual ~SyncBackendHostForProfileSyncTest();
|
|
|
| MOCK_METHOD1(RequestNudge, void(const tracked_objects::Location&));
|
| @@ -104,6 +122,7 @@ class SyncBackendHostForProfileSyncTest : public SyncBackendHost {
|
| bool set_initial_sync_ended_on_init_;
|
| bool synchronous_init_;
|
| syncer::StorageOption storage_option_;
|
| + MessageLoopRunner* message_loop_runner_;
|
| };
|
|
|
| } // namespace browser_sync
|
| @@ -121,6 +140,12 @@ class TestProfileSyncService : public ProfileSyncService {
|
|
|
| virtual ~TestProfileSyncService();
|
|
|
| + virtual void RequestAccessToken(
|
| + bool invalidate_previous_token,
|
| + bool invoke_callback) 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>&
|
| @@ -179,6 +204,21 @@ class TestProfileSyncService : public ProfileSyncService {
|
|
|
| bool fail_initial_download_;
|
| syncer::StorageOption storage_option_;
|
| + browser_sync::MessageLoopRunner message_loop_runner_;
|
| +};
|
| +
|
| +
|
| +class FakeOAuth2TokenService : public ProfileOAuth2TokenService {
|
| + public:
|
| + explicit FakeOAuth2TokenService(net::URLRequestContextGetter* getter)
|
| + : ProfileOAuth2TokenService(getter) {}
|
| +
|
| + virtual scoped_ptr<OAuth2TokenService::Request> StartRequest(
|
| + const OAuth2TokenService::ScopeSet& scopes,
|
| + OAuth2TokenService::Consumer* consumer);
|
| +
|
| + static BrowserContextKeyedService* BuildTokenService(
|
| + content::BrowserContext* context);
|
| };
|
|
|
| #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_
|
|
|