| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ |
| 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 | 25 |
| 26 class ExternalEstimateProvider; | 26 class ExternalEstimateProvider; |
| 27 | 27 |
| 28 // Helps in setting the current network type and id. | 28 // Helps in setting the current network type and id. |
| 29 class TestNetworkQualityEstimator : public NetworkQualityEstimator { | 29 class TestNetworkQualityEstimator : public NetworkQualityEstimator { |
| 30 public: | 30 public: |
| 31 TestNetworkQualityEstimator(); |
| 32 |
| 33 explicit TestNetworkQualityEstimator( |
| 34 const std::map<std::string, std::string>& variation_params); |
| 35 |
| 31 TestNetworkQualityEstimator( | 36 TestNetworkQualityEstimator( |
| 32 const std::map<std::string, std::string>& variation_params, | 37 const std::map<std::string, std::string>& variation_params, |
| 33 std::unique_ptr<net::ExternalEstimateProvider> | 38 std::unique_ptr<net::ExternalEstimateProvider> |
| 34 external_estimate_provider); | 39 external_estimate_provider); |
| 35 | 40 |
| 36 TestNetworkQualityEstimator( | 41 TestNetworkQualityEstimator( |
| 37 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider, | 42 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider, |
| 38 const std::map<std::string, std::string>& variation_params, | 43 const std::map<std::string, std::string>& variation_params, |
| 39 bool allow_local_host_requests_for_tests, | 44 bool allow_local_host_requests_for_tests, |
| 40 bool allow_smaller_responses_for_tests, | 45 bool allow_smaller_responses_for_tests, |
| 41 bool add_default_platform_observations); | 46 bool add_default_platform_observations); |
| 42 | 47 |
| 43 explicit TestNetworkQualityEstimator( | |
| 44 const std::map<std::string, std::string>& variation_params); | |
| 45 | |
| 46 ~TestNetworkQualityEstimator() override; | 48 ~TestNetworkQualityEstimator() override; |
| 47 | 49 |
| 48 // Runs one URL request to completion. | 50 // Runs one URL request to completion. |
| 49 void RunOneRequest(); | 51 void RunOneRequest(); |
| 50 | 52 |
| 51 // Overrides the current network type and id. | 53 // Overrides the current network type and id. |
| 52 // Notifies network quality estimator of a change in connection. | 54 // Notifies network quality estimator of a change in connection. |
| 53 void SimulateNetworkChange( | 55 void SimulateNetworkChange( |
| 54 NetworkChangeNotifier::ConnectionType new_connection_type, | 56 NetworkChangeNotifier::ConnectionType new_connection_type, |
| 55 const std::string& network_id); | 57 const std::string& network_id); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 double rand_double_; | 222 double rand_double_; |
| 221 | 223 |
| 222 LocalHttpTestServer embedded_test_server_; | 224 LocalHttpTestServer embedded_test_server_; |
| 223 | 225 |
| 224 DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityEstimator); | 226 DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityEstimator); |
| 225 }; | 227 }; |
| 226 | 228 |
| 227 } // namespace net | 229 } // namespace net |
| 228 | 230 |
| 229 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ | 231 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ |
| OLD | NEW |