OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "net/base/address_list.h" | 8 #include "net/base/address_list.h" |
9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
10 #include "net/base/net_log_unittest.h" | 10 #include "net/base/net_log_unittest.h" |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 scoped_ptr<spdy::SpdyFrame> msg2(ConstructBodyFrame(kMsg2, kLen2)); | 832 scoped_ptr<spdy::SpdyFrame> msg2(ConstructBodyFrame(kMsg2, kLen2)); |
833 MockRead reads[] = { | 833 MockRead reads[] = { |
834 CreateMockRead(*resp, 1, true), | 834 CreateMockRead(*resp, 1, true), |
835 CreateMockRead(*msg1, 2, true), | 835 CreateMockRead(*msg1, 2, true), |
836 CreateMockRead(*msg2, 3, true), | 836 CreateMockRead(*msg2, 3, true), |
837 MockRead(true, 0, 4), // EOF | 837 MockRead(true, 0, 4), // EOF |
838 }; | 838 }; |
839 | 839 |
840 Initialize(reads, arraysize(reads), writes, arraysize(writes)); | 840 Initialize(reads, arraysize(reads), writes, arraysize(writes)); |
841 | 841 |
842 AssertConnectFails(ERR_TUNNEL_CONNECTION_FAILED); | 842 AssertConnectFails(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
843 | 843 |
844 Run(2); // SpdySession consumes the next two reads and sends then to | 844 Run(2); // SpdySession consumes the next two reads and sends then to |
845 // sock_ to be buffered. | 845 // sock_ to be buffered. |
846 AssertSyncReadEquals(kMsg1, kLen1); | 846 EXPECT_EQ(ERR_SOCKET_NOT_CONNECTED, sock_->Read(NULL, 1, NULL)); |
847 AssertSyncReadEquals(kMsg2, kLen2); | 847 scoped_refptr<IOBuffer> buf(new IOBuffer(kLen1 + kLen2)); |
| 848 scoped_ptr<HttpStream> stream(sock_->CreateConnectResponseStream()); |
| 849 stream->ReadResponseBody(buf, kLen1 + kLen2, &read_callback_); |
848 } | 850 } |
849 | 851 |
850 // ----------- Reads and Writes | 852 // ----------- Reads and Writes |
851 | 853 |
852 TEST_F(SpdyProxyClientSocketTest, AsyncReadAroundWrite) { | 854 TEST_F(SpdyProxyClientSocketTest, AsyncReadAroundWrite) { |
853 scoped_ptr<spdy::SpdyFrame> conn(ConstructConnectRequestFrame()); | 855 scoped_ptr<spdy::SpdyFrame> conn(ConstructConnectRequestFrame()); |
854 scoped_ptr<spdy::SpdyFrame> msg2(ConstructBodyFrame(kMsg2, kLen2)); | 856 scoped_ptr<spdy::SpdyFrame> msg2(ConstructBodyFrame(kMsg2, kLen2)); |
855 MockWrite writes[] = { | 857 MockWrite writes[] = { |
856 CreateMockWrite(*conn, 0, false), | 858 CreateMockWrite(*conn, 0, false), |
857 CreateMockWrite(*msg2, 3, false), | 859 CreateMockWrite(*msg2, 3, false), |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 scoped_refptr<IOBuffer> buf(new IOBuffer(kLen1)); | 1153 scoped_refptr<IOBuffer> buf(new IOBuffer(kLen1)); |
1152 ASSERT_EQ(ERR_IO_PENDING, sock_->Read(buf, kLen1, &read_callback_)); | 1154 ASSERT_EQ(ERR_IO_PENDING, sock_->Read(buf, kLen1, &read_callback_)); |
1153 | 1155 |
1154 sock_->Disconnect(); | 1156 sock_->Disconnect(); |
1155 | 1157 |
1156 EXPECT_FALSE(sock_->IsConnected()); | 1158 EXPECT_FALSE(sock_->IsConnected()); |
1157 EXPECT_FALSE(read_callback_.have_result()); | 1159 EXPECT_FALSE(read_callback_.have_result()); |
1158 } | 1160 } |
1159 | 1161 |
1160 } // namespace net | 1162 } // namespace net |
OLD | NEW |