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

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

Issue 1342613002: Revert of Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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_ptr<HttpNetworkSession> session_; 126 scoped_refptr<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),
150 read_buf_(NULL), 151 read_buf_(NULL),
151 session_deps_(GetParam()), 152 session_deps_(GetParam()),
152 connect_data_(SYNCHRONOUS, OK), 153 connect_data_(SYNCHRONOUS, OK),
153 framer_(spdy_util_.spdy_version(), false), 154 framer_(spdy_util_.spdy_version(), false),
154 user_agent_(kUserAgent), 155 user_agent_(kUserAgent),
155 url_(kRequestUrl), 156 url_(kRequestUrl),
156 proxy_host_port_(kProxyHost, kProxyPort), 157 proxy_host_port_(kProxyHost, kProxyPort),
157 endpoint_host_port_pair_(kOriginHost, kOriginPort), 158 endpoint_host_port_pair_(kOriginHost, kOriginPort),
158 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_), 159 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_),
159 endpoint_spdy_session_key_(endpoint_host_port_pair_, 160 endpoint_spdy_session_key_(endpoint_host_port_pair_,
(...skipping 21 matching lines...) Expand all
181 data_->SetStop(2); 182 data_->SetStop(2);
182 183
183 session_deps_.deterministic_socket_factory->AddSocketDataProvider( 184 session_deps_.deterministic_socket_factory->AddSocketDataProvider(
184 data_.get()); 185 data_.get());
185 session_deps_.host_resolver->set_synchronous_mode(true); 186 session_deps_.host_resolver->set_synchronous_mode(true);
186 187
187 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( 188 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic(
188 &session_deps_); 189 &session_deps_);
189 190
190 // Creates the SPDY session and stream. 191 // Creates the SPDY session and stream.
191 spdy_session_ = CreateInsecureSpdySession( 192 spdy_session_ =
192 session_.get(), endpoint_spdy_session_key_, BoundNetLog()); 193 CreateInsecureSpdySession(
194 session_, endpoint_spdy_session_key_, BoundNetLog());
193 base::WeakPtr<SpdyStream> spdy_stream( 195 base::WeakPtr<SpdyStream> spdy_stream(
194 CreateStreamSynchronously( 196 CreateStreamSynchronously(
195 SPDY_BIDIRECTIONAL_STREAM, spdy_session_, url_, LOWEST, 197 SPDY_BIDIRECTIONAL_STREAM, spdy_session_, url_, LOWEST,
196 net_log_.bound())); 198 net_log_.bound()));
197 ASSERT_TRUE(spdy_stream.get() != NULL); 199 ASSERT_TRUE(spdy_stream.get() != NULL);
198 200
199 // Create the SpdyProxyClientSocket. 201 // Create the SpdyProxyClientSocket.
200 sock_.reset(new SpdyProxyClientSocket( 202 sock_.reset(new SpdyProxyClientSocket(
201 spdy_stream, user_agent_, endpoint_host_port_pair_, proxy_host_port_, 203 spdy_stream, user_agent_, endpoint_host_port_pair_, proxy_host_port_,
202 net_log_.bound(), session_->http_auth_cache(), 204 net_log_.bound(), session_->http_auth_cache(),
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 1376
1375 EXPECT_FALSE(sock_.get()); 1377 EXPECT_FALSE(sock_.get());
1376 EXPECT_TRUE(read_callback.have_result()); 1378 EXPECT_TRUE(read_callback.have_result());
1377 EXPECT_FALSE(write_callback_.have_result()); 1379 EXPECT_FALSE(write_callback_.have_result());
1378 1380
1379 // Let the RST_STREAM write while |rst| is in-scope. 1381 // Let the RST_STREAM write while |rst| is in-scope.
1380 base::MessageLoop::current()->RunUntilIdle(); 1382 base::MessageLoop::current()->RunUntilIdle();
1381 } 1383 }
1382 1384
1383 } // namespace net 1385 } // 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