| 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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/test/histogram_tester.h" | 14 #include "base/test/histogram_tester.h" |
| 15 #include "net/base/host_port_pair.h" |
| 15 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 16 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 18 #include "net/base/proxy_delegate.h" |
| 17 #include "net/base/request_priority.h" | 19 #include "net/base/request_priority.h" |
| 18 #include "net/base/test_data_directory.h" | 20 #include "net/base/test_data_directory.h" |
| 19 #include "net/base/test_data_stream.h" | 21 #include "net/base/test_data_stream.h" |
| 20 #include "net/log/test_net_log.h" | 22 #include "net/log/test_net_log.h" |
| 21 #include "net/log/test_net_log_entry.h" | 23 #include "net/log/test_net_log_entry.h" |
| 22 #include "net/log/test_net_log_util.h" | 24 #include "net/log/test_net_log_util.h" |
| 25 #include "net/proxy/proxy_server.h" |
| 23 #include "net/socket/client_socket_pool_manager.h" | 26 #include "net/socket/client_socket_pool_manager.h" |
| 24 #include "net/socket/next_proto.h" | 27 #include "net/socket/next_proto.h" |
| 25 #include "net/socket/socket_test_util.h" | 28 #include "net/socket/socket_test_util.h" |
| 26 #include "net/spdy/spdy_http_utils.h" | 29 #include "net/spdy/spdy_http_utils.h" |
| 27 #include "net/spdy/spdy_session_pool.h" | 30 #include "net/spdy/spdy_session_pool.h" |
| 28 #include "net/spdy/spdy_session_test_util.h" | 31 #include "net/spdy/spdy_session_test_util.h" |
| 29 #include "net/spdy/spdy_stream.h" | 32 #include "net/spdy/spdy_stream.h" |
| 30 #include "net/spdy/spdy_stream_test_util.h" | 33 #include "net/spdy/spdy_stream_test_util.h" |
| 31 #include "net/spdy/spdy_test_util_common.h" | 34 #include "net/spdy/spdy_test_util_common.h" |
| 32 #include "net/spdy/spdy_test_utils.h" | 35 #include "net/spdy/spdy_test_utils.h" |
| (...skipping 4917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4950 scoped_ptr<SpdyFrame> req( | 4953 scoped_ptr<SpdyFrame> req( |
| 4951 spdy_util_.ConstructSpdyGet(nullptr, 0, false, 1, LOWEST, true)); | 4954 spdy_util_.ConstructSpdyGet(nullptr, 0, false, 1, LOWEST, true)); |
| 4952 scoped_ptr<SpdyFrame> rst( | 4955 scoped_ptr<SpdyFrame> rst( |
| 4953 spdy_util_.ConstructSpdyRstStream(4, RST_STREAM_REFUSED_STREAM)); | 4956 spdy_util_.ConstructSpdyRstStream(4, RST_STREAM_REFUSED_STREAM)); |
| 4954 MockWrite writes[] = { | 4957 MockWrite writes[] = { |
| 4955 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 5), | 4958 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 5), |
| 4956 }; | 4959 }; |
| 4957 | 4960 |
| 4958 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 4961 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 4959 session_deps_.socket_factory->AddSocketDataProvider(&data); | 4962 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 4960 session_deps_.trusted_spdy_proxy = | 4963 |
| 4961 HostPortPair::FromURL(GURL(kDefaultURL)).ToString(); | 4964 scoped_ptr<TestProxyDelegate> proxy_delegate(new TestProxyDelegate()); |
| 4965 proxy_delegate->set_trusted_spdy_proxy( |
| 4966 net::ProxyServer(net::ProxyServer::SCHEME_HTTPS, |
| 4967 HostPortPair(GURL(kDefaultURL).host(), 80))); |
| 4968 session_deps_.proxy_delegate.reset(proxy_delegate.release()); |
| 4962 | 4969 |
| 4963 CreateNetworkSession(); | 4970 CreateNetworkSession(); |
| 4964 CreateInsecureSpdySession(); | 4971 CreateInsecureSpdySession(); |
| 4965 | 4972 |
| 4966 base::WeakPtr<SpdyStream> spdy_stream = CreateStreamSynchronously( | 4973 base::WeakPtr<SpdyStream> spdy_stream = CreateStreamSynchronously( |
| 4967 SPDY_REQUEST_RESPONSE_STREAM, session_, test_url_, LOWEST, BoundNetLog()); | 4974 SPDY_REQUEST_RESPONSE_STREAM, session_, test_url_, LOWEST, BoundNetLog()); |
| 4968 ASSERT_TRUE(spdy_stream.get() != nullptr); | 4975 ASSERT_TRUE(spdy_stream.get() != nullptr); |
| 4969 EXPECT_EQ(0u, spdy_stream->stream_id()); | 4976 EXPECT_EQ(0u, spdy_stream->stream_id()); |
| 4970 test::StreamDelegateDoNothing delegate(spdy_stream); | 4977 test::StreamDelegateDoNothing delegate(spdy_stream); |
| 4971 spdy_stream->SetDelegate(&delegate); | 4978 spdy_stream->SetDelegate(&delegate); |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5440 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5447 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
| 5441 "spdy_pooling.pem"); | 5448 "spdy_pooling.pem"); |
| 5442 ssl_info.is_issued_by_known_root = true; | 5449 ssl_info.is_issued_by_known_root = true; |
| 5443 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5450 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
| 5444 | 5451 |
| 5445 EXPECT_TRUE(SpdySession::CanPool( | 5452 EXPECT_TRUE(SpdySession::CanPool( |
| 5446 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5453 &tss, ssl_info, "www.example.org", "mail.example.org")); |
| 5447 } | 5454 } |
| 5448 | 5455 |
| 5449 } // namespace net | 5456 } // namespace net |
| OLD | NEW |