Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sensors: Try to fix flakiness in iframe-related Generic Sensor tests. #23503

Closed
wants to merge 1 commit into from

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented May 11, 2020

The second test, for focus traversal within same-origin frames, was
occasionally failing, especially in the Mac bots.

The flakiness seems to come from the way the "is_sensor_suspended" command
was implemented in iframe_sensor_handler.html. The sensor in the iframe was
created with the default frequency of 5Hz and, consequently, a period of
200ms. "is_sensor_suspended" tried to detect whether the sensor was
suspended by either receiving a new "reading" event (in which case the
sensor was not suspended), or by reaching a timeout function with a period
of 250ms (200ms from the sensor + a small delay).

In some cases, it looks like the 250ms were not enough and we reached the
timeout function prior to the sensor emitting a new "reading" event. Try to
fix this by using a longer timeout of twice the sensor's period to be more
certain that if we reach that code at least one event should have been
emitted before.

While here, make the code easier to follow by documenting what we are doing
and relying on fewer magic numbers, and increase the sensor frequency so
that the test does not take unnecessarily long to run.

Bug: 1073865
Change-Id: I630ad6034f0839c17f11f111ead24a88affc9dd2
Reviewed-on: https://chromium-review.googlesource.com/2193672
WPT-Export-Revision: c6de5bb666abf21c56e386d67de05a95eeb63589

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

The second test, for focus traversal within same-origin frames, was
occasionally failing, especially in the Mac bots.

The flakiness seems to come from the way the "is_sensor_suspended" command
was implemented in iframe_sensor_handler.html. The sensor in the iframe was
created with the default frequency of 5Hz and, consequently, a period of
200ms. "is_sensor_suspended" tried to detect whether the sensor was
suspended by either receiving a new "reading" event (in which case the
sensor was not suspended), or by reaching a timeout function with a period
of 250ms (200ms from the sensor + a small delay).

In some cases, it looks like the 250ms were not enough and we reached the
timeout function prior to the sensor emitting a new "reading" event. Try to
fix this by using a longer timeout of twice the sensor's period to be more
certain that if we reach that code at least one event should have been
emitted before.

While here, make the code easier to follow by documenting what we are doing
and relying on fewer magic numbers, and increase the sensor frequency so
that the test does not take unnecessarily long to run.

Bug: 1073865
Change-Id: I630ad6034f0839c17f11f111ead24a88affc9dd2
@rakuco
Copy link
Member

rakuco commented Sep 21, 2020

This CL was superseded by another one. I'll close this one manually now that I've abandoned the CL in Gerrit too.

@rakuco rakuco closed this Sep 21, 2020
@rakuco rakuco deleted the chromium-export-cl-2193672 branch September 21, 2020 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants