OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/http_network_layer.h" | 5 #include "net/http/http_network_layer.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
8 #include "net/cert/mock_cert_verifier.h" | 10 #include "net/cert/mock_cert_verifier.h" |
9 #include "net/dns/mock_host_resolver.h" | 11 #include "net/dns/mock_host_resolver.h" |
10 #include "net/http/http_network_session.h" | 12 #include "net/http/http_network_session.h" |
11 #include "net/http/http_server_properties_impl.h" | 13 #include "net/http/http_server_properties_impl.h" |
12 #include "net/http/http_transaction_test_util.h" | 14 #include "net/http/http_transaction_test_util.h" |
13 #include "net/http/transport_security_state.h" | 15 #include "net/http/transport_security_state.h" |
14 #include "net/log/net_log.h" | 16 #include "net/log/net_log.h" |
15 #include "net/proxy/proxy_service.h" | 17 #include "net/proxy/proxy_service.h" |
16 #include "net/socket/socket_test_util.h" | 18 #include "net/socket/socket_test_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
27 protected: | 29 protected: |
28 HttpNetworkLayerTest() : ssl_config_service_(new SSLConfigServiceDefaults) {} | 30 HttpNetworkLayerTest() : ssl_config_service_(new SSLConfigServiceDefaults) {} |
29 | 31 |
30 void SetUp() override { | 32 void SetUp() override { |
31 ConfigureTestDependencies(ProxyService::CreateDirect()); | 33 ConfigureTestDependencies(ProxyService::CreateDirect()); |
32 } | 34 } |
33 | 35 |
34 void ConfigureTestDependencies(scoped_ptr<ProxyService> proxy_service) { | 36 void ConfigureTestDependencies(scoped_ptr<ProxyService> proxy_service) { |
35 cert_verifier_.reset(new MockCertVerifier); | 37 cert_verifier_.reset(new MockCertVerifier); |
36 transport_security_state_.reset(new TransportSecurityState); | 38 transport_security_state_.reset(new TransportSecurityState); |
37 proxy_service_ = proxy_service.Pass(); | 39 proxy_service_ = std::move(proxy_service); |
38 HttpNetworkSession::Params session_params; | 40 HttpNetworkSession::Params session_params; |
39 session_params.client_socket_factory = &mock_socket_factory_; | 41 session_params.client_socket_factory = &mock_socket_factory_; |
40 session_params.host_resolver = &host_resolver_; | 42 session_params.host_resolver = &host_resolver_; |
41 session_params.cert_verifier = cert_verifier_.get(); | 43 session_params.cert_verifier = cert_verifier_.get(); |
42 session_params.transport_security_state = transport_security_state_.get(); | 44 session_params.transport_security_state = transport_security_state_.get(); |
43 session_params.proxy_service = proxy_service_.get(); | 45 session_params.proxy_service = proxy_service_.get(); |
44 session_params.ssl_config_service = ssl_config_service_.get(); | 46 session_params.ssl_config_service = ssl_config_service_.get(); |
45 session_params.http_server_properties = | 47 session_params.http_server_properties = |
46 http_server_properties_.GetWeakPtr(); | 48 http_server_properties_.GetWeakPtr(); |
47 network_session_.reset(new HttpNetworkSession(session_params)); | 49 network_session_.reset(new HttpNetworkSession(session_params)); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); | 396 rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); |
395 ASSERT_EQ(ERR_CONNECTION_RESET, callback.GetResult(rv)); | 397 ASSERT_EQ(ERR_CONNECTION_RESET, callback.GetResult(rv)); |
396 | 398 |
397 // network_accessed is true; the HTTP stack did try to make a connection. | 399 // network_accessed is true; the HTTP stack did try to make a connection. |
398 EXPECT_TRUE(trans->GetResponseInfo()->network_accessed); | 400 EXPECT_TRUE(trans->GetResponseInfo()->network_accessed); |
399 } | 401 } |
400 | 402 |
401 } // namespace | 403 } // namespace |
402 | 404 |
403 } // namespace net | 405 } // namespace net |
OLD | NEW |