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