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

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

Issue 2621983003: Fix flaky Android Search Geolocation Disclosure tests. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | 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/SearchGeolocationDisclosureInfoBarTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java
index a8d2502971b8e11f6a7ed59536b6022247835f10..9a86aac901b53912cc00c4577983ff4738c1fedb 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java
@@ -8,12 +8,13 @@ import android.support.test.filters.SmallTest;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
-import org.chromium.base.test.util.FlakyTest;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.SearchGeolocationDisclosureTabHelper;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.InfoBarTestAnimationListener;
import org.chromium.chrome.test.util.InfoBarUtil;
+import org.chromium.content.browser.test.util.Criteria;
+import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.net.test.EmbeddedTestServer;
import java.util.concurrent.TimeoutException;
@@ -50,7 +51,15 @@ public class SearchGeolocationDisclosureInfoBarTest
super.tearDown();
}
- @FlakyTest(message = "https://crbug.com/678210")
+ private void waitUntilNoInfoBarsExist() {
gone 2017/01/11 18:15:42 Pull this and the other two copies into InfoBarUti
benwells 2017/01/13 05:01:26 Done.
+ CriteriaHelper.pollUiThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return getInfoBars().isEmpty();
+ }
+ });
+ }
+
@SmallTest
@Feature({"Browser", "Main"})
@CommandLineFlags.Add(ENABLE_NEW_DISCLOSURE_FEATURE)
@@ -74,6 +83,9 @@ public class SearchGeolocationDisclosureInfoBarTest
// Infobar should not appear again on the same day.
loadUrl(mTestServer.getURL(SEARCH_PAGE));
+ // There can be a delay from infobars being removed in the native InfobarManager and them
+ // being removed in the Java container, so wait until the infobar has really gone.
+ waitUntilNoInfoBarsExist();
assertEquals("Wrong infobar count after search", 0, getInfoBars().size());
// Infobar should appear again the next day.
@@ -86,6 +98,7 @@ public class SearchGeolocationDisclosureInfoBarTest
// Infobar should not appear again on the same day.
loadUrl(mTestServer.getURL(SEARCH_PAGE));
+ waitUntilNoInfoBarsExist();
assertEquals("Wrong infobar count after search", 0, getInfoBars().size());
// Infobar should appear again the next day.
@@ -98,6 +111,7 @@ public class SearchGeolocationDisclosureInfoBarTest
// Infobar should not appear again on the same day.
loadUrl(mTestServer.getURL(SEARCH_PAGE));
+ waitUntilNoInfoBarsExist();
assertEquals("Wrong infobar count after search", 0, getInfoBars().size());
// Infobar has appeared three times now, it should not appear again.
@@ -126,6 +140,7 @@ public class SearchGeolocationDisclosureInfoBarTest
// Infobar should not appear again on the same day.
loadUrl(mTestServer.getURL(SEARCH_PAGE));
+ waitUntilNoInfoBarsExist();
assertEquals("Wrong infobar count after search", 0, getInfoBars().size());
// Infobar should not appear the next day either, as it has been dismissed.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698