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

Unified Diff: chrome/browser/services/gcm/gcm_profile_service_unittest.cc

Issue 296053011: Start and stop the GCM service on demand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/services/gcm/gcm_profile_service_unittest.cc
diff --git a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
index ff6ce35ad46df5dd859cf5488d843fcad6b9c266..8d9549ba7c94a298db4bf40d12e507b005aa57a3 100644
--- a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
+#include "chrome/browser/services/gcm/fake_gcm_app_handler.h"
#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"
@@ -49,6 +50,7 @@ class GCMProfileServiceTest : public testing::Test {
// testing::Test:
virtual void SetUp() OVERRIDE;
+ virtual void TearDown() OVERRIDE;
FakeGCMClient* GetGCMClient() const;
@@ -78,6 +80,7 @@ class GCMProfileServiceTest : public testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
GCMProfileService* gcm_profile_service_;
+ scoped_ptr<FakeGCMAppHandler> gcm_app_handler_;
std::string registration_id_;
GCMClient::Result registration_result_;
@@ -90,6 +93,7 @@ class GCMProfileServiceTest : public testing::Test {
GCMProfileServiceTest::GCMProfileServiceTest()
: gcm_profile_service_(NULL),
+ gcm_app_handler_(new FakeGCMAppHandler),
registration_result_(GCMClient::UNKNOWN_ERROR),
send_result_(GCMClient::UNKNOWN_ERROR) {
}
@@ -112,6 +116,8 @@ void GCMProfileServiceTest::SetUp() {
GCMProfileServiceFactory::GetInstance()->SetTestingFactoryAndUse(
profile_.get(),
&BuildGCMProfileService));
+ gcm_profile_service_->driver()->AddAppHandler(
+ kTestAppID, gcm_app_handler_.get());
FakeSigninManager* signin_manager = static_cast<FakeSigninManager*>(
SigninManagerFactory::GetInstance()->GetForProfile(profile_.get()));
@@ -119,6 +125,10 @@ void GCMProfileServiceTest::SetUp() {
base::RunLoop().RunUntilIdle();
}
+void GCMProfileServiceTest::TearDown() {
+ profile_.reset();
Nicolas Zea 2014/05/22 17:06:31 why is this necessary? profile_ is going to be des
jianli 2014/05/22 18:09:26 Yes, it is not needed. I forgot to remove app hand
+}
+
void GCMProfileServiceTest::RegisterAndWaitForCompletion(
const std::vector<std::string>& sender_ids) {
base::RunLoop run_loop;

Powered by Google App Engine
This is Rietveld 408576698