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 #include "net/nqe/network_quality_estimator_test_util.h" | 5 #include "net/nqe/network_quality_estimator_test_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
11 #include "net/log/net_log_with_source.h" | 11 #include "net/log/net_log_with_source.h" |
12 #include "net/log/test_net_log.h" | 12 #include "net/log/test_net_log.h" |
13 #include "net/log/test_net_log_entry.h" | 13 #include "net/log/test_net_log_entry.h" |
| 14 #include "net/nqe/network_quality_estimator_params.h" |
14 #include "net/test/embedded_test_server/http_response.h" | 15 #include "net/test/embedded_test_server/http_response.h" |
15 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" | 16 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" |
16 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
17 #include "net/url_request/url_request_test_util.h" | 18 #include "net/url_request/url_request_test_util.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 const base::FilePath::CharType kTestFilePath[] = | 22 const base::FilePath::CharType kTestFilePath[] = |
22 FILE_PATH_LITERAL("net/data/url_request_unittest"); | 23 FILE_PATH_LITERAL("net/data/url_request_unittest"); |
23 | 24 |
(...skipping 20 matching lines...) Expand all Loading... |
44 false, | 45 false, |
45 base::MakeUnique<BoundTestNetLog>()) {} | 46 base::MakeUnique<BoundTestNetLog>()) {} |
46 | 47 |
47 TestNetworkQualityEstimator::TestNetworkQualityEstimator( | 48 TestNetworkQualityEstimator::TestNetworkQualityEstimator( |
48 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider, | 49 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider, |
49 const std::map<std::string, std::string>& variation_params, | 50 const std::map<std::string, std::string>& variation_params, |
50 bool allow_local_host_requests_for_tests, | 51 bool allow_local_host_requests_for_tests, |
51 bool allow_smaller_responses_for_tests, | 52 bool allow_smaller_responses_for_tests, |
52 bool add_default_platform_observations, | 53 bool add_default_platform_observations, |
53 std::unique_ptr<BoundTestNetLog> net_log) | 54 std::unique_ptr<BoundTestNetLog> net_log) |
54 : NetworkQualityEstimator(std::move(external_estimate_provider), | 55 : NetworkQualityEstimator( |
55 variation_params, | 56 std::move(external_estimate_provider), |
56 allow_local_host_requests_for_tests, | 57 base::MakeUnique<nqe::internal::NetworkQualityEstimatorParams>( |
57 allow_smaller_responses_for_tests, | 58 variation_params), |
58 add_default_platform_observations, | 59 allow_local_host_requests_for_tests, |
59 net_log->bound()), | 60 allow_smaller_responses_for_tests, |
| 61 add_default_platform_observations, |
| 62 net_log->bound()), |
60 current_network_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN), | 63 current_network_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN), |
61 accuracy_recording_intervals_set_(false), | 64 accuracy_recording_intervals_set_(false), |
62 rand_double_(0.0), | 65 rand_double_(0.0), |
63 embedded_test_server_(base::FilePath(kTestFilePath)), | 66 embedded_test_server_(base::FilePath(kTestFilePath)), |
64 net_log_(std::move(net_log)) { | 67 net_log_(std::move(net_log)) { |
65 // Set up the embedded test server. | 68 // Set up the embedded test server. |
66 EXPECT_TRUE(embedded_test_server_.Start()); | 69 EXPECT_TRUE(embedded_test_server_.Start()); |
67 } | 70 } |
68 | 71 |
69 TestNetworkQualityEstimator::~TestNetworkQualityEstimator() {} | 72 TestNetworkQualityEstimator::~TestNetworkQualityEstimator() {} |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 const { | 276 const { |
274 return nqe::internal::NetworkID(current_network_type_, current_network_id_); | 277 return nqe::internal::NetworkID(current_network_type_, current_network_id_); |
275 } | 278 } |
276 | 279 |
277 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( | 280 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( |
278 const base::FilePath& document_root) { | 281 const base::FilePath& document_root) { |
279 AddDefaultHandlers(document_root); | 282 AddDefaultHandlers(document_root); |
280 } | 283 } |
281 | 284 |
282 } // namespace net | 285 } // namespace net |
OLD | NEW |