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

Unified Diff: components/network_time/network_time_test_utils.cc

Issue 2930613002: Update a comment in network time test helper (Closed)
Patch Set: add link to bug discussion Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/network_time/network_time_test_utils.cc
diff --git a/components/network_time/network_time_test_utils.cc b/components/network_time/network_time_test_utils.cc
index 441ecba0269fe22ddea5a7b034238afe10cd5145..2f28d5a417fe775567be54b47673ee2c3df66497 100644
--- a/components/network_time/network_time_test_utils.cc
+++ b/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>()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698