Commit b5dd6d28 authored by jianli's avatar jianli Committed by Commit bot

Remove the extra guard in InstanceIDProfileService

This is not longer needed since we only guard the API under
_api_features. This extra guard is causing the test failures in officla
builds since extensions::ScopedCurrentChannel does not affect the
regular chrome channel settings.

BUG=489368
TEST=existing tests

Review URL: https://codereview.chromium.org/1131793011

Cr-Commit-Position: refs/heads/master@{#330572}
parent 863e5ecc
...@@ -32,15 +32,21 @@ KeyedService* BuildFakeGCMProfileService(content::BrowserContext* context) { ...@@ -32,15 +32,21 @@ KeyedService* BuildFakeGCMProfileService(content::BrowserContext* context) {
class InstanceIDApiTest : public ExtensionApiTest { class InstanceIDApiTest : public ExtensionApiTest {
public: public:
InstanceIDApiTest() {} InstanceIDApiTest();
protected: protected:
void SetUpOnMainThread() override; void SetUpOnMainThread() override;
private: private:
extensions::ScopedCurrentChannel current_channel_;
DISALLOW_COPY_AND_ASSIGN(InstanceIDApiTest); DISALLOW_COPY_AND_ASSIGN(InstanceIDApiTest);
}; };
InstanceIDApiTest::InstanceIDApiTest()
: current_channel_(chrome::VersionInfo::CHANNEL_DEV) {
}
void InstanceIDApiTest::SetUpOnMainThread() { void InstanceIDApiTest::SetUpOnMainThread() {
gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory(
browser()->profile(), &BuildFakeGCMProfileService); browser()->profile(), &BuildFakeGCMProfileService);
...@@ -49,39 +55,26 @@ void InstanceIDApiTest::SetUpOnMainThread() { ...@@ -49,39 +55,26 @@ void InstanceIDApiTest::SetUpOnMainThread() {
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetID) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetID) {
extensions::ScopedCurrentChannel current_channel(
chrome::VersionInfo::CHANNEL_DEV);
ASSERT_TRUE(RunExtensionTest("instance_id/get_id")); ASSERT_TRUE(RunExtensionTest("instance_id/get_id"));
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetCreationTime) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetCreationTime) {
extensions::ScopedCurrentChannel current_channel(
chrome::VersionInfo::CHANNEL_DEV);
ASSERT_TRUE(RunExtensionTest("instance_id/get_creation_time")); ASSERT_TRUE(RunExtensionTest("instance_id/get_creation_time"));
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, DeleteID) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, DeleteID) {
extensions::ScopedCurrentChannel current_channel(
chrome::VersionInfo::CHANNEL_DEV);
ASSERT_TRUE(RunExtensionTest("instance_id/delete_id")); ASSERT_TRUE(RunExtensionTest("instance_id/delete_id"));
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetToken) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetToken) {
extensions::ScopedCurrentChannel current_channel(
chrome::VersionInfo::CHANNEL_DEV);
ASSERT_TRUE(RunExtensionTest("instance_id/get_token")); ASSERT_TRUE(RunExtensionTest("instance_id/get_token"));
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, DeleteToken) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, DeleteToken) {
extensions::ScopedCurrentChannel current_channel(
chrome::VersionInfo::CHANNEL_DEV);
ASSERT_TRUE(RunExtensionTest("instance_id/delete_token")); ASSERT_TRUE(RunExtensionTest("instance_id/delete_token"));
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, Incognito) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, Incognito) {
extensions::ScopedCurrentChannel current_channel(
chrome::VersionInfo::CHANNEL_DEV);
ResultCatcher catcher; ResultCatcher catcher;
catcher.RestrictToBrowserContext(profile()); catcher.RestrictToBrowserContext(profile());
ResultCatcher incognito_catcher; ResultCatcher incognito_catcher;
...@@ -95,13 +88,13 @@ IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, Incognito) { ...@@ -95,13 +88,13 @@ IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, Incognito) {
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, BetaChannel) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, BetaChannel) {
extensions::ScopedCurrentChannel current_channel( extensions::ScopedCurrentChannel current_channel_override(
chrome::VersionInfo::CHANNEL_BETA); chrome::VersionInfo::CHANNEL_BETA);
ASSERT_TRUE(RunExtensionTest("instance_id/channel")); ASSERT_TRUE(RunExtensionTest("instance_id/channel"));
} }
IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, StableChannel) { IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, StableChannel) {
extensions::ScopedCurrentChannel current_channel( extensions::ScopedCurrentChannel current_channel_override(
chrome::VersionInfo::CHANNEL_STABLE); chrome::VersionInfo::CHANNEL_STABLE);
ASSERT_TRUE(RunExtensionTest("instance_id/channel")); ASSERT_TRUE(RunExtensionTest("instance_id/channel"));
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/services/gcm/gcm_profile_service.h" #include "chrome/browser/services/gcm/gcm_profile_service.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h" #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/common/chrome_version_info.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h" #include "components/gcm_driver/instance_id/instance_id_driver.h"
namespace instance_id { namespace instance_id {
...@@ -19,13 +18,6 @@ bool InstanceIDProfileService::IsInstanceIDEnabled(Profile* profile) { ...@@ -19,13 +18,6 @@ bool InstanceIDProfileService::IsInstanceIDEnabled(Profile* profile) {
if (!gcm::GCMProfileService::IsGCMEnabled(profile)) if (!gcm::GCMProfileService::IsGCMEnabled(profile))
return false; return false;
// Enabled only for trunk/canary/dev builds.
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
if (channel == chrome::VersionInfo::CHANNEL_BETA ||
channel == chrome::VersionInfo::CHANNEL_STABLE) {
return false;
}
return InstanceIDDriver::IsInstanceIDEnabled(); return InstanceIDDriver::IsInstanceIDEnabled();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment