Commit 42709f90 authored by Anna Malova's avatar Anna Malova Committed by Commit Bot

Add UI Catalogue entry for the Notifications Preferences

Bug: 852794
Change-Id: I0f1cb2fd08e820f6eb389bb9e0d07f1f7bab78c8
Reviewed-on: https://chromium-review.googlesource.com/1102678Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Commit-Queue: Anna Malova <amalova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588428}
parent 370b6a32
...@@ -28,6 +28,7 @@ import org.chromium.chrome.browser.preferences.website.ContentSettingsResources; ...@@ -28,6 +28,7 @@ import org.chromium.chrome.browser.preferences.website.ContentSettingsResources;
import org.chromium.chrome.browser.preferences.website.SingleCategoryPreferences; import org.chromium.chrome.browser.preferences.website.SingleCategoryPreferences;
import org.chromium.chrome.browser.preferences.website.SiteSettingsCategory; import org.chromium.chrome.browser.preferences.website.SiteSettingsCategory;
import org.chromium.chrome.browser.test.ChromeBrowserTestRule; import org.chromium.chrome.browser.test.ChromeBrowserTestRule;
import org.chromium.chrome.browser.test.ScreenShooter;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.Criteria;
import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.CriteriaHelper;
...@@ -37,11 +38,13 @@ import org.chromium.content_public.browser.test.util.CriteriaHelper; ...@@ -37,11 +38,13 @@ import org.chromium.content_public.browser.test.util.CriteriaHelper;
*/ */
@RunWith(ChromeJUnit4ClassRunner.class) @RunWith(ChromeJUnit4ClassRunner.class)
public class NotificationsPreferencesTest { public class NotificationsPreferencesTest {
// TODO(peconn): Add UI Catalogue entries for NotificationsPreferences.
@Rule @Rule
public final ChromeBrowserTestRule mBrowserTestRule = new ChromeBrowserTestRule(); public final ChromeBrowserTestRule mBrowserTestRule = new ChromeBrowserTestRule();
private Preferences mActivity; private Preferences mActivity;
@Rule
public ScreenShooter mScreenShooter = new ScreenShooter();
@Before @Before
public void setUp() { public void setUp() {
mActivity = PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), mActivity = PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(),
...@@ -50,7 +53,7 @@ public class NotificationsPreferencesTest { ...@@ -50,7 +53,7 @@ public class NotificationsPreferencesTest {
@Test @Test
@SmallTest @SmallTest
@Feature({"Preferences"}) @Feature({"Preferences", "UiCatalogue"})
@DisableIf.Build(sdk_is_greater_than = Build.VERSION_CODES.N) @DisableIf.Build(sdk_is_greater_than = Build.VERSION_CODES.N)
@CommandLineFlags.Add("enable-features=ContentSuggestionsNotifications") @CommandLineFlags.Add("enable-features=ContentSuggestionsNotifications")
public void testContentSuggestionsToggle() { public void testContentSuggestionsToggle() {
...@@ -82,11 +85,13 @@ public class NotificationsPreferencesTest { ...@@ -82,11 +85,13 @@ public class NotificationsPreferencesTest {
PreferencesTest.clickPreference(fragment, toggle); PreferencesTest.clickPreference(fragment, toggle);
} }
}); });
mScreenShooter.shoot("ContentSuggestionsToggle");
} }
@Test @Test
@SmallTest @SmallTest
@Feature({"Preferences"}) @Feature({"Preferences", "UiCatalogue"})
@DisableIf.Build(sdk_is_greater_than = Build.VERSION_CODES.N) @DisableIf.Build(sdk_is_greater_than = Build.VERSION_CODES.N)
@CommandLineFlags.Add("disable-features=NTPArticleSuggestions") @CommandLineFlags.Add("disable-features=NTPArticleSuggestions")
public void testToggleDisabledWhenSuggestionsDisabled() { public void testToggleDisabledWhenSuggestionsDisabled() {
...@@ -96,12 +101,14 @@ public class NotificationsPreferencesTest { ...@@ -96,12 +101,14 @@ public class NotificationsPreferencesTest {
Assert.assertFalse(toggle.isEnabled()); Assert.assertFalse(toggle.isEnabled());
Assert.assertFalse(toggle.isChecked()); Assert.assertFalse(toggle.isChecked());
mScreenShooter.shoot("ToggleDisabledWhenSuggestionsDisabled");
} }
@Test @Test
@SmallTest @SmallTest
@Feature({"Preferences"}) @Feature({"Preferences", "UiCatalogue"})
@DisableIf.Build(sdk_is_greater_than = Build.VERSION_CODES.N) @DisableIf.Build(sdk_is_greater_than = Build.VERSION_CODES.N)
public void testLinkToWebsiteNotifications() { public void testLinkToWebsiteNotifications() {
ThreadUtils.runOnUiThreadBlocking(new Runnable() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
...@@ -125,6 +132,8 @@ public class NotificationsPreferencesTest { ...@@ -125,6 +132,8 @@ public class NotificationsPreferencesTest {
SingleCategoryPreferences fragment = (SingleCategoryPreferences) getTopFragment(); SingleCategoryPreferences fragment = (SingleCategoryPreferences) getTopFragment();
Assert.assertTrue( Assert.assertTrue(
fragment.getCategoryForTest().showSites(SiteSettingsCategory.Type.NOTIFICATIONS)); fragment.getCategoryForTest().showSites(SiteSettingsCategory.Type.NOTIFICATIONS));
mScreenShooter.shoot("LinkToWebsiteNotifications");
} }
/** Gets the fragment of the top Activity. Assumes the top Activity is a Preferences. */ /** Gets the fragment of the top Activity. Assumes the top Activity is a Preferences. */
......
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