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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateInfoBarTest.java

Issue 2487683003: Convert InfoBarTestAnimationListener to CallbackHelper. (Closed)
Patch Set: Created 4 years, 1 month 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateInfoBarTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateInfoBarTest.java
index 0e1d84ebe780e128b905b26585524aa26d96b026..a9af37165b3bca92405fafe11cfca9c59d3c2a3a 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateInfoBarTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateInfoBarTest.java
@@ -19,6 +19,8 @@ import org.chromium.chrome.test.util.InfoBarUtil;
import org.chromium.chrome.test.util.TranslateUtil;
import org.chromium.net.test.EmbeddedTestServer;
+import java.util.concurrent.TimeoutException;
+
/**
* Tests for the translate infobar, assumes it runs on a system with language
* preferences set to English.
@@ -67,9 +69,9 @@ public class TranslateInfoBarTest extends ChromeActivityTestCaseBase<ChromeActiv
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
- public void testTranslateLanguagePanel() throws InterruptedException {
+ public void testTranslateLanguagePanel() throws InterruptedException, TimeoutException {
loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
- assertTrue("InfoBar not opened.", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not opened.");
InfoBar infoBar = mInfoBarContainer.getInfoBarsForTesting().get(0);
assertTrue(InfoBarUtil.hasPrimaryButton(infoBar));
assertTrue(InfoBarUtil.hasSecondaryButton(infoBar));
@@ -82,20 +84,20 @@ public class TranslateInfoBarTest extends ChromeActivityTestCaseBase<ChromeActiv
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
- public void testTranslateNeverPanel() throws InterruptedException {
+ public void testTranslateNeverPanel() throws InterruptedException, TimeoutException {
loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
- assertTrue("InfoBar not opened.", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not opened.");
InfoBar infoBar = mInfoBarContainer.getInfoBarsForTesting().get(0);
assertTrue(InfoBarUtil.clickCloseButton(infoBar));
- assertTrue(mListener.removeInfoBarAnimationFinished());
+ mListener.removeInfoBarAnimationFinished("Infobar not removed.");
// Reload the page so the infobar shows again
loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
- assertTrue("InfoBar not opened", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not opened");
infoBar = mInfoBarContainer.getInfoBarsForTesting().get(0);
assertTrue(InfoBarUtil.clickCloseButton(infoBar));
- assertTrue("InfoBar not swapped", mListener.swapInfoBarAnimationFinished());
+ mListener.swapInfoBarAnimationFinished("InfoBar not swapped");
TranslateUtil.assertInfoBarText(infoBar, NEVER_TRANSLATE_MESSAGE);
}
@@ -107,16 +109,14 @@ public class TranslateInfoBarTest extends ChromeActivityTestCaseBase<ChromeActiv
* @Feature({"Browser", "Main"})
*/
@DisabledTest(message = "crbug.com/514449")
- public void testTranslateTransitions() throws InterruptedException {
+ public void testTranslateTransitions() throws InterruptedException, TimeoutException {
loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
- assertTrue("InfoBar not Added", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not Added");
InfoBar infoBar = getInfoBars().get(0);
assertTrue(InfoBarUtil.hasPrimaryButton(infoBar));
assertTrue(InfoBarUtil.hasSecondaryButton(infoBar));
assertTrue(InfoBarUtil.clickPrimaryButton(infoBar));
- assertTrue("BEFORE -> TRANSLATING transition not Swapped.",
- mListener.swapInfoBarAnimationFinished());
- assertTrue("TRANSLATING -> ERROR transition not Swapped.",
- mListener.swapInfoBarAnimationFinished());
+ mListener.swapInfoBarAnimationFinished("BEFORE -> TRANSLATING transition not Swapped.");
+ mListener.swapInfoBarAnimationFinished("TRANSLATING -> ERROR transition not Swapped.");
}
}

Powered by Google App Engine
This is Rietveld 408576698