Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix base_unittests crash on Windows with --single-process-tests.
The problem was caused by ScopedFeatureList not resetting the FeatureList to null if it was that way prior to the scope. The FeatureList that stuck around had references to FieldTrial objects that were destroyed by a previous test and this caused a crash when FieldTrialListTest.TestCopyFieldTrialStateToFlags went to use them. As part of the fix, also adds a ScopedFeatureList to that test since it was previously relying on the left-over instance. Finally, a lot of tests that used feature params were implicitly relying on a FeatureList having been set (and leaked) by some earlier test in the same batch. To keep these tests working without modifying them all to have a ScopedFeatureList (when they're not actually trying to test param override values), this change updates FeatureList::GetFieldTrial() to have similar logic to IsEnabled() when the FeatureList instance was not initialized. With the new behavior, GetFieldTrial() - which is generally not invoked directly but queried by the implementation of base::GetFieldTrialParamValueByFeature() - will return a sane default when FeatureList is not initialized. This way, it's consistent with what we do for FeatureList::IsEnabled() - and in both cases, they will set a bool that is checked to ensure that once used that way, setting a FeatureList instance will be an error. BUG=757651 Change-Id: I79ce1ddcd000d1628c7396faee25ed848b1d8e1a Reviewed-on: https://chromium-review.googlesource.com/671290 Reviewed-by: Wez <wez@chromium.org> Commit-Queue: Alexei Svitkine <asvitkine@chromium.org> Cr-Commit-Position: refs/heads/master@{#502707}
- Loading branch information