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

Side by Side Diff: net/spdy/spdy_network_transaction_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_http_stream_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket_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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING); 363 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING);
364 DeterministicSocketData* hanging_non_alt_svc_socket = 364 DeterministicSocketData* hanging_non_alt_svc_socket =
365 new DeterministicSocketData(NULL, 0, NULL, 0); 365 new DeterministicSocketData(NULL, 0, NULL, 0);
366 hanging_non_alt_svc_socket->set_connect_data(hanging_connect); 366 hanging_non_alt_svc_socket->set_connect_data(hanging_connect);
367 session_deps_->deterministic_socket_factory->AddSocketDataProvider( 367 session_deps_->deterministic_socket_factory->AddSocketDataProvider(
368 hanging_non_alt_svc_socket); 368 hanging_non_alt_svc_socket);
369 alternate_deterministic_vector_.push_back(hanging_non_alt_svc_socket); 369 alternate_deterministic_vector_.push_back(hanging_non_alt_svc_socket);
370 } 370 }
371 } 371 }
372 372
373 void SetSession(scoped_ptr<HttpNetworkSession> session) { 373 void SetSession(const scoped_refptr<HttpNetworkSession>& session) {
374 session_ = session.Pass(); 374 session_ = session;
375 } 375 }
376 HttpNetworkTransaction* trans() { return trans_.get(); } 376 HttpNetworkTransaction* trans() { return trans_.get(); }
377 void ResetTrans() { trans_.reset(); } 377 void ResetTrans() { trans_.reset(); }
378 TransactionHelperResult& output() { return output_; } 378 TransactionHelperResult& output() { return output_; }
379 const HttpRequestInfo& request() const { return request_; } 379 const HttpRequestInfo& request() const { return request_; }
380 HttpNetworkSession* session() const { return session_.get(); } 380 const scoped_refptr<HttpNetworkSession>& session() const {
381 return session_;
382 }
381 scoped_ptr<SpdySessionDependencies>& session_deps() { 383 scoped_ptr<SpdySessionDependencies>& session_deps() {
382 return session_deps_; 384 return session_deps_;
383 } 385 }
384 int port() const { return port_; } 386 int port() const { return port_; }
385 SpdyNetworkTransactionTestParams test_params() const { 387 SpdyNetworkTransactionTestParams test_params() const {
386 return test_params_; 388 return test_params_;
387 } 389 }
388 390
389 private: 391 private:
390 typedef std::vector<SocketDataProvider*> DataVector; 392 typedef std::vector<SocketDataProvider*> DataVector;
391 typedef std::vector<DeterministicSocketData*> DeterministicDataVector; 393 typedef std::vector<DeterministicSocketData*> DeterministicDataVector;
392 typedef ScopedVector<SSLSocketDataProvider> SSLVector; 394 typedef ScopedVector<SSLSocketDataProvider> SSLVector;
393 typedef ScopedVector<SocketDataProvider> AlternateVector; 395 typedef ScopedVector<SocketDataProvider> AlternateVector;
394 typedef ScopedVector<DeterministicSocketData> AlternateDeterministicVector; 396 typedef ScopedVector<DeterministicSocketData> AlternateDeterministicVector;
395 HttpRequestInfo request_; 397 HttpRequestInfo request_;
396 RequestPriority priority_; 398 RequestPriority priority_;
397 scoped_ptr<SpdySessionDependencies> session_deps_; 399 scoped_ptr<SpdySessionDependencies> session_deps_;
398 scoped_ptr<HttpNetworkSession> session_; 400 scoped_refptr<HttpNetworkSession> session_;
399 TransactionHelperResult output_; 401 TransactionHelperResult output_;
400 scoped_ptr<SocketDataProvider> first_transaction_; 402 scoped_ptr<SocketDataProvider> first_transaction_;
401 SSLVector ssl_vector_; 403 SSLVector ssl_vector_;
402 TestCompletionCallback callback_; 404 TestCompletionCallback callback_;
403 scoped_ptr<HttpNetworkTransaction> trans_; 405 scoped_ptr<HttpNetworkTransaction> trans_;
404 scoped_ptr<HttpNetworkTransaction> trans_http_; 406 scoped_ptr<HttpNetworkTransaction> trans_http_;
405 DataVector data_vector_; 407 DataVector data_vector_;
406 DeterministicDataVector deterministic_data_vector_; 408 DeterministicDataVector deterministic_data_vector_;
407 AlternateVector alternate_vector_; 409 AlternateVector alternate_vector_;
408 AlternateDeterministicVector alternate_deterministic_vector_; 410 AlternateDeterministicVector alternate_deterministic_vector_;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 579
578 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) { 580 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) {
579 // This lengthy block is reaching into the pool to dig out the active 581 // This lengthy block is reaching into the pool to dig out the active
580 // session. Once we have the session, we verify that the streams are 582 // session. Once we have the session, we verify that the streams are
581 // all closed and not leaked at this point. 583 // all closed and not leaked at this point.
582 const GURL& url = helper.request().url; 584 const GURL& url = helper.request().url;
583 HostPortPair host_port_pair(url.host(), 443); 585 HostPortPair host_port_pair(url.host(), 443);
584 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), 586 SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
585 PRIVACY_MODE_DISABLED); 587 PRIVACY_MODE_DISABLED);
586 BoundNetLog log; 588 BoundNetLog log;
587 HttpNetworkSession* session = helper.session(); 589 const scoped_refptr<HttpNetworkSession>& session = helper.session();
588 base::WeakPtr<SpdySession> spdy_session = 590 base::WeakPtr<SpdySession> spdy_session =
589 session->spdy_session_pool()->FindAvailableSession(key, log); 591 session->spdy_session_pool()->FindAvailableSession(key, log);
590 ASSERT_TRUE(spdy_session != NULL); 592 ASSERT_TRUE(spdy_session != NULL);
591 EXPECT_EQ(0u, spdy_session->num_active_streams()); 593 EXPECT_EQ(0u, spdy_session->num_active_streams());
592 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); 594 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams());
593 } 595 }
594 596
595 void RunServerPushTest(SequencedSocketData* data, 597 void RunServerPushTest(SequencedSocketData* data,
596 HttpResponseInfo* response, 598 HttpResponseInfo* response,
597 HttpResponseInfo* push_response, 599 HttpResponseInfo* push_response,
598 const std::string& expected) { 600 const std::string& expected) {
599 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 601 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
600 BoundNetLog(), GetParam(), NULL); 602 BoundNetLog(), GetParam(), NULL);
601 helper.RunPreTestSetup(); 603 helper.RunPreTestSetup();
602 helper.AddData(data); 604 helper.AddData(data);
603 605
604 HttpNetworkTransaction* trans = helper.trans(); 606 HttpNetworkTransaction* trans = helper.trans();
605 607
606 // Start the transaction with basic parameters. 608 // Start the transaction with basic parameters.
607 TestCompletionCallback callback; 609 TestCompletionCallback callback;
608 int rv = trans->Start( 610 int rv = trans->Start(
609 &CreateGetRequest(), callback.callback(), BoundNetLog()); 611 &CreateGetRequest(), callback.callback(), BoundNetLog());
610 EXPECT_EQ(ERR_IO_PENDING, rv); 612 EXPECT_EQ(ERR_IO_PENDING, rv);
611 rv = callback.WaitForResult(); 613 rv = callback.WaitForResult();
612 614
613 // Request the pushed path. 615 // Request the pushed path.
614 scoped_ptr<HttpNetworkTransaction> trans2( 616 scoped_ptr<HttpNetworkTransaction> trans2(
615 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 617 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
616 rv = trans2->Start( 618 rv = trans2->Start(
617 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); 619 &CreateGetPushRequest(), callback.callback(), BoundNetLog());
618 EXPECT_EQ(ERR_IO_PENDING, rv); 620 EXPECT_EQ(ERR_IO_PENDING, rv);
619 base::RunLoop().RunUntilIdle(); 621 base::RunLoop().RunUntilIdle();
620 622
621 // The data for the pushed path may be coming in more than 1 frame. Compile 623 // The data for the pushed path may be coming in more than 1 frame. Compile
622 // the results into a single string. 624 // the results into a single string.
623 625
624 // Read the server push body. 626 // Read the server push body.
625 std::string result2; 627 std::string result2;
(...skipping 18 matching lines...) Expand all
644 *push_response = *trans2->GetResponseInfo(); 646 *push_response = *trans2->GetResponseInfo();
645 647
646 VerifyStreamsClosed(helper); 648 VerifyStreamsClosed(helper);
647 } 649 }
648 650
649 static void DeleteSessionCallback(NormalSpdyTransactionHelper* helper, 651 static void DeleteSessionCallback(NormalSpdyTransactionHelper* helper,
650 int result) { 652 int result) {
651 helper->ResetTrans(); 653 helper->ResetTrans();
652 } 654 }
653 655
654 static void StartTransactionCallback(HttpNetworkSession* session, 656 static void StartTransactionCallback(
655 GURL url, 657 const scoped_refptr<HttpNetworkSession>& session,
656 int result) { 658 GURL url,
659 int result) {
657 scoped_ptr<HttpNetworkTransaction> trans( 660 scoped_ptr<HttpNetworkTransaction> trans(
658 new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); 661 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
659 TestCompletionCallback callback; 662 TestCompletionCallback callback;
660 HttpRequestInfo request; 663 HttpRequestInfo request;
661 request.method = "GET"; 664 request.method = "GET";
662 request.url = url; 665 request.url = url;
663 request.load_flags = 0; 666 request.load_flags = 0;
664 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); 667 int rv = trans->Start(&request, callback.callback(), BoundNetLog());
665 EXPECT_EQ(ERR_IO_PENDING, rv); 668 EXPECT_EQ(ERR_IO_PENDING, rv);
666 callback.WaitForResult(); 669 callback.WaitForResult();
667 } 670 }
668 671
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 ::testing::Values( 716 ::testing::Values(
714 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTPS_SPDY_VIA_NPN), 717 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTPS_SPDY_VIA_NPN),
715 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTP_SPDY_VIA_ALT_SVC), 718 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTP_SPDY_VIA_ALT_SVC),
716 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTPS_SPDY_VIA_NPN), 719 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTPS_SPDY_VIA_NPN),
717 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTP_SPDY_VIA_ALT_SVC))); 720 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTP_SPDY_VIA_ALT_SVC)));
718 721
719 // Verify HttpNetworkTransaction constructor. 722 // Verify HttpNetworkTransaction constructor.
720 TEST_P(SpdyNetworkTransactionTest, Constructor) { 723 TEST_P(SpdyNetworkTransactionTest, Constructor) {
721 scoped_ptr<SpdySessionDependencies> session_deps( 724 scoped_ptr<SpdySessionDependencies> session_deps(
722 CreateSpdySessionDependencies(GetParam())); 725 CreateSpdySessionDependencies(GetParam()));
723 scoped_ptr<HttpNetworkSession> session( 726 scoped_refptr<HttpNetworkSession> session(
724 SpdySessionDependencies::SpdyCreateSession(session_deps.get())); 727 SpdySessionDependencies::SpdyCreateSession(session_deps.get()));
725 scoped_ptr<HttpTransaction> trans( 728 scoped_ptr<HttpTransaction> trans(
726 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 729 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
727 } 730 }
728 731
729 TEST_P(SpdyNetworkTransactionTest, Get) { 732 TEST_P(SpdyNetworkTransactionTest, Get) {
730 // Construct the request. 733 // Construct the request.
731 scoped_ptr<SpdyFrame> req( 734 scoped_ptr<SpdyFrame> req(
732 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); 735 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true));
733 MockWrite writes[] = {CreateMockWrite(*req, 0)}; 736 MockWrite writes[] = {CreateMockWrite(*req, 0)};
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 884 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
882 BoundNetLog(), GetParam(), NULL); 885 BoundNetLog(), GetParam(), NULL);
883 helper.RunPreTestSetup(); 886 helper.RunPreTestSetup();
884 helper.AddData(&data); 887 helper.AddData(&data);
885 // We require placeholder data because three get requests are sent out at 888 // We require placeholder data because three get requests are sent out at
886 // the same time which results in three sockets being connected. The first 889 // the same time which results in three sockets being connected. The first
887 // on will negotiate SPDY and will be used for all requests. 890 // on will negotiate SPDY and will be used for all requests.
888 helper.AddData(&data_placeholder); 891 helper.AddData(&data_placeholder);
889 helper.AddData(&data_placeholder); 892 helper.AddData(&data_placeholder);
890 scoped_ptr<HttpNetworkTransaction> trans1( 893 scoped_ptr<HttpNetworkTransaction> trans1(
891 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 894 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
892 scoped_ptr<HttpNetworkTransaction> trans2( 895 scoped_ptr<HttpNetworkTransaction> trans2(
893 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 896 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
894 scoped_ptr<HttpNetworkTransaction> trans3( 897 scoped_ptr<HttpNetworkTransaction> trans3(
895 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 898 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
896 899
897 TestCompletionCallback callback1; 900 TestCompletionCallback callback1;
898 TestCompletionCallback callback2; 901 TestCompletionCallback callback2;
899 TestCompletionCallback callback3; 902 TestCompletionCallback callback3;
900 903
901 HttpRequestInfo httpreq1 = CreateGetRequest(); 904 HttpRequestInfo httpreq1 = CreateGetRequest();
902 HttpRequestInfo httpreq2 = CreateGetRequest(); 905 HttpRequestInfo httpreq2 = CreateGetRequest();
903 HttpRequestInfo httpreq3 = CreateGetRequest(); 906 HttpRequestInfo httpreq3 = CreateGetRequest();
904 907
905 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); 908 out.rv = trans1->Start(&httpreq1, callback1.callback(), log);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 TransactionHelperResult out; 969 TransactionHelperResult out;
967 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 970 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
968 BoundNetLog(), GetParam(), NULL); 971 BoundNetLog(), GetParam(), NULL);
969 helper.RunPreTestSetup(); 972 helper.RunPreTestSetup();
970 helper.AddData(&data); 973 helper.AddData(&data);
971 // We require placeholder data because two requests are sent out at 974 // We require placeholder data because two requests are sent out at
972 // the same time which results in two sockets being connected. The first 975 // the same time which results in two sockets being connected. The first
973 // on will negotiate SPDY and will be used for all requests. 976 // on will negotiate SPDY and will be used for all requests.
974 helper.AddData(&data_placeholder); 977 helper.AddData(&data_placeholder);
975 scoped_ptr<HttpNetworkTransaction> trans1( 978 scoped_ptr<HttpNetworkTransaction> trans1(
976 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 979 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
977 scoped_ptr<HttpNetworkTransaction> trans2( 980 scoped_ptr<HttpNetworkTransaction> trans2(
978 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 981 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
979 982
980 TestCompletionCallback callback1; 983 TestCompletionCallback callback1;
981 TestCompletionCallback callback2; 984 TestCompletionCallback callback2;
982 985
983 HttpRequestInfo httpreq1 = CreateGetRequest(); 986 HttpRequestInfo httpreq1 = CreateGetRequest();
984 HttpRequestInfo httpreq2 = CreateGetRequest(); 987 HttpRequestInfo httpreq2 = CreateGetRequest();
985 988
986 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); 989 out.rv = trans1->Start(&httpreq1, callback1.callback(), log);
987 ASSERT_EQ(ERR_IO_PENDING, out.rv); 990 ASSERT_EQ(ERR_IO_PENDING, out.rv);
988 out.rv = trans2->Start(&httpreq2, callback2.callback(), log); 991 out.rv = trans2->Start(&httpreq2, callback2.callback(), log);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 1057 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
1055 BoundNetLog(), GetParam(), NULL); 1058 BoundNetLog(), GetParam(), NULL);
1056 helper.RunPreTestSetup(); 1059 helper.RunPreTestSetup();
1057 helper.AddData(&preconnect_data); 1060 helper.AddData(&preconnect_data);
1058 // We require placeholder data because 3 connections are attempted (first is 1061 // We require placeholder data because 3 connections are attempted (first is
1059 // the preconnect, 2nd and 3rd are the never finished connections. 1062 // the preconnect, 2nd and 3rd are the never finished connections.
1060 helper.AddData(&data_placeholder); 1063 helper.AddData(&data_placeholder);
1061 helper.AddData(&data_placeholder); 1064 helper.AddData(&data_placeholder);
1062 1065
1063 scoped_ptr<HttpNetworkTransaction> trans1( 1066 scoped_ptr<HttpNetworkTransaction> trans1(
1064 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1067 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1065 scoped_ptr<HttpNetworkTransaction> trans2( 1068 scoped_ptr<HttpNetworkTransaction> trans2(
1066 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1069 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1067 1070
1068 TestCompletionCallback callback1; 1071 TestCompletionCallback callback1;
1069 TestCompletionCallback callback2; 1072 TestCompletionCallback callback2;
1070 1073
1071 HttpRequestInfo httpreq = CreateGetRequest(); 1074 HttpRequestInfo httpreq = CreateGetRequest();
1072 1075
1073 // Preconnect the first. 1076 // Preconnect the first.
1074 SSLConfig preconnect_ssl_config; 1077 SSLConfig preconnect_ssl_config;
1075 helper.session()->ssl_config_service()->GetSSLConfig(&preconnect_ssl_config); 1078 helper.session()->ssl_config_service()->GetSSLConfig(&preconnect_ssl_config);
1076 HttpStreamFactory* http_stream_factory = 1079 HttpStreamFactory* http_stream_factory =
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); 1174 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
1172 1175
1173 BoundNetLog log; 1176 BoundNetLog log;
1174 TransactionHelperResult out; 1177 TransactionHelperResult out;
1175 { 1178 {
1176 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 1179 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
1177 BoundNetLog(), GetParam(), NULL); 1180 BoundNetLog(), GetParam(), NULL);
1178 helper.RunPreTestSetup(); 1181 helper.RunPreTestSetup();
1179 helper.AddData(&data); 1182 helper.AddData(&data);
1180 scoped_ptr<HttpNetworkTransaction> trans1( 1183 scoped_ptr<HttpNetworkTransaction> trans1(
1181 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1184 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1182 scoped_ptr<HttpNetworkTransaction> trans2( 1185 scoped_ptr<HttpNetworkTransaction> trans2(
1183 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1186 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1184 scoped_ptr<HttpNetworkTransaction> trans3( 1187 scoped_ptr<HttpNetworkTransaction> trans3(
1185 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1188 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1186 1189
1187 TestCompletionCallback callback1; 1190 TestCompletionCallback callback1;
1188 TestCompletionCallback callback2; 1191 TestCompletionCallback callback2;
1189 TestCompletionCallback callback3; 1192 TestCompletionCallback callback3;
1190 1193
1191 HttpRequestInfo httpreq1 = CreateGetRequest(); 1194 HttpRequestInfo httpreq1 = CreateGetRequest();
1192 HttpRequestInfo httpreq2 = CreateGetRequest(); 1195 HttpRequestInfo httpreq2 = CreateGetRequest();
1193 HttpRequestInfo httpreq3 = CreateGetRequest(); 1196 HttpRequestInfo httpreq3 = CreateGetRequest();
1194 1197
1195 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); 1198 out.rv = trans1->Start(&httpreq1, callback1.callback(), log);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 }; 1309 };
1307 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); 1310 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
1308 BoundNetLog log; 1311 BoundNetLog log;
1309 TransactionHelperResult out; 1312 TransactionHelperResult out;
1310 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 1313 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
1311 BoundNetLog(), GetParam(), NULL); 1314 BoundNetLog(), GetParam(), NULL);
1312 helper.RunPreTestSetup(); 1315 helper.RunPreTestSetup();
1313 helper.AddData(&data); 1316 helper.AddData(&data);
1314 1317
1315 scoped_ptr<HttpNetworkTransaction> trans1( 1318 scoped_ptr<HttpNetworkTransaction> trans1(
1316 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1319 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1317 scoped_ptr<HttpNetworkTransaction> trans2( 1320 scoped_ptr<HttpNetworkTransaction> trans2(
1318 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1321 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1319 scoped_ptr<HttpNetworkTransaction> trans3( 1322 scoped_ptr<HttpNetworkTransaction> trans3(
1320 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1323 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1321 scoped_ptr<HttpNetworkTransaction> trans4( 1324 scoped_ptr<HttpNetworkTransaction> trans4(
1322 new HttpNetworkTransaction(HIGHEST, helper.session())); 1325 new HttpNetworkTransaction(HIGHEST, helper.session().get()));
1323 1326
1324 TestCompletionCallback callback1; 1327 TestCompletionCallback callback1;
1325 TestCompletionCallback callback2; 1328 TestCompletionCallback callback2;
1326 TestCompletionCallback callback3; 1329 TestCompletionCallback callback3;
1327 TestCompletionCallback callback4; 1330 TestCompletionCallback callback4;
1328 1331
1329 HttpRequestInfo httpreq1 = CreateGetRequest(); 1332 HttpRequestInfo httpreq1 = CreateGetRequest();
1330 HttpRequestInfo httpreq2 = CreateGetRequest(); 1333 HttpRequestInfo httpreq2 = CreateGetRequest();
1331 HttpRequestInfo httpreq3 = CreateGetRequest(); 1334 HttpRequestInfo httpreq3 = CreateGetRequest();
1332 HttpRequestInfo httpreq4 = CreateGetRequest(); 1335 HttpRequestInfo httpreq4 = CreateGetRequest();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 1438
1436 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); 1439 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
1437 1440
1438 BoundNetLog log; 1441 BoundNetLog log;
1439 TransactionHelperResult out; 1442 TransactionHelperResult out;
1440 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 1443 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
1441 BoundNetLog(), GetParam(), NULL); 1444 BoundNetLog(), GetParam(), NULL);
1442 helper.RunPreTestSetup(); 1445 helper.RunPreTestSetup();
1443 helper.AddData(&data); 1446 helper.AddData(&data);
1444 scoped_ptr<HttpNetworkTransaction> trans1( 1447 scoped_ptr<HttpNetworkTransaction> trans1(
1445 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1448 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1446 scoped_ptr<HttpNetworkTransaction> trans2( 1449 scoped_ptr<HttpNetworkTransaction> trans2(
1447 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1450 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1448 scoped_ptr<HttpNetworkTransaction> trans3( 1451 scoped_ptr<HttpNetworkTransaction> trans3(
1449 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1452 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1450 1453
1451 TestCompletionCallback callback1; 1454 TestCompletionCallback callback1;
1452 TestCompletionCallback callback2; 1455 TestCompletionCallback callback2;
1453 TestCompletionCallback callback3; 1456 TestCompletionCallback callback3;
1454 1457
1455 HttpRequestInfo httpreq1 = CreateGetRequest(); 1458 HttpRequestInfo httpreq1 = CreateGetRequest();
1456 HttpRequestInfo httpreq2 = CreateGetRequest(); 1459 HttpRequestInfo httpreq2 = CreateGetRequest();
1457 HttpRequestInfo httpreq3 = CreateGetRequest(); 1460 HttpRequestInfo httpreq3 = CreateGetRequest();
1458 1461
1459 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); 1462 out.rv = trans1->Start(&httpreq1, callback1.callback(), log);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 BoundNetLog log; 1569 BoundNetLog log;
1567 TransactionHelperResult out; 1570 TransactionHelperResult out;
1568 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 1571 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
1569 BoundNetLog(), GetParam(), NULL); 1572 BoundNetLog(), GetParam(), NULL);
1570 helper.RunPreTestSetup(); 1573 helper.RunPreTestSetup();
1571 helper.AddData(&data); 1574 helper.AddData(&data);
1572 // We require placeholder data because three get requests are sent out, so 1575 // We require placeholder data because three get requests are sent out, so
1573 // there needs to be three sets of SSL connection data. 1576 // there needs to be three sets of SSL connection data.
1574 helper.AddData(&data_placeholder); 1577 helper.AddData(&data_placeholder);
1575 helper.AddData(&data_placeholder); 1578 helper.AddData(&data_placeholder);
1576 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, helper.session()); 1579 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, helper.session().get());
1577 HttpNetworkTransaction trans2(DEFAULT_PRIORITY, helper.session()); 1580 HttpNetworkTransaction trans2(DEFAULT_PRIORITY, helper.session().get());
1578 HttpNetworkTransaction* trans3( 1581 HttpNetworkTransaction* trans3(
1579 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 1582 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
1580 1583
1581 TestCompletionCallback callback1; 1584 TestCompletionCallback callback1;
1582 TestCompletionCallback callback2; 1585 TestCompletionCallback callback2;
1583 KillerCallback callback3(trans3); 1586 KillerCallback callback3(trans3);
1584 1587
1585 HttpRequestInfo httpreq1 = CreateGetRequest(); 1588 HttpRequestInfo httpreq1 = CreateGetRequest();
1586 HttpRequestInfo httpreq2 = CreateGetRequest(); 1589 HttpRequestInfo httpreq2 = CreateGetRequest();
1587 HttpRequestInfo httpreq3 = CreateGetRequest(); 1590 HttpRequestInfo httpreq3 = CreateGetRequest();
1588 1591
1589 out.rv = trans1.Start(&httpreq1, callback1.callback(), log); 1592 out.rv = trans1.Start(&httpreq1, callback1.callback(), log);
(...skipping 2983 matching lines...) Expand 10 before | Expand all | Expand 10 after
4573 EXPECT_EQ("hello", response_data); 4576 EXPECT_EQ("hello", response_data);
4574 } 4577 }
4575 4578
4576 // Test to make sure we can correctly connect through a proxy. 4579 // Test to make sure we can correctly connect through a proxy.
4577 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) { 4580 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) {
4578 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 4581 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
4579 BoundNetLog(), GetParam(), NULL); 4582 BoundNetLog(), GetParam(), NULL);
4580 helper.session_deps().reset(CreateSpdySessionDependencies( 4583 helper.session_deps().reset(CreateSpdySessionDependencies(
4581 GetParam(), 4584 GetParam(),
4582 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"))); 4585 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")));
4583 helper.SetSession( 4586 helper.SetSession(make_scoped_refptr(
4584 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())); 4587 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())));
4585 helper.RunPreTestSetup(); 4588 helper.RunPreTestSetup();
4586 HttpNetworkTransaction* trans = helper.trans(); 4589 HttpNetworkTransaction* trans = helper.trans();
4587 4590
4588 const char kConnect443[] = { 4591 const char kConnect443[] = {
4589 "CONNECT www.example.org:443 HTTP/1.1\r\n" 4592 "CONNECT www.example.org:443 HTTP/1.1\r\n"
4590 "Host: www.example.org\r\n" 4593 "Host: www.example.org\r\n"
4591 "Proxy-Connection: keep-alive\r\n\r\n"}; 4594 "Proxy-Connection: keep-alive\r\n\r\n"};
4592 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; 4595 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"};
4593 scoped_ptr<SpdyFrame> req( 4596 scoped_ptr<SpdyFrame> req(
4594 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); 4597 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4638 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 4641 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
4639 BoundNetLog(), GetParam(), NULL); 4642 BoundNetLog(), GetParam(), NULL);
4640 4643
4641 // Use a proxy service which returns a proxy fallback list from DIRECT to 4644 // Use a proxy service which returns a proxy fallback list from DIRECT to
4642 // myproxy:70. For this test there will be no fallback, so it is equivalent 4645 // myproxy:70. For this test there will be no fallback, so it is equivalent
4643 // to simply DIRECT. The reason for appending the second proxy is to verify 4646 // to simply DIRECT. The reason for appending the second proxy is to verify
4644 // that the session pool key used does is just "DIRECT". 4647 // that the session pool key used does is just "DIRECT".
4645 helper.session_deps().reset(CreateSpdySessionDependencies( 4648 helper.session_deps().reset(CreateSpdySessionDependencies(
4646 GetParam(), 4649 GetParam(),
4647 ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70"))); 4650 ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70")));
4648 helper.SetSession( 4651 helper.SetSession(make_scoped_refptr(
4649 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())); 4652 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())));
4650 4653
4651 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); 4654 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool();
4652 helper.RunPreTestSetup(); 4655 helper.RunPreTestSetup();
4653 4656
4654 // Construct and send a simple GET request. 4657 // Construct and send a simple GET request.
4655 scoped_ptr<SpdyFrame> req( 4658 scoped_ptr<SpdyFrame> req(
4656 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); 4659 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true));
4657 MockWrite writes[] = { 4660 MockWrite writes[] = {
4658 CreateMockWrite(*req, 0), 4661 CreateMockWrite(*req, 0),
4659 }; 4662 };
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
4724 reads2, arraysize(reads2), writes2, arraysize(writes2))); 4727 reads2, arraysize(reads2), writes2, arraysize(writes2)));
4725 4728
4726 // Create another request to www.example.org, but this time through a proxy. 4729 // Create another request to www.example.org, but this time through a proxy.
4727 HttpRequestInfo request_proxy; 4730 HttpRequestInfo request_proxy;
4728 request_proxy.method = "GET"; 4731 request_proxy.method = "GET";
4729 request_proxy.url = GURL(GetDefaultUrlWithPath("/foo.dat")); 4732 request_proxy.url = GURL(GetDefaultUrlWithPath("/foo.dat"));
4730 request_proxy.load_flags = 0; 4733 request_proxy.load_flags = 0;
4731 scoped_ptr<SpdySessionDependencies> ssd_proxy( 4734 scoped_ptr<SpdySessionDependencies> ssd_proxy(
4732 CreateSpdySessionDependencies(GetParam())); 4735 CreateSpdySessionDependencies(GetParam()));
4733 // Ensure that this transaction uses the same SpdySessionPool. 4736 // Ensure that this transaction uses the same SpdySessionPool.
4734 scoped_ptr<HttpNetworkSession> session_proxy( 4737 scoped_refptr<HttpNetworkSession> session_proxy(
4735 SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get())); 4738 SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get()));
4736 NormalSpdyTransactionHelper helper_proxy(request_proxy, DEFAULT_PRIORITY, 4739 NormalSpdyTransactionHelper helper_proxy(request_proxy, DEFAULT_PRIORITY,
4737 BoundNetLog(), GetParam(), NULL); 4740 BoundNetLog(), GetParam(), NULL);
4738 HttpNetworkSessionPeer session_peer(session_proxy.get()); 4741 HttpNetworkSessionPeer session_peer(session_proxy);
4739 scoped_ptr<ProxyService> proxy_service( 4742 scoped_ptr<ProxyService> proxy_service(
4740 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); 4743 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
4741 session_peer.SetProxyService(proxy_service.get()); 4744 session_peer.SetProxyService(proxy_service.get());
4742 helper_proxy.session_deps().swap(ssd_proxy); 4745 helper_proxy.session_deps().swap(ssd_proxy);
4743 helper_proxy.SetSession(session_proxy.Pass()); 4746 helper_proxy.SetSession(session_proxy);
4744 helper_proxy.RunPreTestSetup(); 4747 helper_proxy.RunPreTestSetup();
4745 helper_proxy.AddData(data_proxy.get()); 4748 helper_proxy.AddData(data_proxy.get());
4746 4749
4747 HttpNetworkTransaction* trans_proxy = helper_proxy.trans(); 4750 HttpNetworkTransaction* trans_proxy = helper_proxy.trans();
4748 TestCompletionCallback callback_proxy; 4751 TestCompletionCallback callback_proxy;
4749 int rv = trans_proxy->Start( 4752 int rv = trans_proxy->Start(
4750 &request_proxy, callback_proxy.callback(), BoundNetLog()); 4753 &request_proxy, callback_proxy.callback(), BoundNetLog());
4751 EXPECT_EQ(ERR_IO_PENDING, rv); 4754 EXPECT_EQ(ERR_IO_PENDING, rv);
4752 rv = callback_proxy.WaitForResult(); 4755 rv = callback_proxy.WaitForResult();
4753 EXPECT_EQ(0, rv); 4756 EXPECT_EQ(0, rv);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4808 arraysize(writes2)); 4811 arraysize(writes2));
4809 4812
4810 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 4813 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
4811 BoundNetLog(), GetParam(), NULL); 4814 BoundNetLog(), GetParam(), NULL);
4812 helper.AddData(&data1); 4815 helper.AddData(&data1);
4813 helper.AddData(&data2); 4816 helper.AddData(&data2);
4814 helper.RunPreTestSetup(); 4817 helper.RunPreTestSetup();
4815 4818
4816 for (int i = 0; i < 2; ++i) { 4819 for (int i = 0; i < 2; ++i) {
4817 scoped_ptr<HttpNetworkTransaction> trans( 4820 scoped_ptr<HttpNetworkTransaction> trans(
4818 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 4821 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
4819 4822
4820 TestCompletionCallback callback; 4823 TestCompletionCallback callback;
4821 int rv = trans->Start( 4824 int rv = trans->Start(
4822 &helper.request(), callback.callback(), BoundNetLog()); 4825 &helper.request(), callback.callback(), BoundNetLog());
4823 EXPECT_EQ(ERR_IO_PENDING, rv); 4826 EXPECT_EQ(ERR_IO_PENDING, rv);
4824 // On the second transaction, we trigger the RST. 4827 // On the second transaction, we trigger the RST.
4825 if (i == 1) { 4828 if (i == 1) {
4826 if (variant == VARIANT_RST_DURING_READ_COMPLETION) { 4829 if (variant == VARIANT_RST_DURING_READ_COMPLETION) {
4827 // Writes to the socket complete asynchronously on SPDY by running 4830 // Writes to the socket complete asynchronously on SPDY by running
4828 // through the message loop. Complete the write here. 4831 // through the message loop. Complete the write here.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
5124 int rv = trans->Start( 5127 int rv = trans->Start(
5125 &CreateGetRequest(), callback.callback(), BoundNetLog()); 5128 &CreateGetRequest(), callback.callback(), BoundNetLog());
5126 EXPECT_EQ(ERR_IO_PENDING, rv); 5129 EXPECT_EQ(ERR_IO_PENDING, rv);
5127 data.Run(); 5130 data.Run();
5128 rv = callback.WaitForResult(); 5131 rv = callback.WaitForResult();
5129 EXPECT_EQ(0, rv); 5132 EXPECT_EQ(0, rv);
5130 5133
5131 // Request the pushed path. At this point, we've received the push, but the 5134 // Request the pushed path. At this point, we've received the push, but the
5132 // headers are not yet complete. 5135 // headers are not yet complete.
5133 scoped_ptr<HttpNetworkTransaction> trans2( 5136 scoped_ptr<HttpNetworkTransaction> trans2(
5134 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 5137 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
5135 rv = trans2->Start( 5138 rv = trans2->Start(
5136 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); 5139 &CreateGetPushRequest(), callback.callback(), BoundNetLog());
5137 EXPECT_EQ(ERR_IO_PENDING, rv); 5140 EXPECT_EQ(ERR_IO_PENDING, rv);
5138 data.RunFor(3); 5141 data.RunFor(3);
5139 base::RunLoop().RunUntilIdle(); 5142 base::RunLoop().RunUntilIdle();
5140 5143
5141 // Read the server push body. 5144 // Read the server push body.
5142 std::string result2; 5145 std::string result2;
5143 ReadResult(trans2.get(), &result2); 5146 ReadResult(trans2.get(), &result2);
5144 // Read the response body. 5147 // Read the response body.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
5262 int rv = trans->Start( 5265 int rv = trans->Start(
5263 &CreateGetRequest(), callback.callback(), BoundNetLog()); 5266 &CreateGetRequest(), callback.callback(), BoundNetLog());
5264 EXPECT_EQ(ERR_IO_PENDING, rv); 5267 EXPECT_EQ(ERR_IO_PENDING, rv);
5265 data.Run(); 5268 data.Run();
5266 rv = callback.WaitForResult(); 5269 rv = callback.WaitForResult();
5267 EXPECT_EQ(0, rv); 5270 EXPECT_EQ(0, rv);
5268 5271
5269 // Request the pushed path. At this point, we've received the push, but the 5272 // Request the pushed path. At this point, we've received the push, but the
5270 // headers are not yet complete. 5273 // headers are not yet complete.
5271 scoped_ptr<HttpNetworkTransaction> trans2( 5274 scoped_ptr<HttpNetworkTransaction> trans2(
5272 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 5275 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
5273 rv = trans2->Start( 5276 rv = trans2->Start(
5274 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); 5277 &CreateGetPushRequest(), callback.callback(), BoundNetLog());
5275 EXPECT_EQ(ERR_IO_PENDING, rv); 5278 EXPECT_EQ(ERR_IO_PENDING, rv);
5276 data.RunFor(3); 5279 data.RunFor(3);
5277 base::RunLoop().RunUntilIdle(); 5280 base::RunLoop().RunUntilIdle();
5278 5281
5279 // Read the server push body. 5282 // Read the server push body.
5280 std::string result2; 5283 std::string result2;
5281 ReadResult(trans2.get(), &result2); 5284 ReadResult(trans2.get(), &result2);
5282 // Read the response body. 5285 // Read the response body.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
5378 int rv = trans->Start( 5381 int rv = trans->Start(
5379 &CreateGetRequest(), callback.callback(), BoundNetLog()); 5382 &CreateGetRequest(), callback.callback(), BoundNetLog());
5380 EXPECT_EQ(ERR_IO_PENDING, rv); 5383 EXPECT_EQ(ERR_IO_PENDING, rv);
5381 data.Run(); 5384 data.Run();
5382 rv = callback.WaitForResult(); 5385 rv = callback.WaitForResult();
5383 EXPECT_EQ(0, rv); 5386 EXPECT_EQ(0, rv);
5384 5387
5385 // Request the pushed path. At this point, we've received the push, but the 5388 // Request the pushed path. At this point, we've received the push, but the
5386 // headers are not yet complete. 5389 // headers are not yet complete.
5387 scoped_ptr<HttpNetworkTransaction> trans2( 5390 scoped_ptr<HttpNetworkTransaction> trans2(
5388 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); 5391 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get()));
5389 rv = trans2->Start( 5392 rv = trans2->Start(
5390 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); 5393 &CreateGetPushRequest(), callback.callback(), BoundNetLog());
5391 EXPECT_EQ(ERR_IO_PENDING, rv); 5394 EXPECT_EQ(ERR_IO_PENDING, rv);
5392 data.RunFor(2); 5395 data.RunFor(2);
5393 base::RunLoop().RunUntilIdle(); 5396 base::RunLoop().RunUntilIdle();
5394 5397
5395 // Read the server push body. 5398 // Read the server push body.
5396 std::string result2; 5399 std::string result2;
5397 ReadResult(trans2.get(), &result2); 5400 ReadResult(trans2.get(), &result2);
5398 // Read the response body. 5401 // Read the response body.
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
5717 5720
5718 // Run the message loop, but do not allow the write to complete. 5721 // Run the message loop, but do not allow the write to complete.
5719 // This leaves the SpdySession with a write pending, which prevents 5722 // This leaves the SpdySession with a write pending, which prevents
5720 // SpdySession from attempting subsequent writes until this write completes. 5723 // SpdySession from attempting subsequent writes until this write completes.
5721 base::RunLoop().RunUntilIdle(); 5724 base::RunLoop().RunUntilIdle();
5722 5725
5723 // Now, start both new transactions 5726 // Now, start both new transactions
5724 HttpRequestInfo info2 = CreateGetRequest(); 5727 HttpRequestInfo info2 = CreateGetRequest();
5725 TestCompletionCallback callback2; 5728 TestCompletionCallback callback2;
5726 scoped_ptr<HttpNetworkTransaction> trans2( 5729 scoped_ptr<HttpNetworkTransaction> trans2(
5727 new HttpNetworkTransaction(MEDIUM, helper.session())); 5730 new HttpNetworkTransaction(MEDIUM, helper.session().get()));
5728 rv = trans2->Start(&info2, callback2.callback(), BoundNetLog()); 5731 rv = trans2->Start(&info2, callback2.callback(), BoundNetLog());
5729 EXPECT_EQ(ERR_IO_PENDING, rv); 5732 EXPECT_EQ(ERR_IO_PENDING, rv);
5730 base::RunLoop().RunUntilIdle(); 5733 base::RunLoop().RunUntilIdle();
5731 5734
5732 HttpRequestInfo info3 = CreateGetRequest(); 5735 HttpRequestInfo info3 = CreateGetRequest();
5733 TestCompletionCallback callback3; 5736 TestCompletionCallback callback3;
5734 scoped_ptr<HttpNetworkTransaction> trans3( 5737 scoped_ptr<HttpNetworkTransaction> trans3(
5735 new HttpNetworkTransaction(HIGHEST, helper.session())); 5738 new HttpNetworkTransaction(HIGHEST, helper.session().get()));
5736 rv = trans3->Start(&info3, callback3.callback(), BoundNetLog()); 5739 rv = trans3->Start(&info3, callback3.callback(), BoundNetLog());
5737 EXPECT_EQ(ERR_IO_PENDING, rv); 5740 EXPECT_EQ(ERR_IO_PENDING, rv);
5738 base::RunLoop().RunUntilIdle(); 5741 base::RunLoop().RunUntilIdle();
5739 5742
5740 // We now have two SYN_STREAM frames queued up which will be 5743 // We now have two SYN_STREAM frames queued up which will be
5741 // dequeued only once the first write completes, which we 5744 // dequeued only once the first write completes, which we
5742 // now allow to happen. 5745 // now allow to happen.
5743 data.RunFor(2); 5746 data.RunFor(2);
5744 EXPECT_EQ(OK, callback.WaitForResult()); 5747 EXPECT_EQ(OK, callback.WaitForResult());
5745 5748
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
6621 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { 6624 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) {
6622 scoped_ptr<SSLSocketDataProvider> ssl_provider( 6625 scoped_ptr<SSLSocketDataProvider> ssl_provider(
6623 new SSLSocketDataProvider(ASYNC, OK)); 6626 new SSLSocketDataProvider(ASYNC, OK));
6624 // Set to TLS_RSA_WITH_NULL_MD5 6627 // Set to TLS_RSA_WITH_NULL_MD5
6625 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); 6628 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status);
6626 6629
6627 RunTLSUsageCheckTest(ssl_provider.Pass()); 6630 RunTLSUsageCheckTest(ssl_provider.Pass());
6628 } 6631 }
6629 6632
6630 } // namespace net 6633 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_stream_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698