Chromium Code Reviews| 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. |