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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.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/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 18f4c4206e991f3003d41103c0d26f6a3886c369..5228deef1ac0887c2811e60ad9faa101e5196367 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
@@ -36,6 +36,7 @@ import org.chromium.net.test.EmbeddedTestServer;
import java.net.HttpURLConnection;
import java.util.List;
+import java.util.concurrent.TimeoutException;
/** Tests for the InfoBars. */
public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@@ -124,21 +125,21 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@MediumTest
@Feature({"Browser", "Main"})
@DisabledTest(message = "crbug.com/593003")
- public void testInfoBarForPopUp() throws InterruptedException {
+ public void testInfoBarForPopUp() throws InterruptedException, TimeoutException {
loadUrl(mTestServer.getURL(POPUP_PAGE));
- assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not added");
List<InfoBar> infoBars = getInfoBars();
assertEquals("Wrong infobar count", 1, infoBars.size());
assertTrue(InfoBarUtil.hasPrimaryButton(infoBars.get(0)));
assertFalse(InfoBarUtil.hasSecondaryButton(infoBars.get(0)));
InfoBarUtil.clickPrimaryButton(infoBars.get(0));
- assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
+ mListener.removeInfoBarAnimationFinished("InfoBar not removed.");
assertEquals("Wrong infobar count", 0, infoBars.size());
// A second load should not show the infobar.
loadUrl(mTestServer.getURL(POPUP_PAGE));
- assertFalse("InfoBar added when it should not", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar added when it should not");
}
/**
@@ -148,10 +149,10 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@MediumTest
@Feature({"Browser", "Main"})
@RetryOnFailure
- public void testInfoBarForGeolocation() throws InterruptedException {
+ public void testInfoBarForGeolocation() throws InterruptedException, TimeoutException {
LocationSettingsTestUtil.setSystemLocationSettingEnabled(true);
loadUrl(mTestServer.getURL(GEOLOCATION_PAGE));
- assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not added");
// Make sure it has OK/Cancel buttons.
List<InfoBar> infoBars = getInfoBars();
@@ -160,7 +161,7 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
assertTrue(InfoBarUtil.hasSecondaryButton(infoBars.get(0)));
loadUrl(HELLO_WORLD_URL);
- assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
+ mListener.removeInfoBarAnimationFinished("InfoBar not removed.");
assertTrue("Wrong infobar count", getInfoBars().isEmpty());
}
@@ -171,11 +172,12 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@MediumTest
@Feature({"Browser"})
@RetryOnFailure
- public void testInfoBarForGeolocationDisappearsOnBack() throws InterruptedException {
+ public void testInfoBarForGeolocationDisappearsOnBack()
+ throws InterruptedException, TimeoutException {
LocationSettingsTestUtil.setSystemLocationSettingEnabled(true);
loadUrl(HELLO_WORLD_URL);
loadUrl(mTestServer.getURL(GEOLOCATION_PAGE));
- assertTrue("InfoBar not added.", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not added.");
assertEquals("Wrong infobar count", 1, getInfoBars().size());
@@ -195,7 +197,7 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
}
},
MAX_TIMEOUT, CHECK_INTERVAL);
- assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
+ mListener.removeInfoBarAnimationFinished("InfoBar not removed.");
}
/**
@@ -389,7 +391,7 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@MediumTest
@Feature({"Browser", "Main"})
@RetryOnFailure
- public void testInfoBarForHungRenderer() throws InterruptedException {
+ public void testInfoBarForHungRenderer() throws InterruptedException, TimeoutException {
loadUrl(HELLO_WORLD_URL);
// Fake an unresponsive renderer signal.
@@ -403,7 +405,7 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
.rendererUnresponsive();
}
});
- assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not added");
// Make sure it has Kill/Wait buttons.
List<InfoBar> infoBars = getInfoBars();
@@ -421,7 +423,7 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
.rendererResponsive();
}
});
- assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
+ mListener.removeInfoBarAnimationFinished("InfoBar not removed.");
assertTrue("Wrong infobar count", getInfoBars().isEmpty());
}
@@ -432,7 +434,8 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@MediumTest
@Feature({"Browser", "Main"})
@RetryOnFailure
- public void testInfoBarForHungRendererCanKillRenderer() throws InterruptedException {
+ public void testInfoBarForHungRendererCanKillRenderer()
+ throws InterruptedException, TimeoutException {
loadUrl(HELLO_WORLD_URL);
// Fake an unresponsive renderer signal.
@@ -446,7 +449,7 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
.rendererUnresponsive();
}
});
- assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not added");
// Make sure it has Kill/Wait buttons.
final List<InfoBar> infoBars = getInfoBars();
@@ -463,7 +466,7 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
});
// The renderer should have been killed and the InfoBar removed.
- assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
+ mListener.removeInfoBarAnimationFinished("InfoBar not removed.");
assertTrue("Wrong infobar count", getInfoBars().isEmpty());
CriteriaHelper.pollInstrumentationThread(new Criteria() {
@Override
@@ -479,11 +482,12 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@MediumTest
@Feature({"Browser", "Main"})
@RetryOnFailure
- public void testInfoBarContainerSwapsWebContents() throws InterruptedException {
+ public void testInfoBarContainerSwapsWebContents()
+ throws InterruptedException, TimeoutException {
// Add an infobar.
LocationSettingsTestUtil.setSystemLocationSettingEnabled(true);
loadUrl(mTestServer.getURL(GEOLOCATION_PAGE));
- assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());
+ mListener.addInfoBarAnimationFinished("InfoBar not added");
assertEquals("Wrong infobar count", 1, getInfoBars().size());
// Swap out the WebContents and send the user somewhere so that the InfoBar gets removed.
@@ -497,14 +501,14 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
}
});
loadUrl(HELLO_WORLD_URL);
- assertTrue("InfoBar not removed.", removeListener.removeInfoBarAnimationFinished());
+ removeListener.removeInfoBarAnimationFinished("InfoBar not removed.");
assertEquals("Wrong infobar count", 0, getInfoBars().size());
// Revisiting the original page should make the InfoBar reappear.
InfoBarTestAnimationListener addListener = new InfoBarTestAnimationListener();
getActivity().getActivityTab().getInfoBarContainer().setAnimationListener(addListener);
loadUrl(mTestServer.getURL(GEOLOCATION_PAGE));
- assertTrue("InfoBar not added", addListener.addInfoBarAnimationFinished());
+ addListener.addInfoBarAnimationFinished("InfoBar not added");
assertEquals("Wrong infobar count", 1, getInfoBars().size());
}
}

Powered by Google App Engine
This is Rietveld 408576698