Commit d8484b3b authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Deflake one of the TouchActionBrowserTests

The specific test is PanXYAtAutoXOverlapAreaMainThreadJanky.
In this test, we added some jank to the main thread, and I believe that
is causing the flakiness. We expect it to scroll along the X direction
for at least 22 pixels. In the result, it does scroll 20 pixels. Since
we are adding the jank to the main thread which could make the test
scroll with unexpected scroll amount, we should just make sure that it
does scrolled instead of comparing the scrolled amount.

Bug: 850715
Change-Id: I0452ac7e4cc7af1f9c9be616bd160d44c1bf7930
Reviewed-on: https://chromium-review.googlesource.com/1092878
Commit-Queue: Xida Chen <xidachen@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566029}
parent e8747d07
......@@ -101,9 +101,9 @@ const char kTouchActionURLWithOverlapArea[] =
" touch-action: pan-x;"
"}"
"</style>"
"<div class='box ta-auto'></div>"
"<div class='box ta-panx'></div>"
"<div class='box ta-pany'></div>"
"<div class='box ta-auto'></div>"
"<div class=spacer></div>"
"<script>"
" document.title='ready';"
......@@ -279,9 +279,18 @@ class TouchActionBrowserTest : public ContentBrowserTest {
ExecuteScriptAndExtractInt("document.documentElement.scrollHeight");
EXPECT_EQ(expected_scroll_height_after_scroll, scroll_height);
float page_scale_factor =
frame_observer_->LastRenderFrameMetadata().page_scale_factor;
if (page_scale_factor == 0)
page_scale_factor = 1.0f;
gfx::PointF touch_point(point);
if (page_scale_factor != 1.0f) {
touch_point.set_x(touch_point.x() * page_scale_factor);
touch_point.set_y(touch_point.y() * page_scale_factor);
}
SyntheticSmoothScrollGestureParams params;
params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
params.anchor = gfx::PointF(point);
params.anchor = touch_point;
params.distances.push_back(-distance);
run_loop_ = std::make_unique<base::RunLoop>();
......@@ -331,9 +340,17 @@ class TouchActionBrowserTest : public ContentBrowserTest {
int scroll_top = GetScrollTop();
int scroll_left = GetScrollLeft();
// Allow for 1px rounding inaccuracies for some screen sizes.
EXPECT_LE(expected_scroll_position_after_scroll.y() / 2, scroll_top);
EXPECT_LE(expected_scroll_position_after_scroll.x() / 2, scroll_left);
// It is hard to know when would the synthetic gesture being completely
// processed, so just make sure that it scrolled at least 1px along the
// expected scroll direction.
if (expected_scroll_position_after_scroll.y() > 0)
EXPECT_GT(scroll_top, 1);
else
EXPECT_EQ(scroll_top, 0);
if (expected_scroll_position_after_scroll.x() > 0)
EXPECT_GT(scroll_left, 1);
else
EXPECT_EQ(scroll_left, 0);
}
std::unique_ptr<RenderFrameSubmissionObserver> frame_observer_;
......
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