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

Unified Diff: chrome/browser/extensions/api/gcm/gcm_apitest.cc

Issue 165993005: [GCM] Make sure GCM checkout logic is invoked when the profile is signed out (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 6 years, 10 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/api/gcm/gcm_apitest.cc
diff --git a/chrome/browser/extensions/api/gcm/gcm_apitest.cc b/chrome/browser/extensions/api/gcm/gcm_apitest.cc
index 41372a1b3ca57e3cc3d9598f48117b00ea2dbfe0..c463ed948058680fd4c5473381b92b18545fd98f 100644
--- a/chrome/browser/extensions/api/gcm/gcm_apitest.cc
+++ b/chrome/browser/extensions/api/gcm/gcm_apitest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
#include "chrome/browser/services/gcm/gcm_client_factory.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -25,6 +26,7 @@ class GcmApiTest : public ExtensionApiTest {
GcmApiTest() : fake_gcm_profile_service_(NULL) {}
protected:
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
virtual void SetUpOnMainThread() OVERRIDE;
void StartCollecting();
@@ -38,13 +40,24 @@ class GcmApiTest : public ExtensionApiTest {
gcm::FakeGCMProfileService* fake_gcm_profile_service_;
};
+void GcmApiTest::SetUpCommandLine(CommandLine* command_line) {
+ // We now always create the GCMProfileService instance in
+ // ProfileSyncServiceFactory that is called when a profile is being
+ // initialized. In order to prevent it from being created, we add the switch
+ // to disable the sync logic.
+ command_line->AppendSwitch(switches::kDisableSync);
+
+ ExtensionApiTest::SetUpCommandLine(command_line);
+}
+
void GcmApiTest::SetUpOnMainThread() {
gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory(
browser()->profile(), &gcm::FakeGCMProfileService::Build);
fake_gcm_profile_service_ = static_cast<gcm::FakeGCMProfileService*>(
gcm::GCMProfileServiceFactory::GetInstance()->GetForProfile(
browser()->profile()));
- gcm::FakeGCMProfileService::EnableGCMForTesting();
+
+ ExtensionApiTest::SetUpOnMainThread();
}
void GcmApiTest::StartCollecting() {

Powered by Google App Engine
This is Rietveld 408576698