summaryrefslogtreecommitdiff
path: root/chromium/components/network_time/network_time_test_utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/network_time/network_time_test_utils.cc')
-rw-r--r--chromium/components/network_time/network_time_test_utils.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/chromium/components/network_time/network_time_test_utils.cc b/chromium/components/network_time/network_time_test_utils.cc
index 441ecba0269..2f28d5a417f 100644
--- a/chromium/components/network_time/network_time_test_utils.cc
+++ b/chromium/components/network_time/network_time_test_utils.cc
@@ -95,7 +95,14 @@ void FieldTrialTest::SetNetworkQueriesWithVariationsService(
// ScopedFeatureList helper class. If this comment was useful to you
// please send me a postcard.
- field_trial_list_.reset(); // Averts a CHECK fail in constructor below.
+ // SetNetworkQueriesWithVariationsService() is usually called during test
+ // fixture setup (to establish a default state) and then again in certain
+ // tests that want to set special params. FieldTrialList is meant to be a
+ // singleton with only one instance existing at once, and the constructor
+ // fails a CHECK if this is violated. To allow these duplicate calls to this
+ // method, any existing FieldTrialList must be destroyed before creating a new
+ // one. (See https://crbug.com/684216#c5 for more discussion.)
+ field_trial_list_.reset();
field_trial_list_.reset(
new base::FieldTrialList(base::MakeUnique<base::MockEntropyProvider>()));