Commit b9170a3e authored by Mugdha Lakhani's avatar Mugdha Lakhani Committed by Commit Bot

[Background Sync] Allow when enabled from runtime.

Allow 'periodic-background-sync' when the runtime feature is enabled.

We currently deny 'periodic-background-sync' permission if the base::Feature
kPeriodicBackgroundSync is disabled.

Since the permission can't be parsed at all if the runtime feature is disabled,
this check is unnecessary. Furthermore, this check prevents users with origin
trials enabled from using the feature.

Bug: 991145
Change-Id: Icf88c854ecb39d22d1878556a4c5a5b17350e321
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738370
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684292}
parent 360afd63
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/content_features.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "base/android/jni_string.h" #include "base/android/jni_string.h"
...@@ -62,9 +61,6 @@ PeriodicBackgroundSyncPermissionContext::GetPermissionStatusInternal( ...@@ -62,9 +61,6 @@ PeriodicBackgroundSyncPermissionContext::GetPermissionStatusInternal(
const GURL& embedding_origin) const { const GURL& embedding_origin) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!base::FeatureList::IsEnabled(features::kPeriodicBackgroundSync))
return CONTENT_SETTING_BLOCK;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
if (IsTwaInstalled(requesting_origin)) if (IsTwaInstalled(requesting_origin))
return CONTENT_SETTING_ALLOW; return CONTENT_SETTING_ALLOW;
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <string> #include <string>
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
...@@ -17,7 +16,6 @@ ...@@ -17,7 +16,6 @@
#include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h" #include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/test/web_contents_tester.h" #include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -119,8 +117,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, DenyWhenFeatureDisabled) { ...@@ -119,8 +117,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, DenyWhenFeatureDisabled) {
} }
TEST_F(PeriodicBackgroundSyncPermissionContextTest, DenyForInsecureOrigin) { TEST_F(PeriodicBackgroundSyncPermissionContextTest, DenyForInsecureOrigin) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kPeriodicBackgroundSync);
GURL url("http://example.com"); GURL url("http://example.com");
SetBackgroundSyncContentSetting(url, CONTENT_SETTING_ALLOW); SetBackgroundSyncContentSetting(url, CONTENT_SETTING_ALLOW);
EXPECT_EQ(GetPermissionStatus(url, /* with_frame= */ false), EXPECT_EQ(GetPermissionStatus(url, /* with_frame= */ false),
...@@ -128,8 +124,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, DenyForInsecureOrigin) { ...@@ -128,8 +124,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, DenyForInsecureOrigin) {
} }
TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithFrame) { TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithFrame) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kPeriodicBackgroundSync);
GURL url("https://example.com"); GURL url("https://example.com");
SetUpPwaAndContentSettings(url); SetUpPwaAndContentSettings(url);
SetBackgroundSyncContentSetting(url, CONTENT_SETTING_ALLOW); SetBackgroundSyncContentSetting(url, CONTENT_SETTING_ALLOW);
...@@ -139,8 +133,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithFrame) { ...@@ -139,8 +133,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithFrame) {
} }
TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithoutFrame) { TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithoutFrame) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kPeriodicBackgroundSync);
GURL url("https://example.com"); GURL url("https://example.com");
SetUpPwaAndContentSettings(url); SetUpPwaAndContentSettings(url);
...@@ -149,8 +141,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithoutFrame) { ...@@ -149,8 +141,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, AllowWithoutFrame) {
} }
TEST_F(PeriodicBackgroundSyncPermissionContextTest, DesktopPwa) { TEST_F(PeriodicBackgroundSyncPermissionContextTest, DesktopPwa) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kPeriodicBackgroundSync);
GURL url("https://example.com"); GURL url("https://example.com");
SetUpPwaAndContentSettings(url); SetUpPwaAndContentSettings(url);
...@@ -163,8 +153,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, DesktopPwa) { ...@@ -163,8 +153,6 @@ TEST_F(PeriodicBackgroundSyncPermissionContextTest, DesktopPwa) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
TEST_F(PeriodicBackgroundSyncPermissionContextTest, Twa) { TEST_F(PeriodicBackgroundSyncPermissionContextTest, Twa) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kPeriodicBackgroundSync);
GURL url("https://example.com"); GURL url("https://example.com");
// No TWA or PWA installed. // No TWA or PWA installed.
......
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