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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java

Issue 1834783002: Eliminate race condition in CustomTabActivityTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on master Created 4 years, 9 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/customtabs/CustomTabActivityTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
index 50e12261afc090e755f156e74872faf960d314fe..e54c13a892d0791edd38d52c343f2afd7cf9e500 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -788,8 +788,7 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
* only one in the navigation history.
*/
@SmallTest
- @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
- public void testPrecreatedRenderer() {
+ public void testPrecreatedRenderer() throws InterruptedException {
CustomTabsConnection connection = warmUpAndWait();
ICustomTabsCallback cb = new CustomTabsTestUtils.DummyCallback();
assertTrue(connection.newSession(cb));
@@ -797,15 +796,21 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
extras.putBoolean(CustomTabsConnection.NO_PRERENDERING_KEY, true);
assertTrue(connection.mayLaunchUrl(cb, Uri.parse(mTestPage), extras, null));
Context context = getInstrumentation().getTargetContext().getApplicationContext();
+ final Tab previousTab = getActivity().getActivityTab();
try {
startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustomTabIntent(
context, mTestPage, cb.asBinder()));
} catch (InterruptedException e) {
fail();
}
- Tab tab = getActivity().getActivityTab();
- assertEquals(mTestPage, tab.getUrl());
- assertFalse(tab.canGoBack());
+ CriteriaHelper.pollInstrumentationThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ final Tab currentTab = getActivity().getActivityTab();
+ return currentTab != previousTab && mTestPage.equals(currentTab.getUrl());
+ }
+ });
+ assertFalse(getActivity().getActivityTab().canGoBack());
}
/** Tests that calling mayLaunchUrl() without warmup() succeeds. */
« 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