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_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 namespace net { | 61 namespace net { |
62 | 62 |
63 class SpdyProxyClientSocketSpdy2Test : public PlatformTest { | 63 class SpdyProxyClientSocketSpdy2Test : public PlatformTest { |
64 public: | 64 public: |
65 SpdyProxyClientSocketSpdy2Test(); | 65 SpdyProxyClientSocketSpdy2Test(); |
66 | 66 |
67 virtual void TearDown(); | 67 virtual void TearDown(); |
68 | 68 |
69 protected: | 69 protected: |
70 virtual void SetUp() { | |
71 SpdySession::set_default_protocol(kProtoSPDY2); | |
72 } | |
73 | |
74 void Initialize(MockRead* reads, size_t reads_count, MockWrite* writes, | 70 void Initialize(MockRead* reads, size_t reads_count, MockWrite* writes, |
75 size_t writes_count); | 71 size_t writes_count); |
76 SpdyFrame* ConstructConnectRequestFrame(); | 72 SpdyFrame* ConstructConnectRequestFrame(); |
77 SpdyFrame* ConstructConnectAuthRequestFrame(); | 73 SpdyFrame* ConstructConnectAuthRequestFrame(); |
78 SpdyFrame* ConstructConnectReplyFrame(); | 74 SpdyFrame* ConstructConnectReplyFrame(); |
79 SpdyFrame* ConstructConnectAuthReplyFrame(); | 75 SpdyFrame* ConstructConnectAuthReplyFrame(); |
80 SpdyFrame* ConstructConnectRedirectReplyFrame(); | 76 SpdyFrame* ConstructConnectRedirectReplyFrame(); |
81 SpdyFrame* ConstructConnectErrorReplyFrame(); | 77 SpdyFrame* ConstructConnectErrorReplyFrame(); |
82 SpdyFrame* ConstructBodyFrame(const char* data, int length); | 78 SpdyFrame* ConstructBodyFrame(const char* data, int length); |
83 scoped_refptr<IOBufferWithSize> CreateBuffer(const char* data, int size); | 79 scoped_refptr<IOBufferWithSize> CreateBuffer(const char* data, int size); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 scoped_refptr<SpdyStream> spdy_stream_; | 120 scoped_refptr<SpdyStream> spdy_stream_; |
125 BufferedSpdyFramer framer_; | 121 BufferedSpdyFramer framer_; |
126 | 122 |
127 std::string user_agent_; | 123 std::string user_agent_; |
128 GURL url_; | 124 GURL url_; |
129 HostPortPair proxy_host_port_; | 125 HostPortPair proxy_host_port_; |
130 HostPortPair endpoint_host_port_pair_; | 126 HostPortPair endpoint_host_port_pair_; |
131 ProxyServer proxy_; | 127 ProxyServer proxy_; |
132 HostPortProxyPair endpoint_host_port_proxy_pair_; | 128 HostPortProxyPair endpoint_host_port_proxy_pair_; |
133 scoped_refptr<TransportSocketParams> transport_params_; | 129 scoped_refptr<TransportSocketParams> transport_params_; |
134 SpdyTestStateHelper spdy_state_; | |
135 | 130 |
136 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketSpdy2Test); | 131 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketSpdy2Test); |
137 }; | 132 }; |
138 | 133 |
139 SpdyProxyClientSocketSpdy2Test::SpdyProxyClientSocketSpdy2Test() | 134 SpdyProxyClientSocketSpdy2Test::SpdyProxyClientSocketSpdy2Test() |
140 : sock_(NULL), | 135 : sock_(NULL), |
141 data_(NULL), | 136 data_(NULL), |
142 session_(NULL), | 137 session_(NULL), |
143 read_buf_(NULL), | 138 read_buf_(NULL), |
144 session_deps_(), | 139 session_deps_(), |
145 connect_data_(SYNCHRONOUS, OK), | 140 connect_data_(SYNCHRONOUS, OK), |
146 spdy_session_(NULL), | 141 spdy_session_(NULL), |
147 spdy_stream_(NULL), | 142 spdy_stream_(NULL), |
148 framer_(2), | 143 framer_(2, false), |
149 user_agent_(kUserAgent), | 144 user_agent_(kUserAgent), |
150 url_(kRequestUrl), | 145 url_(kRequestUrl), |
151 proxy_host_port_(kProxyHost, kProxyPort), | 146 proxy_host_port_(kProxyHost, kProxyPort), |
152 endpoint_host_port_pair_(kOriginHost, kOriginPort), | 147 endpoint_host_port_pair_(kOriginHost, kOriginPort), |
153 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_), | 148 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_), |
154 endpoint_host_port_proxy_pair_(endpoint_host_port_pair_, proxy_), | 149 endpoint_host_port_proxy_pair_(endpoint_host_port_pair_, proxy_), |
155 transport_params_(new TransportSocketParams(proxy_host_port_, | 150 transport_params_(new TransportSocketParams(proxy_host_port_, |
156 LOWEST, | 151 LOWEST, |
157 false, | 152 false, |
158 false, | 153 false, |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 write_callback_.callback())); | 1348 write_callback_.callback())); |
1354 | 1349 |
1355 Run(2); | 1350 Run(2); |
1356 | 1351 |
1357 EXPECT_FALSE(sock_.get()); | 1352 EXPECT_FALSE(sock_.get()); |
1358 EXPECT_TRUE(read_callback.have_result()); | 1353 EXPECT_TRUE(read_callback.have_result()); |
1359 EXPECT_FALSE(write_callback_.have_result()); | 1354 EXPECT_FALSE(write_callback_.have_result()); |
1360 } | 1355 } |
1361 | 1356 |
1362 } // namespace net | 1357 } // namespace net |
OLD | NEW |