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/test/embedded_test_server/http_response.h" | 14 #include "net/test/embedded_test_server/http_response.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 |
23 } // namespace | 24 } // namespace |
24 | 25 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 67 } |
67 | 68 |
68 TestNetworkQualityEstimator::~TestNetworkQualityEstimator() {} | 69 TestNetworkQualityEstimator::~TestNetworkQualityEstimator() {} |
69 | 70 |
70 void TestNetworkQualityEstimator::RunOneRequest() { | 71 void TestNetworkQualityEstimator::RunOneRequest() { |
71 TestDelegate test_delegate; | 72 TestDelegate test_delegate; |
72 TestURLRequestContext context(true); | 73 TestURLRequestContext context(true); |
73 context.set_network_quality_estimator(this); | 74 context.set_network_quality_estimator(this); |
74 context.Init(); | 75 context.Init(); |
75 std::unique_ptr<URLRequest> request( | 76 std::unique_ptr<URLRequest> request( |
76 context.CreateRequest(GetEchoURL(), DEFAULT_PRIORITY, &test_delegate)); | 77 context.CreateRequest(GetEchoURL(), DEFAULT_PRIORITY, &test_delegate, |
| 78 TRAFFIC_ANNOTATION_FOR_TESTS)); |
77 request->SetLoadFlags(request->load_flags() | LOAD_MAIN_FRAME_DEPRECATED); | 79 request->SetLoadFlags(request->load_flags() | LOAD_MAIN_FRAME_DEPRECATED); |
78 request->Start(); | 80 request->Start(); |
79 base::RunLoop().Run(); | 81 base::RunLoop().Run(); |
80 } | 82 } |
81 | 83 |
82 void TestNetworkQualityEstimator::SimulateNetworkChange( | 84 void TestNetworkQualityEstimator::SimulateNetworkChange( |
83 NetworkChangeNotifier::ConnectionType new_connection_type, | 85 NetworkChangeNotifier::ConnectionType new_connection_type, |
84 const std::string& network_id) { | 86 const std::string& network_id) { |
85 current_network_type_ = new_connection_type; | 87 current_network_type_ = new_connection_type; |
86 current_network_id_ = network_id; | 88 current_network_id_ = network_id; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 const { | 263 const { |
262 return nqe::internal::NetworkID(current_network_type_, current_network_id_); | 264 return nqe::internal::NetworkID(current_network_type_, current_network_id_); |
263 } | 265 } |
264 | 266 |
265 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( | 267 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( |
266 const base::FilePath& document_root) { | 268 const base::FilePath& document_root) { |
267 AddDefaultHandlers(document_root); | 269 AddDefaultHandlers(document_root); |
268 } | 270 } |
269 | 271 |
270 } // namespace net | 272 } // namespace net |
OLD | NEW |