Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Issue 2820563003: Fix race condition in flaky GamepadProvider tests (Closed)

Created:
3 years, 8 months ago by mattreynolds
Modified:
3 years, 8 months ago
Reviewers:
bajones
CC:
chromium-reviews, scheib
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+65 lines, -24 lines) Patch
M device/gamepad/gamepad_provider_unittest.cc View 1 14 chunks +65 lines, -24 lines 0 comments Download

Messages

Total messages: 11 (6 generated)
mattreynolds
Hi Brandon, I think I figured out what was causing our gamepad provider tests to ...
3 years, 8 months ago (2017-04-14 00:54:45 UTC) #3
bajones
Great work! Definitely sounds as if that could be the culprit. One nit, but otherwise ...
3 years, 8 months ago (2017-04-14 03:06:18 UTC) #4
mattreynolds
Thanks Brandon https://codereview.chromium.org/2820563003/diff/1/device/gamepad/gamepad_provider_unittest.cc File device/gamepad/gamepad_provider_unittest.cc (right): https://codereview.chromium.org/2820563003/diff/1/device/gamepad/gamepad_provider_unittest.cc#newcode186 device/gamepad/gamepad_provider_unittest.cc:186: WaitForData(buffer); On 2017/04/14 03:06:18, bajones wrote: > ...
3 years, 8 months ago (2017-04-14 18:05:48 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2820563003/20001
3 years, 8 months ago (2017-04-14 18:06:11 UTC) #8
commit-bot: I haz the power
3 years, 8 months ago (2017-04-14 18:31:45 UTC) #11
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/d5427aa537bb0f921a2dda161bb3...

Powered by Google App Engine
This is Rietveld 408576698