| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "net/base/capturing_net_log.h" | 9 #include "net/base/capturing_net_log.h" |
| 10 #include "net/base/net_log_unittest.h" | 10 #include "net/base/net_log_unittest.h" |
| 11 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
| 12 #include "net/cert/mock_cert_verifier.h" | 12 #include "net/cert/mock_cert_verifier.h" |
| 13 #include "net/dns/mock_host_resolver.h" | 13 #include "net/dns/mock_host_resolver.h" |
| 14 #include "net/http/http_auth_handler_factory.h" | 14 #include "net/http/http_auth_handler_factory.h" |
| 15 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
| 16 #include "net/http/http_network_transaction.h" | 16 #include "net/http/http_network_transaction.h" |
| 17 #include "net/http/http_server_properties_impl.h" | 17 #include "net/http/http_server_properties_impl.h" |
| 18 #include "net/http/http_stream.h" | 18 #include "net/http/http_stream.h" |
| 19 #include "net/http/http_stream_factory.h" | 19 #include "net/http/http_stream_factory.h" |
| 20 #include "net/http/http_transaction_unittest.h" | 20 #include "net/http/http_transaction_unittest.h" |
| 21 #include "net/http/transport_security_state.h" | 21 #include "net/http/transport_security_state.h" |
| 22 #include "net/proxy/proxy_config_service_fixed.h" | 22 #include "net/proxy/proxy_config_service_fixed.h" |
| 23 #include "net/proxy/proxy_resolver.h" | 23 #include "net/proxy/proxy_resolver.h" |
| 24 #include "net/proxy/proxy_service.h" | 24 #include "net/proxy/proxy_service.h" |
| 25 #include "net/quic/crypto/quic_decrypter.h" | 25 #include "net/quic/crypto/quic_decrypter.h" |
| 26 #include "net/quic/crypto/quic_encrypter.h" | 26 #include "net/quic/crypto/quic_encrypter.h" |
| 27 #include "net/quic/quic_framer.h" | 27 #include "net/quic/quic_framer.h" |
| 28 #include "net/quic/quic_http_utils.h" |
| 28 #include "net/quic/test_tools/crypto_test_utils.h" | 29 #include "net/quic/test_tools/crypto_test_utils.h" |
| 29 #include "net/quic/test_tools/mock_clock.h" | 30 #include "net/quic/test_tools/mock_clock.h" |
| 30 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" | 31 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" |
| 31 #include "net/quic/test_tools/mock_random.h" | 32 #include "net/quic/test_tools/mock_random.h" |
| 32 #include "net/quic/test_tools/quic_test_utils.h" | 33 #include "net/quic/test_tools/quic_test_utils.h" |
| 33 #include "net/socket/client_socket_factory.h" | 34 #include "net/socket/client_socket_factory.h" |
| 34 #include "net/socket/mock_client_socket_pool_manager.h" | 35 #include "net/socket/mock_client_socket_pool_manager.h" |
| 35 #include "net/socket/socket_test_util.h" | 36 #include "net/socket/socket_test_util.h" |
| 36 #include "net/socket/ssl_client_socket.h" | 37 #include "net/socket/ssl_client_socket.h" |
| 37 #include "net/spdy/spdy_frame_builder.h" | 38 #include "net/spdy/spdy_frame_builder.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 SpdyHeaderBlock headers; | 172 SpdyHeaderBlock headers; |
| 172 headers[":status"] = status; | 173 headers[":status"] = status; |
| 173 headers[":version"] = "HTTP/1.1"; | 174 headers[":version"] = "HTTP/1.1"; |
| 174 headers["content-type"] = "text/plain"; | 175 headers["content-type"] = "text/plain"; |
| 175 return compressor_->CompressHeaders(headers) + body; | 176 return compressor_->CompressHeaders(headers) + body; |
| 176 } | 177 } |
| 177 | 178 |
| 178 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers) { | 179 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers) { |
| 179 QuicSpdyCompressor compressor; | 180 QuicSpdyCompressor compressor; |
| 180 if (QuicVersionMax() >= QUIC_VERSION_9) { | 181 if (QuicVersionMax() >= QUIC_VERSION_9) { |
| 181 return compressor.CompressHeadersWithPriority(0, headers); | 182 return compressor.CompressHeadersWithPriority( |
| 183 ConvertRequestPriorityToQuicPriority(DEFAULT_PRIORITY), headers); |
| 182 } | 184 } |
| 183 return compressor.CompressHeaders(headers); | 185 return compressor.CompressHeaders(headers); |
| 184 } | 186 } |
| 185 | 187 |
| 186 // Returns a newly created packet to send kData on stream 1. | 188 // Returns a newly created packet to send kData on stream 1. |
| 187 QuicEncryptedPacket* ConstructDataPacket( | 189 QuicEncryptedPacket* ConstructDataPacket( |
| 188 QuicPacketSequenceNumber sequence_number, | 190 QuicPacketSequenceNumber sequence_number, |
| 189 QuicStreamId stream_id, | 191 QuicStreamId stream_id, |
| 190 bool should_include_version, | 192 bool should_include_version, |
| 191 bool fin, | 193 bool fin, |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 TestCompletionCallback callback; | 843 TestCompletionCallback callback; |
| 842 int rv = trans->Start(&request_, callback.callback(), net_log_.bound()); | 844 int rv = trans->Start(&request_, callback.callback(), net_log_.bound()); |
| 843 EXPECT_EQ(ERR_IO_PENDING, rv); | 845 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 844 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); | 846 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); |
| 845 | 847 |
| 846 ExpectBrokenAlternateProtocolMapping(); | 848 ExpectBrokenAlternateProtocolMapping(); |
| 847 } | 849 } |
| 848 | 850 |
| 849 } // namespace test | 851 } // namespace test |
| 850 } // namespace net | 852 } // namespace net |
| OLD | NEW |