| 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 307d0c6e547b9b94c8d02eeb56a08607095e2389..6685a18bb3a3f3cb0b536e52248349d46a58d383 100644
|
| --- a/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc
|
| +++ b/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc
|
| @@ -3,13 +3,12 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/run_loop.h"
|
| +#include "chrome/browser/invalidation/fake_invalidation_service.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"
|
| -#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
|
| -#include "chrome/browser/signin/profile_oauth2_token_service.h"
|
| -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "content/public/test/test_browser_thread_bundle.h"
|
| #include "google_apis/gaia/google_service_auth_error.h"
|
| @@ -22,13 +21,8 @@ namespace {
|
| // same registrationId.
|
| class FakeGCMProfileService : public gcm::GCMProfileService {
|
| public:
|
| - static KeyedService* Build(content::BrowserContext* context) {
|
| - Profile* profile = static_cast<Profile*>(context);
|
| - return new FakeGCMProfileService(profile);
|
| - }
|
| -
|
| - explicit FakeGCMProfileService(Profile* profile)
|
| - : gcm::GCMProfileService(profile) {}
|
| + explicit FakeGCMProfileService()
|
| + : gcm::GCMProfileService(NULL) {}
|
|
|
| virtual void Register(const std::string& app_id,
|
| const std::vector<std::string>& sender_ids,
|
| @@ -50,23 +44,10 @@ class GCMInvalidationBridgeTest : public ::testing::Test {
|
| virtual ~GCMInvalidationBridgeTest() {}
|
|
|
| virtual void SetUp() OVERRIDE {
|
| - TestingProfile::Builder builder;
|
| - builder.AddTestingFactory(
|
| - ProfileOAuth2TokenServiceFactory::GetInstance(),
|
| - &FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
|
| - builder.AddTestingFactory(gcm::GCMProfileServiceFactory::GetInstance(),
|
| - &FakeGCMProfileService::Build);
|
| - profile_ = builder.Build();
|
| -
|
| - FakeProfileOAuth2TokenService* token_service =
|
| - (FakeProfileOAuth2TokenService*)
|
| - ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
|
| - token_service->IssueRefreshTokenForUser("", "refresh_token");
|
| - gcm_profile_service_ =
|
| - (FakeGCMProfileService*)gcm::GCMProfileServiceFactory::GetForProfile(
|
| - profile_.get());
|
| -
|
| - bridge_.reset(new GCMInvalidationBridge(profile_.get()));
|
| + auth_provider_.fake_token_service()->IssueRefreshTokenForUser(
|
| + auth_provider_.GetAccountId(), "fake_refresh_token");
|
| + bridge_.reset(
|
| + new GCMInvalidationBridge(&gcm_profile_service_, &auth_provider_));
|
|
|
| delegate_ = bridge_->CreateDelegate();
|
| delegate_->Initialize();
|
| @@ -87,8 +68,8 @@ class GCMInvalidationBridgeTest : public ::testing::Test {
|
| }
|
|
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| - scoped_ptr<Profile> profile_;
|
| - FakeGCMProfileService* gcm_profile_service_;
|
| + FakeGCMProfileService gcm_profile_service_;
|
| + FakeInvalidationAuthProvider auth_provider_;
|
|
|
| std::vector<std::string> issued_tokens_;
|
| std::vector<GoogleServiceAuthError> request_token_errors_;
|
|
|