| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 7822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7833 bool ssl; | 7833 bool ssl; |
| 7834 }; | 7834 }; |
| 7835 | 7835 |
| 7836 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( | 7836 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
| 7837 NextProto next_proto, | 7837 NextProto next_proto, |
| 7838 SpdySessionDependencies* session_deps_) { | 7838 SpdySessionDependencies* session_deps_) { |
| 7839 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps_)); | 7839 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps_)); |
| 7840 | 7840 |
| 7841 base::WeakPtr<HttpServerProperties> http_server_properties = | 7841 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 7842 session->http_server_properties(); | 7842 session->http_server_properties(); |
| 7843 http_server_properties->SetAlternateProtocol( | 7843 AlternativeService alternative_service( |
| 7844 HostPortPair("host.with.alternate", 80), 443, | 7844 AlternateProtocolFromNextProto(next_proto), "alternative.host", 443); |
| 7845 AlternateProtocolFromNextProto(next_proto), 1.0); | 7845 http_server_properties->SetAlternativeService( |
| 7846 HostPortPair("host.with.alternate", 80), alternative_service, 1.0); |
| 7846 | 7847 |
| 7847 return session; | 7848 return session; |
| 7848 } | 7849 } |
| 7849 | 7850 |
| 7850 int GroupNameTransactionHelper( | 7851 int GroupNameTransactionHelper( |
| 7851 const std::string& url, | 7852 const std::string& url, |
| 7852 const scoped_refptr<HttpNetworkSession>& session) { | 7853 const scoped_refptr<HttpNetworkSession>& session) { |
| 7853 HttpRequestInfo request; | 7854 HttpRequestInfo request; |
| 7854 request.method = "GET"; | 7855 request.method = "GET"; |
| 7855 request.url = GURL(url); | 7856 request.url = GURL(url); |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8778 | 8779 |
| 8779 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8780 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8780 | 8781 |
| 8781 TestCompletionCallback callback; | 8782 TestCompletionCallback callback; |
| 8782 | 8783 |
| 8783 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8784 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8784 | 8785 |
| 8785 HostPortPair http_host_port_pair("www.google.com", 80); | 8786 HostPortPair http_host_port_pair("www.google.com", 80); |
| 8786 HttpServerProperties& http_server_properties = | 8787 HttpServerProperties& http_server_properties = |
| 8787 *session->http_server_properties(); | 8788 *session->http_server_properties(); |
| 8788 http_server_properties.SetAlternateProtocol(http_host_port_pair, 80, QUIC, | 8789 AlternativeService alternative_service(QUIC, "", 80); |
| 8789 1.0); | 8790 http_server_properties.SetAlternativeService(http_host_port_pair, |
| 8790 AlternativeService alternative_service = | 8791 alternative_service, 1.0); |
| 8792 |
| 8793 alternative_service = |
| 8791 http_server_properties.GetAlternativeService(http_host_port_pair); | 8794 http_server_properties.GetAlternativeService(http_host_port_pair); |
| 8792 EXPECT_EQ(alternative_service.protocol, QUIC); | 8795 EXPECT_EQ(alternative_service.protocol, QUIC); |
| 8793 | 8796 |
| 8794 scoped_ptr<HttpTransaction> trans( | 8797 scoped_ptr<HttpTransaction> trans( |
| 8795 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8798 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8796 | 8799 |
| 8797 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8800 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8798 EXPECT_EQ(ERR_IO_PENDING, rv); | 8801 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8799 | 8802 |
| 8800 EXPECT_EQ(OK, callback.WaitForResult()); | 8803 EXPECT_EQ(OK, callback.WaitForResult()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8838 data_reads, arraysize(data_reads), NULL, 0); | 8841 data_reads, arraysize(data_reads), NULL, 0); |
| 8839 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8842 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8840 | 8843 |
| 8841 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8844 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8842 | 8845 |
| 8843 base::WeakPtr<HttpServerProperties> http_server_properties = | 8846 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 8844 session->http_server_properties(); | 8847 session->http_server_properties(); |
| 8845 const HostPortPair host_port_pair = HostPortPair::FromURL(request.url); | 8848 const HostPortPair host_port_pair = HostPortPair::FromURL(request.url); |
| 8846 // Port must be < 1024, or the header will be ignored (since initial port was | 8849 // Port must be < 1024, or the header will be ignored (since initial port was |
| 8847 // port 80 (another restricted port). | 8850 // port 80 (another restricted port). |
| 8848 http_server_properties->SetAlternateProtocol( | 8851 AlternativeService alternative_service( |
| 8849 host_port_pair, 666 /* port is ignored by MockConnect anyway */, | 8852 AlternateProtocolFromNextProto(GetParam()), "www.google.com", |
| 8850 AlternateProtocolFromNextProto(GetParam()), 1.0); | 8853 666); /* port is ignored by MockConnect anyway */ |
| 8854 http_server_properties->SetAlternativeService(host_port_pair, |
| 8855 alternative_service, 1.0); |
| 8851 | 8856 |
| 8852 scoped_ptr<HttpTransaction> trans( | 8857 scoped_ptr<HttpTransaction> trans( |
| 8853 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8858 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8854 TestCompletionCallback callback; | 8859 TestCompletionCallback callback; |
| 8855 | 8860 |
| 8856 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8861 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8857 EXPECT_EQ(ERR_IO_PENDING, rv); | 8862 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8858 EXPECT_EQ(OK, callback.WaitForResult()); | 8863 EXPECT_EQ(OK, callback.WaitForResult()); |
| 8859 | 8864 |
| 8860 const HttpResponseInfo* response = trans->GetResponseInfo(); | 8865 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 8861 ASSERT_TRUE(response != NULL); | 8866 ASSERT_TRUE(response != NULL); |
| 8862 ASSERT_TRUE(response->headers.get() != NULL); | 8867 ASSERT_TRUE(response->headers.get() != NULL); |
| 8863 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 8868 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 8864 | 8869 |
| 8865 std::string response_data; | 8870 std::string response_data; |
| 8866 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 8871 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 8867 EXPECT_EQ("hello world", response_data); | 8872 EXPECT_EQ("hello world", response_data); |
| 8868 | 8873 |
| 8869 const AlternativeService alternative_service = | 8874 alternative_service = |
| 8870 http_server_properties->GetAlternativeService(host_port_pair); | 8875 http_server_properties->GetAlternativeService(host_port_pair); |
| 8871 EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternative_service.protocol); | 8876 EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternative_service.protocol); |
| 8872 EXPECT_TRUE( | 8877 EXPECT_TRUE( |
| 8873 http_server_properties->IsAlternativeServiceBroken(alternative_service)); | 8878 http_server_properties->IsAlternativeServiceBroken(alternative_service)); |
| 8874 } | 8879 } |
| 8875 | 8880 |
| 8876 TEST_P(HttpNetworkTransactionTest, | 8881 TEST_P(HttpNetworkTransactionTest, |
| 8877 AlternateProtocolPortRestrictedBlocked) { | 8882 AlternateProtocolPortRestrictedBlocked) { |
| 8878 // Ensure that we're not allowed to redirect traffic via an alternate | 8883 // Ensure that we're not allowed to redirect traffic via an alternate |
| 8879 // protocol to an unrestricted (port >= 1024) when the original traffic was | 8884 // protocol to an unrestricted (port >= 1024) when the original traffic was |
| (...skipping 18 matching lines...) Expand all Loading... |
| 8898 }; | 8903 }; |
| 8899 StaticSocketDataProvider second_data( | 8904 StaticSocketDataProvider second_data( |
| 8900 data_reads, arraysize(data_reads), NULL, 0); | 8905 data_reads, arraysize(data_reads), NULL, 0); |
| 8901 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8906 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8902 | 8907 |
| 8903 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8908 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8904 | 8909 |
| 8905 base::WeakPtr<HttpServerProperties> http_server_properties = | 8910 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 8906 session->http_server_properties(); | 8911 session->http_server_properties(); |
| 8907 const int kUnrestrictedAlternatePort = 1024; | 8912 const int kUnrestrictedAlternatePort = 1024; |
| 8908 http_server_properties->SetAlternateProtocol( | 8913 AlternativeService alternative_service( |
| 8909 HostPortPair::FromURL(restricted_port_request.url), | 8914 AlternateProtocolFromNextProto(GetParam()), "www.google.com", |
| 8910 kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), | 8915 kUnrestrictedAlternatePort); |
| 8916 http_server_properties->SetAlternativeService( |
| 8917 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| 8911 1.0); | 8918 1.0); |
| 8912 | 8919 |
| 8913 scoped_ptr<HttpTransaction> trans( | 8920 scoped_ptr<HttpTransaction> trans( |
| 8914 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8921 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8915 TestCompletionCallback callback; | 8922 TestCompletionCallback callback; |
| 8916 | 8923 |
| 8917 int rv = trans->Start( | 8924 int rv = trans->Start( |
| 8918 &restricted_port_request, | 8925 &restricted_port_request, |
| 8919 callback.callback(), BoundNetLog()); | 8926 callback.callback(), BoundNetLog()); |
| 8920 EXPECT_EQ(ERR_IO_PENDING, rv); | 8927 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 8949 }; | 8956 }; |
| 8950 StaticSocketDataProvider second_data( | 8957 StaticSocketDataProvider second_data( |
| 8951 data_reads, arraysize(data_reads), NULL, 0); | 8958 data_reads, arraysize(data_reads), NULL, 0); |
| 8952 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8959 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8953 | 8960 |
| 8954 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8961 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8955 | 8962 |
| 8956 base::WeakPtr<HttpServerProperties> http_server_properties = | 8963 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 8957 session->http_server_properties(); | 8964 session->http_server_properties(); |
| 8958 const int kUnrestrictedAlternatePort = 1024; | 8965 const int kUnrestrictedAlternatePort = 1024; |
| 8959 http_server_properties->SetAlternateProtocol( | 8966 AlternativeService alternative_service( |
| 8960 HostPortPair::FromURL(restricted_port_request.url), | 8967 AlternateProtocolFromNextProto(GetParam()), "www.google.com", |
| 8961 kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), | 8968 kUnrestrictedAlternatePort); |
| 8969 http_server_properties->SetAlternativeService( |
| 8970 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| 8962 1.0); | 8971 1.0); |
| 8963 | 8972 |
| 8964 scoped_ptr<HttpTransaction> trans( | 8973 scoped_ptr<HttpTransaction> trans( |
| 8965 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8974 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8966 TestCompletionCallback callback; | 8975 TestCompletionCallback callback; |
| 8967 | 8976 |
| 8968 EXPECT_EQ(ERR_IO_PENDING, trans->Start( | 8977 EXPECT_EQ(ERR_IO_PENDING, trans->Start( |
| 8969 &restricted_port_request, | 8978 &restricted_port_request, |
| 8970 callback.callback(), BoundNetLog())); | 8979 callback.callback(), BoundNetLog())); |
| 8971 // Change to unrestricted port should succeed. | 8980 // Change to unrestricted port should succeed. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 8997 }; | 9006 }; |
| 8998 StaticSocketDataProvider second_data( | 9007 StaticSocketDataProvider second_data( |
| 8999 data_reads, arraysize(data_reads), NULL, 0); | 9008 data_reads, arraysize(data_reads), NULL, 0); |
| 9000 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9009 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9001 | 9010 |
| 9002 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9011 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9003 | 9012 |
| 9004 base::WeakPtr<HttpServerProperties> http_server_properties = | 9013 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9005 session->http_server_properties(); | 9014 session->http_server_properties(); |
| 9006 const int kRestrictedAlternatePort = 80; | 9015 const int kRestrictedAlternatePort = 80; |
| 9007 http_server_properties->SetAlternateProtocol( | 9016 AlternativeService alternative_service( |
| 9008 HostPortPair::FromURL(restricted_port_request.url), | 9017 AlternateProtocolFromNextProto(GetParam()), "www.google.com", |
| 9009 kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), | 9018 kRestrictedAlternatePort); |
| 9019 http_server_properties->SetAlternativeService( |
| 9020 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| 9010 1.0); | 9021 1.0); |
| 9011 | 9022 |
| 9012 scoped_ptr<HttpTransaction> trans( | 9023 scoped_ptr<HttpTransaction> trans( |
| 9013 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9024 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9014 TestCompletionCallback callback; | 9025 TestCompletionCallback callback; |
| 9015 | 9026 |
| 9016 int rv = trans->Start( | 9027 int rv = trans->Start( |
| 9017 &restricted_port_request, | 9028 &restricted_port_request, |
| 9018 callback.callback(), BoundNetLog()); | 9029 callback.callback(), BoundNetLog()); |
| 9019 EXPECT_EQ(ERR_IO_PENDING, rv); | 9030 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 9046 }; | 9057 }; |
| 9047 StaticSocketDataProvider second_data( | 9058 StaticSocketDataProvider second_data( |
| 9048 data_reads, arraysize(data_reads), NULL, 0); | 9059 data_reads, arraysize(data_reads), NULL, 0); |
| 9049 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9060 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9050 | 9061 |
| 9051 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9062 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9052 | 9063 |
| 9053 base::WeakPtr<HttpServerProperties> http_server_properties = | 9064 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9054 session->http_server_properties(); | 9065 session->http_server_properties(); |
| 9055 const int kRestrictedAlternatePort = 80; | 9066 const int kRestrictedAlternatePort = 80; |
| 9056 http_server_properties->SetAlternateProtocol( | 9067 AlternativeService alternative_service( |
| 9057 HostPortPair::FromURL(unrestricted_port_request.url), | 9068 AlternateProtocolFromNextProto(GetParam()), "www.google.com", |
| 9058 kRestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), | 9069 kRestrictedAlternatePort); |
| 9070 http_server_properties->SetAlternativeService( |
| 9071 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
| 9059 1.0); | 9072 1.0); |
| 9060 | 9073 |
| 9061 scoped_ptr<HttpTransaction> trans( | 9074 scoped_ptr<HttpTransaction> trans( |
| 9062 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9075 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9063 TestCompletionCallback callback; | 9076 TestCompletionCallback callback; |
| 9064 | 9077 |
| 9065 int rv = trans->Start( | 9078 int rv = trans->Start( |
| 9066 &unrestricted_port_request, callback.callback(), BoundNetLog()); | 9079 &unrestricted_port_request, callback.callback(), BoundNetLog()); |
| 9067 EXPECT_EQ(ERR_IO_PENDING, rv); | 9080 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9068 // Valid change to restricted port should pass. | 9081 // Valid change to restricted port should pass. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 9094 }; | 9107 }; |
| 9095 StaticSocketDataProvider second_data( | 9108 StaticSocketDataProvider second_data( |
| 9096 data_reads, arraysize(data_reads), NULL, 0); | 9109 data_reads, arraysize(data_reads), NULL, 0); |
| 9097 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9110 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9098 | 9111 |
| 9099 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9112 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9100 | 9113 |
| 9101 base::WeakPtr<HttpServerProperties> http_server_properties = | 9114 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9102 session->http_server_properties(); | 9115 session->http_server_properties(); |
| 9103 const int kUnrestrictedAlternatePort = 1024; | 9116 const int kUnrestrictedAlternatePort = 1024; |
| 9104 http_server_properties->SetAlternateProtocol( | 9117 AlternativeService alternative_service( |
| 9105 HostPortPair::FromURL(unrestricted_port_request.url), | 9118 AlternateProtocolFromNextProto(GetParam()), "www.google.com", |
| 9106 kUnrestrictedAlternatePort, AlternateProtocolFromNextProto(GetParam()), | 9119 kUnrestrictedAlternatePort); |
| 9120 http_server_properties->SetAlternativeService( |
| 9121 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
| 9107 1.0); | 9122 1.0); |
| 9108 | 9123 |
| 9109 scoped_ptr<HttpTransaction> trans( | 9124 scoped_ptr<HttpTransaction> trans( |
| 9110 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9125 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9111 TestCompletionCallback callback; | 9126 TestCompletionCallback callback; |
| 9112 | 9127 |
| 9113 int rv = trans->Start( | 9128 int rv = trans->Start( |
| 9114 &unrestricted_port_request, callback.callback(), BoundNetLog()); | 9129 &unrestricted_port_request, callback.callback(), BoundNetLog()); |
| 9115 EXPECT_EQ(ERR_IO_PENDING, rv); | 9130 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9116 // Valid change to an unrestricted port should pass. | 9131 // Valid change to an unrestricted port should pass. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 9137 }; | 9152 }; |
| 9138 StaticSocketDataProvider data( | 9153 StaticSocketDataProvider data( |
| 9139 data_reads, arraysize(data_reads), NULL, 0); | 9154 data_reads, arraysize(data_reads), NULL, 0); |
| 9140 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9155 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9141 | 9156 |
| 9142 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9157 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9143 | 9158 |
| 9144 base::WeakPtr<HttpServerProperties> http_server_properties = | 9159 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9145 session->http_server_properties(); | 9160 session->http_server_properties(); |
| 9146 const int kUnsafePort = 7; | 9161 const int kUnsafePort = 7; |
| 9147 http_server_properties->SetAlternateProtocol( | 9162 AlternativeService alternative_service( |
| 9148 HostPortPair::FromURL(request.url), kUnsafePort, | 9163 AlternateProtocolFromNextProto(GetParam()), "www.google.com", |
| 9149 AlternateProtocolFromNextProto(GetParam()), 1.0); | 9164 kUnsafePort); |
| 9165 http_server_properties->SetAlternativeService( |
| 9166 HostPortPair::FromURL(request.url), alternative_service, 1.0); |
| 9150 | 9167 |
| 9151 scoped_ptr<HttpTransaction> trans( | 9168 scoped_ptr<HttpTransaction> trans( |
| 9152 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9169 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9153 TestCompletionCallback callback; | 9170 TestCompletionCallback callback; |
| 9154 | 9171 |
| 9155 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9172 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9156 EXPECT_EQ(ERR_IO_PENDING, rv); | 9173 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9157 // The HTTP request should succeed. | 9174 // The HTTP request should succeed. |
| 9158 EXPECT_EQ(OK, callback.WaitForResult()); | 9175 EXPECT_EQ(OK, callback.WaitForResult()); |
| 9159 | 9176 |
| (...skipping 4677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13837 ASSERT_TRUE(response); | 13854 ASSERT_TRUE(response); |
| 13838 ASSERT_TRUE(response->headers.get()); | 13855 ASSERT_TRUE(response->headers.get()); |
| 13839 | 13856 |
| 13840 EXPECT_EQ(101, response->headers->response_code()); | 13857 EXPECT_EQ(101, response->headers->response_code()); |
| 13841 | 13858 |
| 13842 trans.reset(); | 13859 trans.reset(); |
| 13843 session->CloseAllConnections(); | 13860 session->CloseAllConnections(); |
| 13844 } | 13861 } |
| 13845 | 13862 |
| 13846 } // namespace net | 13863 } // namespace net |
| OLD | NEW |