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_entry.h" | 12 #include "net/log/test_net_log_entry.h" |
| 13 #include "net/nqe/network_quality_estimator_params.h" |
13 #include "net/test/embedded_test_server/http_response.h" | 14 #include "net/test/embedded_test_server/http_response.h" |
14 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" | 15 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" |
15 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
16 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 const base::FilePath::CharType kTestFilePath[] = | 21 const base::FilePath::CharType kTestFilePath[] = |
21 FILE_PATH_LITERAL("net/data/url_request_unittest"); | 22 FILE_PATH_LITERAL("net/data/url_request_unittest"); |
22 | 23 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 std::move(net_log)) {} | 60 std::move(net_log)) {} |
60 | 61 |
61 TestNetworkQualityEstimator::TestNetworkQualityEstimator( | 62 TestNetworkQualityEstimator::TestNetworkQualityEstimator( |
62 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider, | 63 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider, |
63 const std::map<std::string, std::string>& variation_params, | 64 const std::map<std::string, std::string>& variation_params, |
64 bool allow_local_host_requests_for_tests, | 65 bool allow_local_host_requests_for_tests, |
65 bool allow_smaller_responses_for_tests, | 66 bool allow_smaller_responses_for_tests, |
66 bool add_default_platform_observations, | 67 bool add_default_platform_observations, |
67 bool suppress_notifications_for_testing, | 68 bool suppress_notifications_for_testing, |
68 std::unique_ptr<BoundTestNetLog> net_log) | 69 std::unique_ptr<BoundTestNetLog> net_log) |
69 : NetworkQualityEstimator(std::move(external_estimate_provider), | 70 : NetworkQualityEstimator( |
70 variation_params, | 71 std::move(external_estimate_provider), |
71 allow_local_host_requests_for_tests, | 72 base::MakeUnique<NetworkQualityEstimatorParams>(variation_params), |
72 allow_smaller_responses_for_tests, | 73 allow_local_host_requests_for_tests, |
73 add_default_platform_observations, | 74 allow_smaller_responses_for_tests, |
74 net_log->bound()), | 75 add_default_platform_observations, |
| 76 net_log->bound()), |
| 77 |
75 current_network_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN), | 78 current_network_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN), |
76 accuracy_recording_intervals_set_(false), | 79 accuracy_recording_intervals_set_(false), |
77 rand_double_(0.0), | 80 rand_double_(0.0), |
78 embedded_test_server_(base::FilePath(kTestFilePath)), | 81 embedded_test_server_(base::FilePath(kTestFilePath)), |
79 suppress_notifications_for_testing_(suppress_notifications_for_testing), | 82 suppress_notifications_for_testing_(suppress_notifications_for_testing), |
80 net_log_(std::move(net_log)) { | 83 net_log_(std::move(net_log)) { |
81 // Set up the embedded test server. | 84 // Set up the embedded test server. |
82 EXPECT_TRUE(embedded_test_server_.Start()); | 85 EXPECT_TRUE(embedded_test_server_.Start()); |
83 } | 86 } |
84 | 87 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 NotifyRTTAndThroughputEstimatesObserverIfPresent( | 310 NotifyRTTAndThroughputEstimatesObserverIfPresent( |
308 RTTAndThroughputEstimatesObserver* observer) const { | 311 RTTAndThroughputEstimatesObserver* observer) const { |
309 if (suppress_notifications_for_testing_) | 312 if (suppress_notifications_for_testing_) |
310 return; | 313 return; |
311 | 314 |
312 NetworkQualityEstimator::NotifyRTTAndThroughputEstimatesObserverIfPresent( | 315 NetworkQualityEstimator::NotifyRTTAndThroughputEstimatesObserverIfPresent( |
313 observer); | 316 observer); |
314 } | 317 } |
315 | 318 |
316 } // namespace net | 319 } // namespace net |
OLD | NEW |