Index: net/spdy/spdy_network_transaction_unittest.cc |
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc |
index 5a0228d7c5802d52c91005585fea4a1f2df0a1f9..cc7ba203ed34e8c1fce73f86a21b1ce08a565e23 100644 |
--- a/net/spdy/spdy_network_transaction_unittest.cc |
+++ b/net/spdy/spdy_network_transaction_unittest.cc |
@@ -370,14 +370,16 @@ |
} |
} |
- void SetSession(scoped_ptr<HttpNetworkSession> session) { |
- session_ = session.Pass(); |
+ void SetSession(const scoped_refptr<HttpNetworkSession>& session) { |
+ session_ = session; |
} |
HttpNetworkTransaction* trans() { return trans_.get(); } |
void ResetTrans() { trans_.reset(); } |
TransactionHelperResult& output() { return output_; } |
const HttpRequestInfo& request() const { return request_; } |
- HttpNetworkSession* session() const { return session_.get(); } |
+ const scoped_refptr<HttpNetworkSession>& session() const { |
+ return session_; |
+ } |
scoped_ptr<SpdySessionDependencies>& session_deps() { |
return session_deps_; |
} |
@@ -395,7 +397,7 @@ |
HttpRequestInfo request_; |
RequestPriority priority_; |
scoped_ptr<SpdySessionDependencies> session_deps_; |
- scoped_ptr<HttpNetworkSession> session_; |
+ scoped_refptr<HttpNetworkSession> session_; |
TransactionHelperResult output_; |
scoped_ptr<SocketDataProvider> first_transaction_; |
SSLVector ssl_vector_; |
@@ -584,7 +586,7 @@ |
SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
PRIVACY_MODE_DISABLED); |
BoundNetLog log; |
- HttpNetworkSession* session = helper.session(); |
+ const scoped_refptr<HttpNetworkSession>& session = helper.session(); |
base::WeakPtr<SpdySession> spdy_session = |
session->spdy_session_pool()->FindAvailableSession(key, log); |
ASSERT_TRUE(spdy_session != NULL); |
@@ -612,7 +614,7 @@ |
// Request the pushed path. |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
rv = trans2->Start( |
&CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -651,11 +653,12 @@ |
helper->ResetTrans(); |
} |
- static void StartTransactionCallback(HttpNetworkSession* session, |
- GURL url, |
- int result) { |
+ static void StartTransactionCallback( |
+ const scoped_refptr<HttpNetworkSession>& session, |
+ GURL url, |
+ int result) { |
scoped_ptr<HttpNetworkTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
TestCompletionCallback callback; |
HttpRequestInfo request; |
request.method = "GET"; |
@@ -720,7 +723,7 @@ |
TEST_P(SpdyNetworkTransactionTest, Constructor) { |
scoped_ptr<SpdySessionDependencies> session_deps( |
CreateSpdySessionDependencies(GetParam())); |
- scoped_ptr<HttpNetworkSession> session( |
+ scoped_refptr<HttpNetworkSession> session( |
SpdySessionDependencies::SpdyCreateSession(session_deps.get())); |
scoped_ptr<HttpTransaction> trans( |
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
@@ -888,11 +891,11 @@ |
helper.AddData(&data_placeholder); |
helper.AddData(&data_placeholder); |
scoped_ptr<HttpNetworkTransaction> trans1( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans3( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
TestCompletionCallback callback1; |
TestCompletionCallback callback2; |
@@ -973,9 +976,9 @@ |
// on will negotiate SPDY and will be used for all requests. |
helper.AddData(&data_placeholder); |
scoped_ptr<HttpNetworkTransaction> trans1( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
TestCompletionCallback callback1; |
TestCompletionCallback callback2; |
@@ -1061,9 +1064,9 @@ |
helper.AddData(&data_placeholder); |
scoped_ptr<HttpNetworkTransaction> trans1( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
TestCompletionCallback callback1; |
TestCompletionCallback callback2; |
@@ -1178,11 +1181,11 @@ |
helper.RunPreTestSetup(); |
helper.AddData(&data); |
scoped_ptr<HttpNetworkTransaction> trans1( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans3( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
TestCompletionCallback callback1; |
TestCompletionCallback callback2; |
@@ -1313,13 +1316,13 @@ |
helper.AddData(&data); |
scoped_ptr<HttpNetworkTransaction> trans1( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans3( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans4( |
- new HttpNetworkTransaction(HIGHEST, helper.session())); |
+ new HttpNetworkTransaction(HIGHEST, helper.session().get())); |
TestCompletionCallback callback1; |
TestCompletionCallback callback2; |
@@ -1442,11 +1445,11 @@ |
helper.RunPreTestSetup(); |
helper.AddData(&data); |
scoped_ptr<HttpNetworkTransaction> trans1( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
scoped_ptr<HttpNetworkTransaction> trans3( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
TestCompletionCallback callback1; |
TestCompletionCallback callback2; |
@@ -1573,10 +1576,10 @@ |
// there needs to be three sets of SSL connection data. |
helper.AddData(&data_placeholder); |
helper.AddData(&data_placeholder); |
- HttpNetworkTransaction trans1(DEFAULT_PRIORITY, helper.session()); |
- HttpNetworkTransaction trans2(DEFAULT_PRIORITY, helper.session()); |
+ HttpNetworkTransaction trans1(DEFAULT_PRIORITY, helper.session().get()); |
+ HttpNetworkTransaction trans2(DEFAULT_PRIORITY, helper.session().get()); |
HttpNetworkTransaction* trans3( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
TestCompletionCallback callback1; |
TestCompletionCallback callback2; |
@@ -4580,8 +4583,8 @@ |
helper.session_deps().reset(CreateSpdySessionDependencies( |
GetParam(), |
ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"))); |
- helper.SetSession( |
- SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())); |
+ helper.SetSession(make_scoped_refptr( |
+ SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); |
helper.RunPreTestSetup(); |
HttpNetworkTransaction* trans = helper.trans(); |
@@ -4645,8 +4648,8 @@ |
helper.session_deps().reset(CreateSpdySessionDependencies( |
GetParam(), |
ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70"))); |
- helper.SetSession( |
- SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())); |
+ helper.SetSession(make_scoped_refptr( |
+ SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); |
SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
helper.RunPreTestSetup(); |
@@ -4731,16 +4734,16 @@ |
scoped_ptr<SpdySessionDependencies> ssd_proxy( |
CreateSpdySessionDependencies(GetParam())); |
// Ensure that this transaction uses the same SpdySessionPool. |
- scoped_ptr<HttpNetworkSession> session_proxy( |
+ scoped_refptr<HttpNetworkSession> session_proxy( |
SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get())); |
NormalSpdyTransactionHelper helper_proxy(request_proxy, DEFAULT_PRIORITY, |
BoundNetLog(), GetParam(), NULL); |
- HttpNetworkSessionPeer session_peer(session_proxy.get()); |
+ HttpNetworkSessionPeer session_peer(session_proxy); |
scoped_ptr<ProxyService> proxy_service( |
ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
session_peer.SetProxyService(proxy_service.get()); |
helper_proxy.session_deps().swap(ssd_proxy); |
- helper_proxy.SetSession(session_proxy.Pass()); |
+ helper_proxy.SetSession(session_proxy); |
helper_proxy.RunPreTestSetup(); |
helper_proxy.AddData(data_proxy.get()); |
@@ -4815,7 +4818,7 @@ |
for (int i = 0; i < 2; ++i) { |
scoped_ptr<HttpNetworkTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
TestCompletionCallback callback; |
int rv = trans->Start( |
@@ -5131,7 +5134,7 @@ |
// Request the pushed path. At this point, we've received the push, but the |
// headers are not yet complete. |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
rv = trans2->Start( |
&CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5269,7 +5272,7 @@ |
// Request the pushed path. At this point, we've received the push, but the |
// headers are not yet complete. |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
rv = trans2->Start( |
&CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5385,7 +5388,7 @@ |
// Request the pushed path. At this point, we've received the push, but the |
// headers are not yet complete. |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); |
rv = trans2->Start( |
&CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5724,7 +5727,7 @@ |
HttpRequestInfo info2 = CreateGetRequest(); |
TestCompletionCallback callback2; |
scoped_ptr<HttpNetworkTransaction> trans2( |
- new HttpNetworkTransaction(MEDIUM, helper.session())); |
+ new HttpNetworkTransaction(MEDIUM, helper.session().get())); |
rv = trans2->Start(&info2, callback2.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
base::RunLoop().RunUntilIdle(); |
@@ -5732,7 +5735,7 @@ |
HttpRequestInfo info3 = CreateGetRequest(); |
TestCompletionCallback callback3; |
scoped_ptr<HttpNetworkTransaction> trans3( |
- new HttpNetworkTransaction(HIGHEST, helper.session())); |
+ new HttpNetworkTransaction(HIGHEST, helper.session().get())); |
rv = trans3->Start(&info3, callback3.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
base::RunLoop().RunUntilIdle(); |