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
*/
@SmallTest
@Feature({"ContextualSearch"})
@RetryOnFailure
public void testTapOnRoleIgnored() throws InterruptedException, TimeoutException {
PanelState initialState = mPanel.getPanelState();
clickNode("role");
......@@ -2673,7 +2674,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
public void testImageControl() throws InterruptedException, TimeoutException {
simulateTapSearch("search");
ContextualSearchImageControl imageControl = mPanel.getImageControl();
final ContextualSearchImageControl imageControl = mPanel.getImageControl();
final ContextualSearchIconSpriteControl iconSpriteControl =
imageControl.getIconSpriteControl();
......@@ -2681,8 +2682,13 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
assertFalse(imageControl.getThumbnailVisible());
assertTrue(TextUtils.isEmpty(imageControl.getThumbnailUrl()));
imageControl.setThumbnailUrl("http://someimageurl.com/image.png");
imageControl.onThumbnailFetched(true);
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
imageControl.setThumbnailUrl("http://someimageurl.com/image.png");
imageControl.onThumbnailFetched(true);
}
});
assertTrue(imageControl.getThumbnailVisible());
assertEquals(imageControl.getThumbnailUrl(), "http://someimageurl.com/image.png");
......@@ -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());
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