Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(875)

Side by Side Diff: net/spdy/spdy_proxy_client_socket_unittest.cc

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_session_pool_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 SpdyTestUtil spdy_util_; 118 SpdyTestUtil spdy_util_;
119 scoped_ptr<SpdyProxyClientSocket> sock_; 119 scoped_ptr<SpdyProxyClientSocket> sock_;
120 TestCompletionCallback read_callback_; 120 TestCompletionCallback read_callback_;
121 TestCompletionCallback write_callback_; 121 TestCompletionCallback write_callback_;
122 scoped_ptr<DeterministicSocketData> data_; 122 scoped_ptr<DeterministicSocketData> data_;
123 BoundTestNetLog net_log_; 123 BoundTestNetLog net_log_;
124 124
125 private: 125 private:
126 scoped_refptr<HttpNetworkSession> session_; 126 scoped_ptr<HttpNetworkSession> session_;
127 scoped_refptr<IOBuffer> read_buf_; 127 scoped_refptr<IOBuffer> read_buf_;
128 SpdySessionDependencies session_deps_; 128 SpdySessionDependencies session_deps_;
129 MockConnect connect_data_; 129 MockConnect connect_data_;
130 base::WeakPtr<SpdySession> spdy_session_; 130 base::WeakPtr<SpdySession> spdy_session_;
131 BufferedSpdyFramer framer_; 131 BufferedSpdyFramer framer_;
132 132
133 std::string user_agent_; 133 std::string user_agent_;
134 GURL url_; 134 GURL url_;
135 HostPortPair proxy_host_port_; 135 HostPortPair proxy_host_port_;
136 HostPortPair endpoint_host_port_pair_; 136 HostPortPair endpoint_host_port_pair_;
137 ProxyServer proxy_; 137 ProxyServer proxy_;
138 SpdySessionKey endpoint_spdy_session_key_; 138 SpdySessionKey endpoint_spdy_session_key_;
139 139
140 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketTest); 140 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketTest);
141 }; 141 };
142 142
143 INSTANTIATE_TEST_CASE_P(NextProto, 143 INSTANTIATE_TEST_CASE_P(NextProto,
144 SpdyProxyClientSocketTest, 144 SpdyProxyClientSocketTest,
145 testing::Values(kProtoSPDY31, 145 testing::Values(kProtoSPDY31,
146 kProtoHTTP2)); 146 kProtoHTTP2));
147 147
148 SpdyProxyClientSocketTest::SpdyProxyClientSocketTest() 148 SpdyProxyClientSocketTest::SpdyProxyClientSocketTest()
149 : spdy_util_(GetParam()), 149 : spdy_util_(GetParam()),
150 session_(NULL),
151 read_buf_(NULL), 150 read_buf_(NULL),
152 session_deps_(GetParam()), 151 session_deps_(GetParam()),
153 connect_data_(SYNCHRONOUS, OK), 152 connect_data_(SYNCHRONOUS, OK),
154 framer_(spdy_util_.spdy_version(), false), 153 framer_(spdy_util_.spdy_version(), false),
155 user_agent_(kUserAgent), 154 user_agent_(kUserAgent),
156 url_(kRequestUrl), 155 url_(kRequestUrl),
157 proxy_host_port_(kProxyHost, kProxyPort), 156 proxy_host_port_(kProxyHost, kProxyPort),
158 endpoint_host_port_pair_(kOriginHost, kOriginPort), 157 endpoint_host_port_pair_(kOriginHost, kOriginPort),
159 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_), 158 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_),
160 endpoint_spdy_session_key_(endpoint_host_port_pair_, 159 endpoint_spdy_session_key_(endpoint_host_port_pair_,
(...skipping 21 matching lines...) Expand all
182 data_->SetStop(2); 181 data_->SetStop(2);
183 182
184 session_deps_.deterministic_socket_factory->AddSocketDataProvider( 183 session_deps_.deterministic_socket_factory->AddSocketDataProvider(
185 data_.get()); 184 data_.get());
186 session_deps_.host_resolver->set_synchronous_mode(true); 185 session_deps_.host_resolver->set_synchronous_mode(true);
187 186
188 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( 187 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic(
189 &session_deps_); 188 &session_deps_);
190 189
191 // Creates the SPDY session and stream. 190 // Creates the SPDY session and stream.
192 spdy_session_ = 191 spdy_session_ = CreateInsecureSpdySession(
193 CreateInsecureSpdySession( 192 session_.get(), endpoint_spdy_session_key_, BoundNetLog());
194 session_, endpoint_spdy_session_key_, BoundNetLog());
195 base::WeakPtr<SpdyStream> spdy_stream( 193 base::WeakPtr<SpdyStream> spdy_stream(
196 CreateStreamSynchronously( 194 CreateStreamSynchronously(
197 SPDY_BIDIRECTIONAL_STREAM, spdy_session_, url_, LOWEST, 195 SPDY_BIDIRECTIONAL_STREAM, spdy_session_, url_, LOWEST,
198 net_log_.bound())); 196 net_log_.bound()));
199 ASSERT_TRUE(spdy_stream.get() != NULL); 197 ASSERT_TRUE(spdy_stream.get() != NULL);
200 198
201 // Create the SpdyProxyClientSocket. 199 // Create the SpdyProxyClientSocket.
202 sock_.reset(new SpdyProxyClientSocket( 200 sock_.reset(new SpdyProxyClientSocket(
203 spdy_stream, user_agent_, endpoint_host_port_pair_, proxy_host_port_, 201 spdy_stream, user_agent_, endpoint_host_port_pair_, proxy_host_port_,
204 net_log_.bound(), session_->http_auth_cache(), 202 net_log_.bound(), session_->http_auth_cache(),
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 1374
1377 EXPECT_FALSE(sock_.get()); 1375 EXPECT_FALSE(sock_.get());
1378 EXPECT_TRUE(read_callback.have_result()); 1376 EXPECT_TRUE(read_callback.have_result());
1379 EXPECT_FALSE(write_callback_.have_result()); 1377 EXPECT_FALSE(write_callback_.have_result());
1380 1378
1381 // Let the RST_STREAM write while |rst| is in-scope. 1379 // Let the RST_STREAM write while |rst| is in-scope.
1382 base::MessageLoop::current()->RunUntilIdle(); 1380 base::MessageLoop::current()->RunUntilIdle();
1383 } 1381 }
1384 1382
1385 } // namespace net 1383 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_session_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698