Fix Race in TaskSchedulerSingleThreadTaskRunnerManagerStartTest.PostTaskBeforeStart

This race should have been more common but it only reproed on iPhone 7
hardware running iOS 11 with a release version of base_unittests.
Setting DCHECK_ALWAYS_ON to true would cause the bug to stop reproing.

Because the test task signalled its WaitableEvent at the beginning of
the task instead of at the end, it was possible for the function
holding |manager_started| to return before the task had a chance to
check it.

The fix here moves the signalling to the end of the task, ensuring that
|manager_started| is alive when it is checked by the test task.

BUG=784051

Change-Id: I1e88395bcc45b5390af0c75be806a0a7301e483e
Reviewed-on: https://chromium-review.googlesource.com/773299
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517139}

CrOS-Libchrome-Original-Commit: 491b1a06f7b2d32f35b45afdae622261193b77a9
1 file changed
tree: aac155e3f7456e4e351d4e4ff202b06aebfa1fc2
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/