| 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 <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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING); | 364 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 365 DeterministicSocketData* hanging_non_alt_svc_socket = | 365 DeterministicSocketData* hanging_non_alt_svc_socket = |
| 366 new DeterministicSocketData(NULL, 0, NULL, 0); | 366 new DeterministicSocketData(NULL, 0, NULL, 0); |
| 367 hanging_non_alt_svc_socket->set_connect_data(hanging_connect); | 367 hanging_non_alt_svc_socket->set_connect_data(hanging_connect); |
| 368 session_deps_->deterministic_socket_factory->AddSocketDataProvider( | 368 session_deps_->deterministic_socket_factory->AddSocketDataProvider( |
| 369 hanging_non_alt_svc_socket); | 369 hanging_non_alt_svc_socket); |
| 370 alternate_deterministic_vector_.push_back(hanging_non_alt_svc_socket); | 370 alternate_deterministic_vector_.push_back(hanging_non_alt_svc_socket); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 void SetSession(const scoped_refptr<HttpNetworkSession>& session) { | 374 void SetSession(scoped_ptr<HttpNetworkSession> session) { |
| 375 session_ = session; | 375 session_ = session.Pass(); |
| 376 } | 376 } |
| 377 HttpNetworkTransaction* trans() { return trans_.get(); } | 377 HttpNetworkTransaction* trans() { return trans_.get(); } |
| 378 void ResetTrans() { trans_.reset(); } | 378 void ResetTrans() { trans_.reset(); } |
| 379 TransactionHelperResult& output() { return output_; } | 379 TransactionHelperResult& output() { return output_; } |
| 380 const HttpRequestInfo& request() const { return request_; } | 380 const HttpRequestInfo& request() const { return request_; } |
| 381 const scoped_refptr<HttpNetworkSession>& session() const { | 381 HttpNetworkSession* session() const { return session_.get(); } |
| 382 return session_; | |
| 383 } | |
| 384 scoped_ptr<SpdySessionDependencies>& session_deps() { | 382 scoped_ptr<SpdySessionDependencies>& session_deps() { |
| 385 return session_deps_; | 383 return session_deps_; |
| 386 } | 384 } |
| 387 int port() const { return port_; } | 385 int port() const { return port_; } |
| 388 SpdyNetworkTransactionTestParams test_params() const { | 386 SpdyNetworkTransactionTestParams test_params() const { |
| 389 return test_params_; | 387 return test_params_; |
| 390 } | 388 } |
| 391 | 389 |
| 392 private: | 390 private: |
| 393 typedef std::vector<SocketDataProvider*> DataVector; | 391 typedef std::vector<SocketDataProvider*> DataVector; |
| 394 typedef std::vector<DeterministicSocketData*> DeterministicDataVector; | 392 typedef std::vector<DeterministicSocketData*> DeterministicDataVector; |
| 395 typedef ScopedVector<SSLSocketDataProvider> SSLVector; | 393 typedef ScopedVector<SSLSocketDataProvider> SSLVector; |
| 396 typedef ScopedVector<SocketDataProvider> AlternateVector; | 394 typedef ScopedVector<SocketDataProvider> AlternateVector; |
| 397 typedef ScopedVector<DeterministicSocketData> AlternateDeterministicVector; | 395 typedef ScopedVector<DeterministicSocketData> AlternateDeterministicVector; |
| 398 HttpRequestInfo request_; | 396 HttpRequestInfo request_; |
| 399 RequestPriority priority_; | 397 RequestPriority priority_; |
| 400 scoped_ptr<SpdySessionDependencies> session_deps_; | 398 scoped_ptr<SpdySessionDependencies> session_deps_; |
| 401 scoped_refptr<HttpNetworkSession> session_; | 399 scoped_ptr<HttpNetworkSession> session_; |
| 402 TransactionHelperResult output_; | 400 TransactionHelperResult output_; |
| 403 scoped_ptr<SocketDataProvider> first_transaction_; | 401 scoped_ptr<SocketDataProvider> first_transaction_; |
| 404 SSLVector ssl_vector_; | 402 SSLVector ssl_vector_; |
| 405 TestCompletionCallback callback_; | 403 TestCompletionCallback callback_; |
| 406 scoped_ptr<HttpNetworkTransaction> trans_; | 404 scoped_ptr<HttpNetworkTransaction> trans_; |
| 407 scoped_ptr<HttpNetworkTransaction> trans_http_; | 405 scoped_ptr<HttpNetworkTransaction> trans_http_; |
| 408 DataVector data_vector_; | 406 DataVector data_vector_; |
| 409 DeterministicDataVector deterministic_data_vector_; | 407 DeterministicDataVector deterministic_data_vector_; |
| 410 AlternateVector alternate_vector_; | 408 AlternateVector alternate_vector_; |
| 411 AlternateDeterministicVector alternate_deterministic_vector_; | 409 AlternateDeterministicVector alternate_deterministic_vector_; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 578 |
| 581 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) { | 579 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) { |
| 582 // This lengthy block is reaching into the pool to dig out the active | 580 // This lengthy block is reaching into the pool to dig out the active |
| 583 // session. Once we have the session, we verify that the streams are | 581 // session. Once we have the session, we verify that the streams are |
| 584 // all closed and not leaked at this point. | 582 // all closed and not leaked at this point. |
| 585 const GURL& url = helper.request().url; | 583 const GURL& url = helper.request().url; |
| 586 HostPortPair host_port_pair(url.host(), 443); | 584 HostPortPair host_port_pair(url.host(), 443); |
| 587 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 585 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 588 PRIVACY_MODE_DISABLED); | 586 PRIVACY_MODE_DISABLED); |
| 589 BoundNetLog log; | 587 BoundNetLog log; |
| 590 const scoped_refptr<HttpNetworkSession>& session = helper.session(); | 588 HttpNetworkSession* session = helper.session(); |
| 591 base::WeakPtr<SpdySession> spdy_session = | 589 base::WeakPtr<SpdySession> spdy_session = |
| 592 session->spdy_session_pool()->FindAvailableSession(key, log); | 590 session->spdy_session_pool()->FindAvailableSession(key, log); |
| 593 ASSERT_TRUE(spdy_session != NULL); | 591 ASSERT_TRUE(spdy_session != NULL); |
| 594 EXPECT_EQ(0u, spdy_session->num_active_streams()); | 592 EXPECT_EQ(0u, spdy_session->num_active_streams()); |
| 595 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); | 593 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); |
| 596 } | 594 } |
| 597 | 595 |
| 598 void RunServerPushTest(SequencedSocketData* data, | 596 void RunServerPushTest(SequencedSocketData* data, |
| 599 HttpResponseInfo* response, | 597 HttpResponseInfo* response, |
| 600 HttpResponseInfo* push_response, | 598 HttpResponseInfo* push_response, |
| 601 const std::string& expected) { | 599 const std::string& expected) { |
| 602 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 600 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 603 BoundNetLog(), GetParam(), NULL); | 601 BoundNetLog(), GetParam(), NULL); |
| 604 helper.RunPreTestSetup(); | 602 helper.RunPreTestSetup(); |
| 605 helper.AddData(data); | 603 helper.AddData(data); |
| 606 | 604 |
| 607 HttpNetworkTransaction* trans = helper.trans(); | 605 HttpNetworkTransaction* trans = helper.trans(); |
| 608 | 606 |
| 609 // Start the transaction with basic parameters. | 607 // Start the transaction with basic parameters. |
| 610 TestCompletionCallback callback; | 608 TestCompletionCallback callback; |
| 611 int rv = trans->Start( | 609 int rv = trans->Start( |
| 612 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 610 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 613 EXPECT_EQ(ERR_IO_PENDING, rv); | 611 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 614 rv = callback.WaitForResult(); | 612 rv = callback.WaitForResult(); |
| 615 | 613 |
| 616 // Request the pushed path. | 614 // Request the pushed path. |
| 617 scoped_ptr<HttpNetworkTransaction> trans2( | 615 scoped_ptr<HttpNetworkTransaction> trans2( |
| 618 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 616 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 619 rv = trans2->Start( | 617 rv = trans2->Start( |
| 620 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); | 618 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
| 621 EXPECT_EQ(ERR_IO_PENDING, rv); | 619 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 622 base::RunLoop().RunUntilIdle(); | 620 base::RunLoop().RunUntilIdle(); |
| 623 | 621 |
| 624 // The data for the pushed path may be coming in more than 1 frame. Compile | 622 // The data for the pushed path may be coming in more than 1 frame. Compile |
| 625 // the results into a single string. | 623 // the results into a single string. |
| 626 | 624 |
| 627 // Read the server push body. | 625 // Read the server push body. |
| 628 std::string result2; | 626 std::string result2; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 647 *push_response = *trans2->GetResponseInfo(); | 645 *push_response = *trans2->GetResponseInfo(); |
| 648 | 646 |
| 649 VerifyStreamsClosed(helper); | 647 VerifyStreamsClosed(helper); |
| 650 } | 648 } |
| 651 | 649 |
| 652 static void DeleteSessionCallback(NormalSpdyTransactionHelper* helper, | 650 static void DeleteSessionCallback(NormalSpdyTransactionHelper* helper, |
| 653 int result) { | 651 int result) { |
| 654 helper->ResetTrans(); | 652 helper->ResetTrans(); |
| 655 } | 653 } |
| 656 | 654 |
| 657 static void StartTransactionCallback( | 655 static void StartTransactionCallback(HttpNetworkSession* session, |
| 658 const scoped_refptr<HttpNetworkSession>& session, | 656 GURL url, |
| 659 GURL url, | 657 int result) { |
| 660 int result) { | |
| 661 scoped_ptr<HttpNetworkTransaction> trans( | 658 scoped_ptr<HttpNetworkTransaction> trans( |
| 662 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 659 new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
| 663 TestCompletionCallback callback; | 660 TestCompletionCallback callback; |
| 664 HttpRequestInfo request; | 661 HttpRequestInfo request; |
| 665 request.method = "GET"; | 662 request.method = "GET"; |
| 666 request.url = url; | 663 request.url = url; |
| 667 request.load_flags = 0; | 664 request.load_flags = 0; |
| 668 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 665 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 669 EXPECT_EQ(ERR_IO_PENDING, rv); | 666 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 670 callback.WaitForResult(); | 667 callback.WaitForResult(); |
| 671 } | 668 } |
| 672 | 669 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 ::testing::Values( | 714 ::testing::Values( |
| 718 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTPS_SPDY_VIA_NPN), | 715 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTPS_SPDY_VIA_NPN), |
| 719 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTP_SPDY_VIA_ALT_SVC), | 716 SpdyNetworkTransactionTestParams(kProtoSPDY31, HTTP_SPDY_VIA_ALT_SVC), |
| 720 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTPS_SPDY_VIA_NPN), | 717 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTPS_SPDY_VIA_NPN), |
| 721 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTP_SPDY_VIA_ALT_SVC))); | 718 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTP_SPDY_VIA_ALT_SVC))); |
| 722 | 719 |
| 723 // Verify HttpNetworkTransaction constructor. | 720 // Verify HttpNetworkTransaction constructor. |
| 724 TEST_P(SpdyNetworkTransactionTest, Constructor) { | 721 TEST_P(SpdyNetworkTransactionTest, Constructor) { |
| 725 scoped_ptr<SpdySessionDependencies> session_deps( | 722 scoped_ptr<SpdySessionDependencies> session_deps( |
| 726 CreateSpdySessionDependencies(GetParam())); | 723 CreateSpdySessionDependencies(GetParam())); |
| 727 scoped_refptr<HttpNetworkSession> session( | 724 scoped_ptr<HttpNetworkSession> session( |
| 728 SpdySessionDependencies::SpdyCreateSession(session_deps.get())); | 725 SpdySessionDependencies::SpdyCreateSession(session_deps.get())); |
| 729 scoped_ptr<HttpTransaction> trans( | 726 scoped_ptr<HttpTransaction> trans( |
| 730 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 727 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 731 } | 728 } |
| 732 | 729 |
| 733 TEST_P(SpdyNetworkTransactionTest, Get) { | 730 TEST_P(SpdyNetworkTransactionTest, Get) { |
| 734 // Construct the request. | 731 // Construct the request. |
| 735 scoped_ptr<SpdyFrame> req( | 732 scoped_ptr<SpdyFrame> req( |
| 736 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 733 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 737 MockWrite writes[] = {CreateMockWrite(*req, 0)}; | 734 MockWrite writes[] = {CreateMockWrite(*req, 0)}; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 882 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 886 BoundNetLog(), GetParam(), NULL); | 883 BoundNetLog(), GetParam(), NULL); |
| 887 helper.RunPreTestSetup(); | 884 helper.RunPreTestSetup(); |
| 888 helper.AddData(&data); | 885 helper.AddData(&data); |
| 889 // We require placeholder data because three get requests are sent out at | 886 // We require placeholder data because three get requests are sent out at |
| 890 // the same time which results in three sockets being connected. The first | 887 // the same time which results in three sockets being connected. The first |
| 891 // on will negotiate SPDY and will be used for all requests. | 888 // on will negotiate SPDY and will be used for all requests. |
| 892 helper.AddData(&data_placeholder); | 889 helper.AddData(&data_placeholder); |
| 893 helper.AddData(&data_placeholder); | 890 helper.AddData(&data_placeholder); |
| 894 scoped_ptr<HttpNetworkTransaction> trans1( | 891 scoped_ptr<HttpNetworkTransaction> trans1( |
| 895 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 892 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 896 scoped_ptr<HttpNetworkTransaction> trans2( | 893 scoped_ptr<HttpNetworkTransaction> trans2( |
| 897 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 894 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 898 scoped_ptr<HttpNetworkTransaction> trans3( | 895 scoped_ptr<HttpNetworkTransaction> trans3( |
| 899 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 896 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 900 | 897 |
| 901 TestCompletionCallback callback1; | 898 TestCompletionCallback callback1; |
| 902 TestCompletionCallback callback2; | 899 TestCompletionCallback callback2; |
| 903 TestCompletionCallback callback3; | 900 TestCompletionCallback callback3; |
| 904 | 901 |
| 905 HttpRequestInfo httpreq1 = CreateGetRequest(); | 902 HttpRequestInfo httpreq1 = CreateGetRequest(); |
| 906 HttpRequestInfo httpreq2 = CreateGetRequest(); | 903 HttpRequestInfo httpreq2 = CreateGetRequest(); |
| 907 HttpRequestInfo httpreq3 = CreateGetRequest(); | 904 HttpRequestInfo httpreq3 = CreateGetRequest(); |
| 908 | 905 |
| 909 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); | 906 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 TransactionHelperResult out; | 967 TransactionHelperResult out; |
| 971 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 968 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 972 BoundNetLog(), GetParam(), NULL); | 969 BoundNetLog(), GetParam(), NULL); |
| 973 helper.RunPreTestSetup(); | 970 helper.RunPreTestSetup(); |
| 974 helper.AddData(&data); | 971 helper.AddData(&data); |
| 975 // We require placeholder data because two requests are sent out at | 972 // We require placeholder data because two requests are sent out at |
| 976 // the same time which results in two sockets being connected. The first | 973 // the same time which results in two sockets being connected. The first |
| 977 // on will negotiate SPDY and will be used for all requests. | 974 // on will negotiate SPDY and will be used for all requests. |
| 978 helper.AddData(&data_placeholder); | 975 helper.AddData(&data_placeholder); |
| 979 scoped_ptr<HttpNetworkTransaction> trans1( | 976 scoped_ptr<HttpNetworkTransaction> trans1( |
| 980 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 977 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 981 scoped_ptr<HttpNetworkTransaction> trans2( | 978 scoped_ptr<HttpNetworkTransaction> trans2( |
| 982 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 979 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 983 | 980 |
| 984 TestCompletionCallback callback1; | 981 TestCompletionCallback callback1; |
| 985 TestCompletionCallback callback2; | 982 TestCompletionCallback callback2; |
| 986 | 983 |
| 987 HttpRequestInfo httpreq1 = CreateGetRequest(); | 984 HttpRequestInfo httpreq1 = CreateGetRequest(); |
| 988 HttpRequestInfo httpreq2 = CreateGetRequest(); | 985 HttpRequestInfo httpreq2 = CreateGetRequest(); |
| 989 | 986 |
| 990 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); | 987 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); |
| 991 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 988 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 992 out.rv = trans2->Start(&httpreq2, callback2.callback(), log); | 989 out.rv = trans2->Start(&httpreq2, callback2.callback(), log); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 1055 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 1059 BoundNetLog(), GetParam(), NULL); | 1056 BoundNetLog(), GetParam(), NULL); |
| 1060 helper.RunPreTestSetup(); | 1057 helper.RunPreTestSetup(); |
| 1061 helper.AddData(&preconnect_data); | 1058 helper.AddData(&preconnect_data); |
| 1062 // We require placeholder data because 3 connections are attempted (first is | 1059 // We require placeholder data because 3 connections are attempted (first is |
| 1063 // the preconnect, 2nd and 3rd are the never finished connections. | 1060 // the preconnect, 2nd and 3rd are the never finished connections. |
| 1064 helper.AddData(&data_placeholder); | 1061 helper.AddData(&data_placeholder); |
| 1065 helper.AddData(&data_placeholder); | 1062 helper.AddData(&data_placeholder); |
| 1066 | 1063 |
| 1067 scoped_ptr<HttpNetworkTransaction> trans1( | 1064 scoped_ptr<HttpNetworkTransaction> trans1( |
| 1068 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1065 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1069 scoped_ptr<HttpNetworkTransaction> trans2( | 1066 scoped_ptr<HttpNetworkTransaction> trans2( |
| 1070 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1067 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1071 | 1068 |
| 1072 TestCompletionCallback callback1; | 1069 TestCompletionCallback callback1; |
| 1073 TestCompletionCallback callback2; | 1070 TestCompletionCallback callback2; |
| 1074 | 1071 |
| 1075 HttpRequestInfo httpreq = CreateGetRequest(); | 1072 HttpRequestInfo httpreq = CreateGetRequest(); |
| 1076 | 1073 |
| 1077 // Preconnect the first. | 1074 // Preconnect the first. |
| 1078 SSLConfig preconnect_ssl_config; | 1075 SSLConfig preconnect_ssl_config; |
| 1079 helper.session()->ssl_config_service()->GetSSLConfig(&preconnect_ssl_config); | 1076 helper.session()->ssl_config_service()->GetSSLConfig(&preconnect_ssl_config); |
| 1080 HttpStreamFactory* http_stream_factory = | 1077 HttpStreamFactory* http_stream_factory = |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 1172 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 1176 | 1173 |
| 1177 BoundNetLog log; | 1174 BoundNetLog log; |
| 1178 TransactionHelperResult out; | 1175 TransactionHelperResult out; |
| 1179 { | 1176 { |
| 1180 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 1177 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 1181 BoundNetLog(), GetParam(), NULL); | 1178 BoundNetLog(), GetParam(), NULL); |
| 1182 helper.RunPreTestSetup(); | 1179 helper.RunPreTestSetup(); |
| 1183 helper.AddData(&data); | 1180 helper.AddData(&data); |
| 1184 scoped_ptr<HttpNetworkTransaction> trans1( | 1181 scoped_ptr<HttpNetworkTransaction> trans1( |
| 1185 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1182 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1186 scoped_ptr<HttpNetworkTransaction> trans2( | 1183 scoped_ptr<HttpNetworkTransaction> trans2( |
| 1187 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1184 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1188 scoped_ptr<HttpNetworkTransaction> trans3( | 1185 scoped_ptr<HttpNetworkTransaction> trans3( |
| 1189 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1186 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1190 | 1187 |
| 1191 TestCompletionCallback callback1; | 1188 TestCompletionCallback callback1; |
| 1192 TestCompletionCallback callback2; | 1189 TestCompletionCallback callback2; |
| 1193 TestCompletionCallback callback3; | 1190 TestCompletionCallback callback3; |
| 1194 | 1191 |
| 1195 HttpRequestInfo httpreq1 = CreateGetRequest(); | 1192 HttpRequestInfo httpreq1 = CreateGetRequest(); |
| 1196 HttpRequestInfo httpreq2 = CreateGetRequest(); | 1193 HttpRequestInfo httpreq2 = CreateGetRequest(); |
| 1197 HttpRequestInfo httpreq3 = CreateGetRequest(); | 1194 HttpRequestInfo httpreq3 = CreateGetRequest(); |
| 1198 | 1195 |
| 1199 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); | 1196 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 }; | 1307 }; |
| 1311 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 1308 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 1312 BoundNetLog log; | 1309 BoundNetLog log; |
| 1313 TransactionHelperResult out; | 1310 TransactionHelperResult out; |
| 1314 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 1311 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 1315 BoundNetLog(), GetParam(), NULL); | 1312 BoundNetLog(), GetParam(), NULL); |
| 1316 helper.RunPreTestSetup(); | 1313 helper.RunPreTestSetup(); |
| 1317 helper.AddData(&data); | 1314 helper.AddData(&data); |
| 1318 | 1315 |
| 1319 scoped_ptr<HttpNetworkTransaction> trans1( | 1316 scoped_ptr<HttpNetworkTransaction> trans1( |
| 1320 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1317 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1321 scoped_ptr<HttpNetworkTransaction> trans2( | 1318 scoped_ptr<HttpNetworkTransaction> trans2( |
| 1322 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1319 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1323 scoped_ptr<HttpNetworkTransaction> trans3( | 1320 scoped_ptr<HttpNetworkTransaction> trans3( |
| 1324 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1321 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1325 scoped_ptr<HttpNetworkTransaction> trans4( | 1322 scoped_ptr<HttpNetworkTransaction> trans4( |
| 1326 new HttpNetworkTransaction(HIGHEST, helper.session().get())); | 1323 new HttpNetworkTransaction(HIGHEST, helper.session())); |
| 1327 | 1324 |
| 1328 TestCompletionCallback callback1; | 1325 TestCompletionCallback callback1; |
| 1329 TestCompletionCallback callback2; | 1326 TestCompletionCallback callback2; |
| 1330 TestCompletionCallback callback3; | 1327 TestCompletionCallback callback3; |
| 1331 TestCompletionCallback callback4; | 1328 TestCompletionCallback callback4; |
| 1332 | 1329 |
| 1333 HttpRequestInfo httpreq1 = CreateGetRequest(); | 1330 HttpRequestInfo httpreq1 = CreateGetRequest(); |
| 1334 HttpRequestInfo httpreq2 = CreateGetRequest(); | 1331 HttpRequestInfo httpreq2 = CreateGetRequest(); |
| 1335 HttpRequestInfo httpreq3 = CreateGetRequest(); | 1332 HttpRequestInfo httpreq3 = CreateGetRequest(); |
| 1336 HttpRequestInfo httpreq4 = CreateGetRequest(); | 1333 HttpRequestInfo httpreq4 = CreateGetRequest(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 | 1436 |
| 1440 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 1437 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 1441 | 1438 |
| 1442 BoundNetLog log; | 1439 BoundNetLog log; |
| 1443 TransactionHelperResult out; | 1440 TransactionHelperResult out; |
| 1444 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 1441 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 1445 BoundNetLog(), GetParam(), NULL); | 1442 BoundNetLog(), GetParam(), NULL); |
| 1446 helper.RunPreTestSetup(); | 1443 helper.RunPreTestSetup(); |
| 1447 helper.AddData(&data); | 1444 helper.AddData(&data); |
| 1448 scoped_ptr<HttpNetworkTransaction> trans1( | 1445 scoped_ptr<HttpNetworkTransaction> trans1( |
| 1449 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1446 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1450 scoped_ptr<HttpNetworkTransaction> trans2( | 1447 scoped_ptr<HttpNetworkTransaction> trans2( |
| 1451 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1448 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1452 scoped_ptr<HttpNetworkTransaction> trans3( | 1449 scoped_ptr<HttpNetworkTransaction> trans3( |
| 1453 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1450 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1454 | 1451 |
| 1455 TestCompletionCallback callback1; | 1452 TestCompletionCallback callback1; |
| 1456 TestCompletionCallback callback2; | 1453 TestCompletionCallback callback2; |
| 1457 TestCompletionCallback callback3; | 1454 TestCompletionCallback callback3; |
| 1458 | 1455 |
| 1459 HttpRequestInfo httpreq1 = CreateGetRequest(); | 1456 HttpRequestInfo httpreq1 = CreateGetRequest(); |
| 1460 HttpRequestInfo httpreq2 = CreateGetRequest(); | 1457 HttpRequestInfo httpreq2 = CreateGetRequest(); |
| 1461 HttpRequestInfo httpreq3 = CreateGetRequest(); | 1458 HttpRequestInfo httpreq3 = CreateGetRequest(); |
| 1462 | 1459 |
| 1463 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); | 1460 out.rv = trans1->Start(&httpreq1, callback1.callback(), log); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 BoundNetLog log; | 1567 BoundNetLog log; |
| 1571 TransactionHelperResult out; | 1568 TransactionHelperResult out; |
| 1572 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 1569 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 1573 BoundNetLog(), GetParam(), NULL); | 1570 BoundNetLog(), GetParam(), NULL); |
| 1574 helper.RunPreTestSetup(); | 1571 helper.RunPreTestSetup(); |
| 1575 helper.AddData(&data); | 1572 helper.AddData(&data); |
| 1576 // We require placeholder data because three get requests are sent out, so | 1573 // We require placeholder data because three get requests are sent out, so |
| 1577 // there needs to be three sets of SSL connection data. | 1574 // there needs to be three sets of SSL connection data. |
| 1578 helper.AddData(&data_placeholder); | 1575 helper.AddData(&data_placeholder); |
| 1579 helper.AddData(&data_placeholder); | 1576 helper.AddData(&data_placeholder); |
| 1580 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, helper.session().get()); | 1577 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, helper.session()); |
| 1581 HttpNetworkTransaction trans2(DEFAULT_PRIORITY, helper.session().get()); | 1578 HttpNetworkTransaction trans2(DEFAULT_PRIORITY, helper.session()); |
| 1582 HttpNetworkTransaction* trans3( | 1579 HttpNetworkTransaction* trans3( |
| 1583 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 1580 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 1584 | 1581 |
| 1585 TestCompletionCallback callback1; | 1582 TestCompletionCallback callback1; |
| 1586 TestCompletionCallback callback2; | 1583 TestCompletionCallback callback2; |
| 1587 KillerCallback callback3(trans3); | 1584 KillerCallback callback3(trans3); |
| 1588 | 1585 |
| 1589 HttpRequestInfo httpreq1 = CreateGetRequest(); | 1586 HttpRequestInfo httpreq1 = CreateGetRequest(); |
| 1590 HttpRequestInfo httpreq2 = CreateGetRequest(); | 1587 HttpRequestInfo httpreq2 = CreateGetRequest(); |
| 1591 HttpRequestInfo httpreq3 = CreateGetRequest(); | 1588 HttpRequestInfo httpreq3 = CreateGetRequest(); |
| 1592 | 1589 |
| 1593 out.rv = trans1.Start(&httpreq1, callback1.callback(), log); | 1590 out.rv = trans1.Start(&httpreq1, callback1.callback(), log); |
| (...skipping 2951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4545 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data)); | 4542 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data)); |
| 4546 EXPECT_EQ("hello", response_data); | 4543 EXPECT_EQ("hello", response_data); |
| 4547 } | 4544 } |
| 4548 | 4545 |
| 4549 // Test to make sure we can correctly connect through a proxy. | 4546 // Test to make sure we can correctly connect through a proxy. |
| 4550 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) { | 4547 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) { |
| 4551 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 4548 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 4552 BoundNetLog(), GetParam(), NULL); | 4549 BoundNetLog(), GetParam(), NULL); |
| 4553 helper.session_deps() = CreateSpdySessionDependencies( | 4550 helper.session_deps() = CreateSpdySessionDependencies( |
| 4554 GetParam(), ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 4551 GetParam(), ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 4555 helper.SetSession(make_scoped_refptr( | 4552 helper.SetSession( |
| 4556 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); | 4553 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())); |
| 4557 helper.RunPreTestSetup(); | 4554 helper.RunPreTestSetup(); |
| 4558 HttpNetworkTransaction* trans = helper.trans(); | 4555 HttpNetworkTransaction* trans = helper.trans(); |
| 4559 | 4556 |
| 4560 const char kConnect443[] = { | 4557 const char kConnect443[] = { |
| 4561 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 4558 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 4562 "Host: www.example.org\r\n" | 4559 "Host: www.example.org\r\n" |
| 4563 "Proxy-Connection: keep-alive\r\n\r\n"}; | 4560 "Proxy-Connection: keep-alive\r\n\r\n"}; |
| 4564 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; | 4561 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; |
| 4565 scoped_ptr<SpdyFrame> req( | 4562 scoped_ptr<SpdyFrame> req( |
| 4566 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 4563 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4610 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 4607 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 4611 BoundNetLog(), GetParam(), NULL); | 4608 BoundNetLog(), GetParam(), NULL); |
| 4612 | 4609 |
| 4613 // Use a proxy service which returns a proxy fallback list from DIRECT to | 4610 // Use a proxy service which returns a proxy fallback list from DIRECT to |
| 4614 // myproxy:70. For this test there will be no fallback, so it is equivalent | 4611 // myproxy:70. For this test there will be no fallback, so it is equivalent |
| 4615 // to simply DIRECT. The reason for appending the second proxy is to verify | 4612 // to simply DIRECT. The reason for appending the second proxy is to verify |
| 4616 // that the session pool key used does is just "DIRECT". | 4613 // that the session pool key used does is just "DIRECT". |
| 4617 helper.session_deps() = CreateSpdySessionDependencies( | 4614 helper.session_deps() = CreateSpdySessionDependencies( |
| 4618 GetParam(), | 4615 GetParam(), |
| 4619 ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70")); | 4616 ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70")); |
| 4620 helper.SetSession(make_scoped_refptr( | 4617 helper.SetSession( |
| 4621 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); | 4618 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())); |
| 4622 | 4619 |
| 4623 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4620 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
| 4624 helper.RunPreTestSetup(); | 4621 helper.RunPreTestSetup(); |
| 4625 | 4622 |
| 4626 // Construct and send a simple GET request. | 4623 // Construct and send a simple GET request. |
| 4627 scoped_ptr<SpdyFrame> req( | 4624 scoped_ptr<SpdyFrame> req( |
| 4628 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 4625 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 4629 MockWrite writes[] = { | 4626 MockWrite writes[] = { |
| 4630 CreateMockWrite(*req, 0), | 4627 CreateMockWrite(*req, 0), |
| 4631 }; | 4628 }; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4696 reads2, arraysize(reads2), writes2, arraysize(writes2))); | 4693 reads2, arraysize(reads2), writes2, arraysize(writes2))); |
| 4697 | 4694 |
| 4698 // Create another request to www.example.org, but this time through a proxy. | 4695 // Create another request to www.example.org, but this time through a proxy. |
| 4699 HttpRequestInfo request_proxy; | 4696 HttpRequestInfo request_proxy; |
| 4700 request_proxy.method = "GET"; | 4697 request_proxy.method = "GET"; |
| 4701 request_proxy.url = GURL(GetDefaultUrlWithPath("/foo.dat")); | 4698 request_proxy.url = GURL(GetDefaultUrlWithPath("/foo.dat")); |
| 4702 request_proxy.load_flags = 0; | 4699 request_proxy.load_flags = 0; |
| 4703 scoped_ptr<SpdySessionDependencies> ssd_proxy( | 4700 scoped_ptr<SpdySessionDependencies> ssd_proxy( |
| 4704 CreateSpdySessionDependencies(GetParam())); | 4701 CreateSpdySessionDependencies(GetParam())); |
| 4705 // Ensure that this transaction uses the same SpdySessionPool. | 4702 // Ensure that this transaction uses the same SpdySessionPool. |
| 4706 scoped_refptr<HttpNetworkSession> session_proxy( | 4703 scoped_ptr<HttpNetworkSession> session_proxy( |
| 4707 SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get())); | 4704 SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get())); |
| 4708 NormalSpdyTransactionHelper helper_proxy(request_proxy, DEFAULT_PRIORITY, | 4705 NormalSpdyTransactionHelper helper_proxy(request_proxy, DEFAULT_PRIORITY, |
| 4709 BoundNetLog(), GetParam(), NULL); | 4706 BoundNetLog(), GetParam(), NULL); |
| 4710 HttpNetworkSessionPeer session_peer(session_proxy); | 4707 HttpNetworkSessionPeer session_peer(session_proxy.get()); |
| 4711 scoped_ptr<ProxyService> proxy_service( | 4708 scoped_ptr<ProxyService> proxy_service( |
| 4712 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 4709 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 4713 session_peer.SetProxyService(proxy_service.get()); | 4710 session_peer.SetProxyService(proxy_service.get()); |
| 4714 helper_proxy.session_deps().swap(ssd_proxy); | 4711 helper_proxy.session_deps().swap(ssd_proxy); |
| 4715 helper_proxy.SetSession(session_proxy); | 4712 helper_proxy.SetSession(session_proxy.Pass()); |
| 4716 helper_proxy.RunPreTestSetup(); | 4713 helper_proxy.RunPreTestSetup(); |
| 4717 helper_proxy.AddData(data_proxy.get()); | 4714 helper_proxy.AddData(data_proxy.get()); |
| 4718 | 4715 |
| 4719 HttpNetworkTransaction* trans_proxy = helper_proxy.trans(); | 4716 HttpNetworkTransaction* trans_proxy = helper_proxy.trans(); |
| 4720 TestCompletionCallback callback_proxy; | 4717 TestCompletionCallback callback_proxy; |
| 4721 int rv = trans_proxy->Start( | 4718 int rv = trans_proxy->Start( |
| 4722 &request_proxy, callback_proxy.callback(), BoundNetLog()); | 4719 &request_proxy, callback_proxy.callback(), BoundNetLog()); |
| 4723 EXPECT_EQ(ERR_IO_PENDING, rv); | 4720 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4724 rv = callback_proxy.WaitForResult(); | 4721 rv = callback_proxy.WaitForResult(); |
| 4725 EXPECT_EQ(0, rv); | 4722 EXPECT_EQ(0, rv); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4780 arraysize(writes2)); | 4777 arraysize(writes2)); |
| 4781 | 4778 |
| 4782 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 4779 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 4783 BoundNetLog(), GetParam(), NULL); | 4780 BoundNetLog(), GetParam(), NULL); |
| 4784 helper.AddData(&data1); | 4781 helper.AddData(&data1); |
| 4785 helper.AddData(&data2); | 4782 helper.AddData(&data2); |
| 4786 helper.RunPreTestSetup(); | 4783 helper.RunPreTestSetup(); |
| 4787 | 4784 |
| 4788 for (int i = 0; i < 2; ++i) { | 4785 for (int i = 0; i < 2; ++i) { |
| 4789 scoped_ptr<HttpNetworkTransaction> trans( | 4786 scoped_ptr<HttpNetworkTransaction> trans( |
| 4790 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 4787 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 4791 | 4788 |
| 4792 TestCompletionCallback callback; | 4789 TestCompletionCallback callback; |
| 4793 int rv = trans->Start( | 4790 int rv = trans->Start( |
| 4794 &helper.request(), callback.callback(), BoundNetLog()); | 4791 &helper.request(), callback.callback(), BoundNetLog()); |
| 4795 EXPECT_EQ(ERR_IO_PENDING, rv); | 4792 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4796 // On the second transaction, we trigger the RST. | 4793 // On the second transaction, we trigger the RST. |
| 4797 if (i == 1) { | 4794 if (i == 1) { |
| 4798 if (variant == VARIANT_RST_DURING_READ_COMPLETION) { | 4795 if (variant == VARIANT_RST_DURING_READ_COMPLETION) { |
| 4799 // Writes to the socket complete asynchronously on SPDY by running | 4796 // Writes to the socket complete asynchronously on SPDY by running |
| 4800 // through the message loop. Complete the write here. | 4797 // through the message loop. Complete the write here. |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5096 int rv = trans->Start( | 5093 int rv = trans->Start( |
| 5097 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 5094 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 5098 EXPECT_EQ(ERR_IO_PENDING, rv); | 5095 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5099 data.Run(); | 5096 data.Run(); |
| 5100 rv = callback.WaitForResult(); | 5097 rv = callback.WaitForResult(); |
| 5101 EXPECT_EQ(0, rv); | 5098 EXPECT_EQ(0, rv); |
| 5102 | 5099 |
| 5103 // Request the pushed path. At this point, we've received the push, but the | 5100 // Request the pushed path. At this point, we've received the push, but the |
| 5104 // headers are not yet complete. | 5101 // headers are not yet complete. |
| 5105 scoped_ptr<HttpNetworkTransaction> trans2( | 5102 scoped_ptr<HttpNetworkTransaction> trans2( |
| 5106 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 5103 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 5107 rv = trans2->Start( | 5104 rv = trans2->Start( |
| 5108 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); | 5105 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
| 5109 EXPECT_EQ(ERR_IO_PENDING, rv); | 5106 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5110 data.RunFor(3); | 5107 data.RunFor(3); |
| 5111 base::RunLoop().RunUntilIdle(); | 5108 base::RunLoop().RunUntilIdle(); |
| 5112 | 5109 |
| 5113 // Read the server push body. | 5110 // Read the server push body. |
| 5114 std::string result2; | 5111 std::string result2; |
| 5115 ReadResult(trans2.get(), &result2); | 5112 ReadResult(trans2.get(), &result2); |
| 5116 // Read the response body. | 5113 // Read the response body. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5234 int rv = trans->Start( | 5231 int rv = trans->Start( |
| 5235 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 5232 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 5236 EXPECT_EQ(ERR_IO_PENDING, rv); | 5233 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5237 data.Run(); | 5234 data.Run(); |
| 5238 rv = callback.WaitForResult(); | 5235 rv = callback.WaitForResult(); |
| 5239 EXPECT_EQ(0, rv); | 5236 EXPECT_EQ(0, rv); |
| 5240 | 5237 |
| 5241 // Request the pushed path. At this point, we've received the push, but the | 5238 // Request the pushed path. At this point, we've received the push, but the |
| 5242 // headers are not yet complete. | 5239 // headers are not yet complete. |
| 5243 scoped_ptr<HttpNetworkTransaction> trans2( | 5240 scoped_ptr<HttpNetworkTransaction> trans2( |
| 5244 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 5241 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 5245 rv = trans2->Start( | 5242 rv = trans2->Start( |
| 5246 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); | 5243 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
| 5247 EXPECT_EQ(ERR_IO_PENDING, rv); | 5244 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5248 data.RunFor(3); | 5245 data.RunFor(3); |
| 5249 base::RunLoop().RunUntilIdle(); | 5246 base::RunLoop().RunUntilIdle(); |
| 5250 | 5247 |
| 5251 // Read the server push body. | 5248 // Read the server push body. |
| 5252 std::string result2; | 5249 std::string result2; |
| 5253 ReadResult(trans2.get(), &result2); | 5250 ReadResult(trans2.get(), &result2); |
| 5254 // Read the response body. | 5251 // Read the response body. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5350 int rv = trans->Start( | 5347 int rv = trans->Start( |
| 5351 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 5348 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 5352 EXPECT_EQ(ERR_IO_PENDING, rv); | 5349 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5353 data.Run(); | 5350 data.Run(); |
| 5354 rv = callback.WaitForResult(); | 5351 rv = callback.WaitForResult(); |
| 5355 EXPECT_EQ(0, rv); | 5352 EXPECT_EQ(0, rv); |
| 5356 | 5353 |
| 5357 // Request the pushed path. At this point, we've received the push, but the | 5354 // Request the pushed path. At this point, we've received the push, but the |
| 5358 // headers are not yet complete. | 5355 // headers are not yet complete. |
| 5359 scoped_ptr<HttpNetworkTransaction> trans2( | 5356 scoped_ptr<HttpNetworkTransaction> trans2( |
| 5360 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session().get())); | 5357 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 5361 rv = trans2->Start( | 5358 rv = trans2->Start( |
| 5362 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); | 5359 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
| 5363 EXPECT_EQ(ERR_IO_PENDING, rv); | 5360 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5364 data.RunFor(2); | 5361 data.RunFor(2); |
| 5365 base::RunLoop().RunUntilIdle(); | 5362 base::RunLoop().RunUntilIdle(); |
| 5366 | 5363 |
| 5367 // Read the server push body. | 5364 // Read the server push body. |
| 5368 std::string result2; | 5365 std::string result2; |
| 5369 ReadResult(trans2.get(), &result2); | 5366 ReadResult(trans2.get(), &result2); |
| 5370 // Read the response body. | 5367 // Read the response body. |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5688 | 5685 |
| 5689 // Run the message loop, but do not allow the write to complete. | 5686 // Run the message loop, but do not allow the write to complete. |
| 5690 // This leaves the SpdySession with a write pending, which prevents | 5687 // This leaves the SpdySession with a write pending, which prevents |
| 5691 // SpdySession from attempting subsequent writes until this write completes. | 5688 // SpdySession from attempting subsequent writes until this write completes. |
| 5692 base::RunLoop().RunUntilIdle(); | 5689 base::RunLoop().RunUntilIdle(); |
| 5693 | 5690 |
| 5694 // Now, start both new transactions | 5691 // Now, start both new transactions |
| 5695 HttpRequestInfo info2 = CreateGetRequest(); | 5692 HttpRequestInfo info2 = CreateGetRequest(); |
| 5696 TestCompletionCallback callback2; | 5693 TestCompletionCallback callback2; |
| 5697 scoped_ptr<HttpNetworkTransaction> trans2( | 5694 scoped_ptr<HttpNetworkTransaction> trans2( |
| 5698 new HttpNetworkTransaction(MEDIUM, helper.session().get())); | 5695 new HttpNetworkTransaction(MEDIUM, helper.session())); |
| 5699 rv = trans2->Start(&info2, callback2.callback(), BoundNetLog()); | 5696 rv = trans2->Start(&info2, callback2.callback(), BoundNetLog()); |
| 5700 EXPECT_EQ(ERR_IO_PENDING, rv); | 5697 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5701 base::RunLoop().RunUntilIdle(); | 5698 base::RunLoop().RunUntilIdle(); |
| 5702 | 5699 |
| 5703 HttpRequestInfo info3 = CreateGetRequest(); | 5700 HttpRequestInfo info3 = CreateGetRequest(); |
| 5704 TestCompletionCallback callback3; | 5701 TestCompletionCallback callback3; |
| 5705 scoped_ptr<HttpNetworkTransaction> trans3( | 5702 scoped_ptr<HttpNetworkTransaction> trans3( |
| 5706 new HttpNetworkTransaction(HIGHEST, helper.session().get())); | 5703 new HttpNetworkTransaction(HIGHEST, helper.session())); |
| 5707 rv = trans3->Start(&info3, callback3.callback(), BoundNetLog()); | 5704 rv = trans3->Start(&info3, callback3.callback(), BoundNetLog()); |
| 5708 EXPECT_EQ(ERR_IO_PENDING, rv); | 5705 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5709 base::RunLoop().RunUntilIdle(); | 5706 base::RunLoop().RunUntilIdle(); |
| 5710 | 5707 |
| 5711 // We now have two SYN_STREAM frames queued up which will be | 5708 // We now have two SYN_STREAM frames queued up which will be |
| 5712 // dequeued only once the first write completes, which we | 5709 // dequeued only once the first write completes, which we |
| 5713 // now allow to happen. | 5710 // now allow to happen. |
| 5714 data.RunFor(2); | 5711 data.RunFor(2); |
| 5715 EXPECT_EQ(OK, callback.WaitForResult()); | 5712 EXPECT_EQ(OK, callback.WaitForResult()); |
| 5716 | 5713 |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6592 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6589 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6593 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6590 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
| 6594 new SSLSocketDataProvider(ASYNC, OK)); | 6591 new SSLSocketDataProvider(ASYNC, OK)); |
| 6595 // Set to TLS_RSA_WITH_NULL_MD5 | 6592 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6596 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6593 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6597 | 6594 |
| 6598 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6595 RunTLSUsageCheckTest(ssl_provider.Pass()); |
| 6599 } | 6596 } |
| 6600 | 6597 |
| 6601 } // namespace net | 6598 } // namespace net |
| OLD | NEW |