Commit ee9db8c0 authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

[WebLayer] Fix flaky TopControlsTest.testBasic

The test was getting the page height before the top controls were fully
shown.

Bug: 1020065, 1019948
Change-Id: Ide28825e5c4896421dc17fcc84e4da6714f25364
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893516Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711377}
parent 5a847a2a
......@@ -81,6 +81,14 @@ public class TopControlsTest {
final String url = UrlUtils.encodeHtmlDataUri("<body><p style='height:5000px'>");
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl(url);
// Wait for layout to make sure the top contents container is shown.
CallbackHelper helper = new CallbackHelper();
TestThreadUtils.runOnUiThreadBlocking(() -> {
activity.getTopContentsContainer().getViewTreeObserver().addOnGlobalLayoutListener(
helper::notifyCalled);
});
helper.waitForCallback(0);
TestThreadUtils.runOnUiThreadBlocking(() -> {
mTopControlsHeight = activity.getTopContentsContainer().getHeight();
Assert.assertTrue(mTopControlsHeight > 0);
......
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