Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java

Issue 1845853003: Split the footer in ClearBrowsingDataPreferences into two paragraphs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed icons, added annotation. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
index 2b83f9a2d1f2ce6f76aa48fd35ce776e60182594..c470899f85290f4680087178f32a672406bfef37 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
@@ -8,6 +8,8 @@ import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.text.SpannableString;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.ChromeActivity;
@@ -18,6 +20,7 @@ import org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataPreferen
import org.chromium.chrome.browser.webapps.WebappDataStorage;
import org.chromium.chrome.browser.webapps.WebappRegistry;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
+import org.chromium.chrome.test.util.browser.signin.SigninTestUtil;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -40,6 +43,7 @@ public class ClearBrowsingDataPreferencesTest
@Override
public void startMainActivity() throws InterruptedException {
+ SigninTestUtil.setUpAuthForTest(getInstrumentation());
startMainActivityOnBlankPage();
}
@@ -246,6 +250,72 @@ public class ClearBrowsingDataPreferencesTest
});
}
+ /**
+ * Tests that for users who are not signed in, only the general footnote is shown.
+ */
+ @SmallTest
+ public void testFooterNonsigned() throws Exception {
+ SigninTestUtil.get().resetSigninState();
+
+ final Preferences preferences =
+ startPreferences(ClearBrowsingDataPreferences.class.getName());
+
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ ClearBrowsingDataPreferences fragment =
+ (ClearBrowsingDataPreferences) preferences.getFragmentForTest();
+ PreferenceScreen screen = fragment.getPreferenceScreen();
+
+ assertNotNull(
+ screen.findPreference(ClearBrowsingDataPreferences.PREF_GENERAL_SUMMARY));
+ assertNull(
+ screen.findPreference(ClearBrowsingDataPreferences.PREF_GOOGLE_SUMMARY));
+ }
+ });
+ }
+
+ /**
+ * Tests that for users who are signed in, both the general and the Google-specific footnotes
+ * are shown.
+ */
+ @MediumTest
+ public void testFooterSigned() throws Exception {
+ // Sign in.
+ SigninTestUtil.get().addAndSignInTestAccount();
+
+ final Preferences preferences =
+ startPreferences(ClearBrowsingDataPreferences.class.getName());
+
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ ClearBrowsingDataPreferences fragment =
+ (ClearBrowsingDataPreferences) preferences.getFragmentForTest();
+ PreferenceScreen screen = fragment.getPreferenceScreen();
+
+ assertNotNull(
+ screen.findPreference(ClearBrowsingDataPreferences.PREF_GENERAL_SUMMARY));
+
+ Preference google_summary =
+ screen.findPreference(ClearBrowsingDataPreferences.PREF_GOOGLE_SUMMARY);
+ assertNotNull(google_summary);
+
+ // There is currently no clickable link in the Google-specific summary.
+ assertTrue(!(google_summary.getSummary() instanceof SpannableString)
+ || ((SpannableString) google_summary.getSummary()).getSpans(
+ 0, google_summary.getSummary().length(), Object.class).length == 0);
+
+ // When the web history service reports that there are other forms of browsing
+ // history, we should show a link to them.
+ fragment.showNoticeAboutOtherFormsOfBrowsingHistory();
+ assertTrue(google_summary.getSummary() instanceof SpannableString);
+ assertTrue(((SpannableString) google_summary.getSummary()).getSpans(
+ 0, google_summary.getSummary().length(), Object.class).length == 1);
+ }
+ });
+ }
+
private void setDataTypesToClear(final List<DialogOption> typesToClear) {
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698