Chromium Code Reviews| Index: components/network_time/network_time_test_utils.h |
| diff --git a/components/network_time/network_time_test_utils.h b/components/network_time/network_time_test_utils.h |
| index 97ed8dce53509e93ea1fda438cc1f54103447b83..be3d989a9cdcb52fcb8ad4815455742c68d3401b 100644 |
| --- a/components/network_time/network_time_test_utils.h |
| +++ b/components/network_time/network_time_test_utils.h |
| @@ -27,25 +27,40 @@ class HttpResponse; |
| namespace network_time { |
| +// The time that GoodTimeResponseHandler returns in its responses. Can |
| +// be converted to a base::Time with base::Time::FromJsTime. |
| +extern const double kGoodTimeResponseHandlerTime; |
|
meacer
2016/11/01 22:20:18
Why not an integer in seconds and milliseconds?
estark
2016/11/02 19:58:13
See explanation above; I think if this matches the
|
| + |
| std::unique_ptr<net::test_server::HttpResponse> GoodTimeResponseHandler( |
| const net::test_server::HttpRequest& request); |
| // Allows tests to configure the network time queries field trial. |
| class FieldTrialTest { |
| public: |
| - enum FetchesOnDemandStatus { |
| - ENABLE_FETCHES_ON_DEMAND, |
| - DISABLE_FETCHES_ON_DEMAND, |
| + enum FetchBehavior { |
| + FETCHES_IN_BACKGROUND_ONLY, |
| + FETCHES_ON_DEMAND_ONLY, |
| + FETCHES_IN_BACKGROUND_AND_ON_DEMAND, |
| }; |
| + // A FieldTrialList exists as a global singleton. Use the |
| + // FieldTrialTest() constructor in unit tests to create a |
| + // FieldTrialList; use CreateForBrowserTest() to use the singleton |
| + // FieldTrialList that is created during browser setup. (Using the |
| + // FieldTrialTest() constructor in a browser test will fail because a |
| + // FieldTrialList has already been constructed.) |
|
meacer
2016/11/01 22:20:18
nit: Perhaps you could also add CreateForUnitTest
estark
2016/11/02 19:58:13
Done.
|
| + |
| FieldTrialTest(); |
| virtual ~FieldTrialTest(); |
| - void SetNetworkQueriesWithVariationsService( |
| - bool enable, |
| - float query_probability, |
| - FetchesOnDemandStatus fetches_on_demand); |
| + |
| + static FieldTrialTest* CreateForBrowserTest(); |
| + |
| + void SetNetworkQueriesWithVariationsService(bool enable, |
| + float query_probability, |
| + FetchBehavior fetch_behavior); |
| private: |
| + bool create_field_trial_list_ = true; |
| std::unique_ptr<base::FieldTrialList> field_trial_list_; |
| std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list_; |