Commit 178b21a3 authored by twellington's avatar twellington Committed by Commit bot

[Contextual Search] Fix flaky tests

Attempt to fix ContextualSearchManagerTest#testImageControl() by running
calls to the ContextualSearchImageControl on the UI thread. Also add
@RetryOnFailure to #testTapOnRoleIgnored().

BUG=669405,669565

Review-Url: https://codereview.chromium.org/2534193002
Cr-Commit-Position: refs/heads/master@{#435040}
parent d10df401
...@@ -1537,6 +1537,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro ...@@ -1537,6 +1537,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/ */
@SmallTest @SmallTest
@Feature({"ContextualSearch"}) @Feature({"ContextualSearch"})
@RetryOnFailure
public void testTapOnRoleIgnored() throws InterruptedException, TimeoutException { public void testTapOnRoleIgnored() throws InterruptedException, TimeoutException {
PanelState initialState = mPanel.getPanelState(); PanelState initialState = mPanel.getPanelState();
clickNode("role"); clickNode("role");
...@@ -2673,7 +2674,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro ...@@ -2673,7 +2674,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
public void testImageControl() throws InterruptedException, TimeoutException { public void testImageControl() throws InterruptedException, TimeoutException {
simulateTapSearch("search"); simulateTapSearch("search");
ContextualSearchImageControl imageControl = mPanel.getImageControl(); final ContextualSearchImageControl imageControl = mPanel.getImageControl();
final ContextualSearchIconSpriteControl iconSpriteControl = final ContextualSearchIconSpriteControl iconSpriteControl =
imageControl.getIconSpriteControl(); imageControl.getIconSpriteControl();
...@@ -2681,8 +2682,13 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro ...@@ -2681,8 +2682,13 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
assertFalse(imageControl.getThumbnailVisible()); assertFalse(imageControl.getThumbnailVisible());
assertTrue(TextUtils.isEmpty(imageControl.getThumbnailUrl())); assertTrue(TextUtils.isEmpty(imageControl.getThumbnailUrl()));
imageControl.setThumbnailUrl("http://someimageurl.com/image.png"); ThreadUtils.runOnUiThreadBlocking(new Runnable() {
imageControl.onThumbnailFetched(true); @Override
public void run() {
imageControl.setThumbnailUrl("http://someimageurl.com/image.png");
imageControl.onThumbnailFetched(true);
}
});
assertTrue(imageControl.getThumbnailVisible()); assertTrue(imageControl.getThumbnailVisible());
assertEquals(imageControl.getThumbnailUrl(), "http://someimageurl.com/image.png"); assertEquals(imageControl.getThumbnailUrl(), "http://someimageurl.com/image.png");
...@@ -2696,7 +2702,12 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro ...@@ -2696,7 +2702,12 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
} }
}); });
imageControl.hideStaticImage(false); ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
imageControl.hideStaticImage(false);
}
});
assertTrue(iconSpriteControl.isVisible()); assertTrue(iconSpriteControl.isVisible());
assertFalse(imageControl.getThumbnailVisible()); assertFalse(imageControl.getThumbnailVisible());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment