Commit 123e57a2 authored by Andy Paicu's avatar Andy Paicu Committed by Commit Bot

Ensure checkbox is hidden when feature is not enabled

As a follow-up to
https://chromium-review.googlesource.com/c/chromium/src/+/1930820
this CL ensure that the "Inform quietly" checkbox is not visible if
the `QuietNotificationPrompts` feature is disabled.

Bug: 1014874
Change-Id: I205d46c86c1714f06e62849a10b1348252631930
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946484Reviewed-by: default avatarKamila Hasanbega <hkamila@chromium.org>
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720877}
parent 2f4e14b2
...@@ -887,7 +887,12 @@ public class SingleCategoryPreferences extends PreferenceFragmentCompat ...@@ -887,7 +887,12 @@ public class SingleCategoryPreferences extends PreferenceFragmentCompat
screen.removePreference(notificationsVibrate); screen.removePreference(notificationsVibrate);
} }
notificationsQuietUi.setOnPreferenceChangeListener(this); if (ChromeFeatureList.isEnabled(ChromeFeatureList.QUIET_NOTIFICATION_PROMPTS)) {
notificationsQuietUi.setOnPreferenceChangeListener(this);
} else {
screen.removePreference(notificationsQuietUi);
}
updateNotificationsSecondaryControls(); updateNotificationsSecondaryControls();
} else { } else {
screen.removePreference(notificationsVibrate); screen.removePreference(notificationsVibrate);
...@@ -1008,6 +1013,8 @@ public class SingleCategoryPreferences extends PreferenceFragmentCompat ...@@ -1008,6 +1013,8 @@ public class SingleCategoryPreferences extends PreferenceFragmentCompat
NOTIFICATIONS_VIBRATE_TOGGLE_KEY); NOTIFICATIONS_VIBRATE_TOGGLE_KEY);
if (vibrate_pref != null) vibrate_pref.setEnabled(categoryEnabled); if (vibrate_pref != null) vibrate_pref.setEnabled(categoryEnabled);
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.QUIET_NOTIFICATION_PROMPTS)) return;
// The notifications quiet ui checkbox. // The notifications quiet ui checkbox.
ChromeBaseCheckBoxPreference quiet_ui_pref = ChromeBaseCheckBoxPreference quiet_ui_pref =
(ChromeBaseCheckBoxPreference) getPreferenceScreen().findPreference( (ChromeBaseCheckBoxPreference) getPreferenceScreen().findPreference(
......
...@@ -36,6 +36,7 @@ import org.chromium.chrome.browser.settings.SettingsActivity; ...@@ -36,6 +36,7 @@ import org.chromium.chrome.browser.settings.SettingsActivity;
import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeActivityTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.util.InfoBarTestAnimationListener; import org.chromium.chrome.test.util.InfoBarTestAnimationListener;
import org.chromium.chrome.test.util.browser.Features.EnableFeatures;
import org.chromium.chrome.test.util.browser.LocationSettingsTestUtil; import org.chromium.chrome.test.util.browser.LocationSettingsTestUtil;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.content_public.common.ContentSwitches; import org.chromium.content_public.common.ContentSwitches;
...@@ -449,6 +450,7 @@ public class SiteSettingsPreferencesTest { ...@@ -449,6 +450,7 @@ public class SiteSettingsPreferencesTest {
@Test @Test
@SmallTest @SmallTest
@Feature({"Preferences"}) @Feature({"Preferences"})
@EnableFeatures("QuietNotificationPrompts")
public void testOnlyExpectedPreferencesShown() { public void testOnlyExpectedPreferencesShown() {
// If you add a category in the SiteSettings UI, please add a test for it below. // If you add a category in the SiteSettings UI, please add a test for it below.
Assert.assertEquals(19, SiteSettingsCategory.Type.NUM_ENTRIES); Assert.assertEquals(19, SiteSettingsCategory.Type.NUM_ENTRIES);
......
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