Chromium Code Reviews| 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..4ce1deb6d7557481bd123a54e599b261d7544682 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,6 +40,18 @@ class GcmApiTest : public ExtensionApiTest { |
| gcm::FakeGCMProfileService* fake_gcm_profile_service_; |
| }; |
| +void GcmApiTest::SetUpCommandLine(CommandLine* command_line) { |
| + // The GCMProfileService instance could now be created in |
| + // ProfileSyncServiceFactory::BuildServiceInstanceFor that is invoked when |
| + // a profile is being initialized. This prevents us from settings a faked |
| + // GCMProfileService instance as in SetUpOnMainThread. To work around this |
|
Nicolas Zea
2014/02/21 20:58:58
nit: fix comment. Not sure what "settings a faked
jianli
2014/02/22 00:03:06
Done.
|
| + // problem, we disable the ProfileSyncServiceFactory logic since GCM API |
| + // tests do not depend on any sync feature. |
| + command_line->AppendSwitch(switches::kDisableSync); |
| + |
| + ExtensionApiTest::SetUpCommandLine(command_line); |
| +} |
| + |
| void GcmApiTest::SetUpOnMainThread() { |
| gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( |
| browser()->profile(), &gcm::FakeGCMProfileService::Build); |
| @@ -45,6 +59,8 @@ void GcmApiTest::SetUpOnMainThread() { |
| gcm::GCMProfileServiceFactory::GetInstance()->GetForProfile( |
| browser()->profile())); |
| gcm::FakeGCMProfileService::EnableGCMForTesting(); |
| + |
| + ExtensionApiTest::SetUpOnMainThread(); |
| } |
| void GcmApiTest::StartCollecting() { |