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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java

Issue 2939143002: Update Previews infbar accessibility string (Closed)
Patch Set: static class Created 3 years, 6 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/strings/android_chrome_strings.grd ('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/infobar/InfoBarTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java
index 312e703513c899cf24218a6d6c529f2ccd0589ab..7c1150bd7811cccc5cc3b2d893d4d737c90b8fec 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java
@@ -26,6 +26,7 @@ import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.base.test.util.UrlUtils;
+import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.WebContentsFactory;
@@ -72,6 +73,23 @@ public class InfoBarTest {
private EmbeddedTestServer mTestServer;
private InfoBarTestAnimationListener mListener;
+ private static class TestInfoBar extends ConfirmInfoBar {
+ private boolean mCompact;
+
+ private TestInfoBar(String message) {
+ super(0, null, message, null, null, null);
+ }
+
+ @Override
+ protected boolean usesCompactLayout() {
+ return mCompact;
+ }
+
+ public void setUsesCompactLayout(boolean compact) {
+ mCompact = compact;
+ }
+ }
+
private void waitUntilDataReductionPromoInfoBarAppears() {
CriteriaHelper.pollUiThread(new Criteria() {
@Override
@@ -121,6 +139,45 @@ public class InfoBarTest {
}
}
+ /**
+ * Verify getAccessibilityMessage().
+ */
+ @Test
+ @MediumTest
+ @Feature({"Browser", "Main"})
+ public void testGetAccessibilityMessage() {
+ TestInfoBar infoBarNoMessage = new TestInfoBar(null);
+ infoBarNoMessage.setContext(ContextUtils.getApplicationContext());
+ Assert.assertEquals("Infobar shouldn't have accessibility message before createView()", "",
+ infoBarNoMessage.getAccessibilityText());
+ infoBarNoMessage.createView();
+ Assert.assertEquals("Infobar should have accessibility message after createView()",
+ ContextUtils.getApplicationContext().getString(R.string.bottom_bar_screen_position),
+ infoBarNoMessage.getAccessibilityText());
+
+ TestInfoBar infoBarCompact = new TestInfoBar(null);
+ infoBarCompact.setContext(ContextUtils.getApplicationContext());
+ Assert.assertEquals("Infobar shouldn't have accessibility message before createView()", "",
+ infoBarCompact.getAccessibilityText());
+ infoBarCompact.setUsesCompactLayout(true);
+ infoBarCompact.createView();
+ Assert.assertEquals("Infobar should have accessibility message after createView()",
+ ContextUtils.getApplicationContext().getString(R.string.bottom_bar_screen_position),
+ infoBarCompact.getAccessibilityText());
+
+ String messsage = "Hello world";
+ TestInfoBar infoBarWithMessage = new TestInfoBar(messsage);
+ infoBarWithMessage.setContext(ContextUtils.getApplicationContext());
+ Assert.assertEquals("Infobar shouldn't have accessibility message before createView()", "",
+ infoBarWithMessage.getAccessibilityText());
+ infoBarWithMessage.createView();
+ Assert.assertEquals("Infobar should have accessibility message after createView()",
+ messsage
+ + ContextUtils.getApplicationContext().getString(
+ R.string.bottom_bar_screen_position),
+ infoBarWithMessage.getAccessibilityText());
+ }
+
/**
* Verify PopUp InfoBar.
*/
« no previous file with comments | « chrome/android/java/strings/android_chrome_strings.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698