Chromium Code Reviews
DescriptionFix race condition in flaky GamepadProvider tests
GamepadProvider polls GamepadDataFetchers on a background thread, then
copies the gamepad state into a shared memory buffer. Unit tests need to
know when this buffer has been updated to verify that the new state is
correct and check for callbacks. MockGamepadDataFetcher signals when its
state is queried, which is used as an indicator that the buffer may have
new data.
The buffer is not written until after gamepad state is read from the
fetchers, creating a small window between the MockGamepadDataFetcher signal
and the actual buffer write. Rarely, the main thread would read from the
buffer before the provider could write to it, causing test failures.
Instead of relying on MockGamepadDataFetcher, the tests will now wait for
the version number of the shared memory buffer's seqlock to advance before
continuing. This ensures that the buffer has been written to at least once.
BUG=692219
Review-Url: https://codereview.chromium.org/2820563003
Cr-Commit-Position: refs/heads/master@{#464760}
Committed: https://chromium.googlesource.com/chromium/src/+/d5427aa537bb0f921a2dda161bb3b555a0e6da6c
Patch Set 1 #
Total comments: 2
Patch Set 2 : add WaitForDataAndCallbacksIssued #Messages
Total messages: 11 (6 generated)
|