| Index: chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc
|
| diff --git a/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc b/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc
|
| index 76f792674d3cb7f99e1216515920aa949ed13122..2a99ec3eadb56cbde26971f966f38da9d0cefc98 100644
|
| --- a/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc
|
| +++ b/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "base/run_loop.h"
|
| #include "chrome/browser/invalidation/gcm_invalidation_bridge.h"
|
| +#include "chrome/browser/invalidation/invalidation_auth_provider.h"
|
| #include "chrome/browser/services/gcm/gcm_profile_service.h"
|
| #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
|
| #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
|
| @@ -43,6 +44,27 @@ class FakeGCMProfileService : public gcm::GCMProfileService {
|
| DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService);
|
| };
|
|
|
| +// Fake invalidation auth provider implementation.
|
| +class FakeInvalidationAuthProvider : public InvalidationAuthProvider {
|
| + public:
|
| + explicit FakeInvalidationAuthProvider(
|
| + ProfileOAuth2TokenService* token_service)
|
| + : token_service_(token_service) {}
|
| + virtual ~FakeInvalidationAuthProvider() {}
|
| +
|
| + // InvalidationAuthProvider:
|
| + virtual OAuth2TokenService* GetTokenService() OVERRIDE {
|
| + return token_service_;
|
| + }
|
| + virtual std::string GetAccountId() OVERRIDE { return std::string(); }
|
| + virtual bool ShowLoginUI() OVERRIDE { return false; }
|
| +
|
| + private:
|
| + OAuth2TokenService* token_service_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FakeInvalidationAuthProvider);
|
| +};
|
| +
|
| class GCMInvalidationBridgeTest : public ::testing::Test {
|
| protected:
|
| GCMInvalidationBridgeTest() {}
|
| @@ -61,12 +83,14 @@ class GCMInvalidationBridgeTest : public ::testing::Test {
|
| FakeProfileOAuth2TokenService* token_service =
|
| (FakeProfileOAuth2TokenService*)
|
| ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
|
| - token_service->IssueRefreshTokenForUser("", "refresh_token");
|
| + token_service->IssueRefreshTokenForUser("", "fake_refresh_token");
|
| gcm_profile_service_ =
|
| (FakeGCMProfileService*)gcm::GCMProfileServiceFactory::GetForProfile(
|
| profile_.get());
|
|
|
| - bridge_.reset(new GCMInvalidationBridge(profile_.get()));
|
| + auth_provider_.reset(new FakeInvalidationAuthProvider(token_service));
|
| + bridge_.reset(
|
| + new GCMInvalidationBridge(gcm_profile_service_, auth_provider_.get()));
|
|
|
| delegate_ = bridge_->CreateDelegate();
|
| delegate_->Initialize();
|
| @@ -89,6 +113,7 @@ class GCMInvalidationBridgeTest : public ::testing::Test {
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| scoped_ptr<Profile> profile_;
|
| FakeGCMProfileService* gcm_profile_service_;
|
| + scoped_ptr<FakeInvalidationAuthProvider> auth_provider_;
|
|
|
| std::vector<std::string> issued_tokens_;
|
| std::vector<GoogleServiceAuthError> request_token_errors_;
|
|
|