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 00459d9f1ab4724706746a4b96e0ac24d28c968e..e061aa64d1a45152c2690e778f8a0c51ae459244 100644 |
--- a/chrome/browser/sync/test_profile_sync_service.h |
+++ b/chrome/browser/sync/test_profile_sync_service.h |
@@ -10,6 +10,9 @@ |
#include "base/callback.h" |
#include "base/compiler_specific.h" |
#include "base/memory/weak_ptr.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/invalidations/invalidator_storage.h" |
#include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
@@ -30,6 +33,20 @@ ACTION(ReturnNewDataTypeManager) { |
namespace browser_sync { |
+// MessageLoopRunner::Run() may be called multiple times recursively. Only first |
tim (not reviewing)
2013/05/23 19:03:42
Hmm.. this kind of thing (nested Run() calls -- se
|
+// 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 |
@@ -44,7 +61,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&)); |
@@ -102,6 +120,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 |
@@ -119,6 +138,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>& |
@@ -177,6 +202,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 ProfileKeyedService* BuildTokenService( |
+ content::BrowserContext* context); |
}; |
#endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |