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

Unified Diff: chrome/browser/extensions/extension_gcm_app_handler_unittest.cc

Issue 286213003: Make GCMProfileService own GCMDriver, instead of deriving from it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 7 months 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/extensions/extension_gcm_app_handler_unittest.cc
diff --git a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
index 786f1d9bbf0b0da3e5eb051c07cc69210a6711af..81e9c7c88f4f098d9f9928a534f354b56e74eed1 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
+++ b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/services/gcm/fake_gcm_client.h"
#include "chrome/browser/services/gcm/fake_gcm_client_factory.h"
#include "chrome/browser/services/gcm/fake_signin_manager.h"
+#include "chrome/browser/services/gcm/gcm_driver.h"
#include "chrome/browser/services/gcm/gcm_profile_service.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
@@ -167,7 +168,10 @@ class ExtensionGCMAppHandlerTest : public testing::Test {
public:
static KeyedService* BuildGCMProfileService(
content::BrowserContext* context) {
- return new gcm::GCMProfileService(static_cast<Profile*>(context));
+ return new gcm::GCMProfileService(
+ Profile::FromBrowserContext(context),
+ scoped_ptr<gcm::GCMClientFactory>(
+ new gcm::FakeGCMClientFactory(gcm::FakeGCMClient::NO_DELAY_START)));
}
ExtensionGCMAppHandlerTest()
@@ -209,15 +213,8 @@ class ExtensionGCMAppHandlerTest : public testing::Test {
profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true);
// Create GCMProfileService that talks with fake GCMClient.
- gcm::GCMProfileService* gcm_profile_service =
- static_cast<gcm::GCMProfileService*>(
- gcm::GCMProfileServiceFactory::GetInstance()->
- SetTestingFactoryAndUse(
- profile(),
- &ExtensionGCMAppHandlerTest::BuildGCMProfileService));
- scoped_ptr<gcm::GCMClientFactory> gcm_client_factory(
- new gcm::FakeGCMClientFactory(gcm::FakeGCMClient::NO_DELAY_START));
- gcm_profile_service->Initialize(gcm_client_factory.Pass());
+ gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactoryAndUse(
+ profile(), &ExtensionGCMAppHandlerTest::BuildGCMProfileService);
// Create a fake version of ExtensionGCMAppHandler.
gcm_app_handler_.reset(new FakeExtensionGCMAppHandler(profile(), &waiter_));
@@ -288,7 +285,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test {
void Register(const std::string& app_id,
const std::vector<std::string>& sender_ids) {
- GetGCMProfileService()->Register(
+ GetGCMDriver()->Register(
app_id,
sender_ids,
base::Bind(&ExtensionGCMAppHandlerTest::RegisterCompleted,
@@ -301,12 +298,12 @@ class ExtensionGCMAppHandlerTest : public testing::Test {
waiter_.SignalCompleted();
}
- gcm::GCMProfileService* GetGCMProfileService() const {
- return gcm::GCMProfileServiceFactory::GetForProfile(profile());
+ gcm::GCMDriver* GetGCMDriver() const {
+ return gcm::GCMProfileServiceFactory::GetForProfile(profile())->driver();
}
bool HasAppHandlers(const std::string& app_id) const {
- return GetGCMProfileService()->app_handlers().count(app_id);
+ return GetGCMDriver()->app_handlers().count(app_id);
}
Profile* profile() const { return profile_.get(); }
« no previous file with comments | « chrome/browser/extensions/extension_gcm_app_handler.cc ('k') | chrome/browser/invalidation/gcm_invalidation_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698