• Yao Xiao's avatar
    Fix data races in the floc unittests · 42e2e9c0
    Yao Xiao authored
    2 tests were disabled recently as they were flaky on builder
    "Linux TSan Tests". That's because when the tests finish, there is
    still a pending history query, and on the history backend thread there
    is a check for the feature kHideFromApi3Transitions (also introduced
    recently). If the check occurs after the ScopedFeatureList is
    destroyed, then there is a data race and would fail the sanitizer.
    
    This CL moves the |feature_list_| member to the test class before the
    |history_service_| member, and initialize it in the test constructor.
    This ensures it will only be destroyed only after |history_service_| is
    destroyed.
    
    This CL also removes the FlocIdComputedEventLogging feature
    initialization in the test, as it's already enabled by default.
    
    Bug: 1143855
    Change-Id: I6b7141a0bf9000ac453768828be1d6a35218a079
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2512846Reviewed-by: default avatarJosh Karlin <jkarlin@chromium.org>
    Commit-Queue: Yao Xiao <yaoxia@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#823612}
    42e2e9c0
floc_id_provider_unittest.cc 45.4 KB