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 <cmath> | 5 #include <cmath> |
6 #include <memory> | 6 #include <memory> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 | 54 |
55 namespace net { | 55 namespace net { |
56 | 56 |
57 namespace { | 57 namespace { |
58 | 58 |
59 using testing::Each; | 59 using testing::Each; |
60 using testing::Eq; | 60 using testing::Eq; |
61 | 61 |
62 const int32_t kBufferSize = SpdyHttpStream::kRequestBodyBufferSize; | 62 const int32_t kBufferSize = SpdyHttpStream::kRequestBodyBufferSize; |
63 | 63 |
64 enum SpdyNetworkTransactionTestSSLType { | 64 enum SpdyNetworkTransactionTestSSLType { |
Ryan Hamilton
2016/06/28 22:57:35
Is this really "SSL type" any more? Fix in a follo
Bence
2016/06/30 18:19:53
Aaaand https://crrev.com/2109593007 fixes it for g
| |
65 // Request an https:// URL and use NPN (or ALPN) to negotiate SPDY during | 65 // Request an https:// URL and use NPN (or ALPN) to negotiate SPDY during |
66 // the TLS handshake. | 66 // the TLS handshake. |
67 HTTPS_SPDY_VIA_NPN, | 67 HTTPS_SPDY_VIA_NPN, |
68 // Request and http:// URL to a server that supports SPDY via Alternative | 68 // Request an https:// URL to a server that supports SPDY via Alternative |
69 // Service on port 443. | 69 // Service. |
70 // See: https//tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html | 70 // See: http://httpwg.org/http-extensions/alt-svc.html. |
71 HTTP_SPDY_VIA_ALT_SVC, | 71 HTTPS_SPDY_VIA_ALT_SVC, |
72 }; | 72 }; |
73 | 73 |
74 struct SpdyNetworkTransactionTestParams { | 74 struct SpdyNetworkTransactionTestParams { |
75 SpdyNetworkTransactionTestParams() | 75 SpdyNetworkTransactionTestParams() |
76 : protocol(kProtoSPDY31), | 76 : protocol(kProtoSPDY31), |
77 ssl_type(HTTPS_SPDY_VIA_NPN), | 77 ssl_type(HTTPS_SPDY_VIA_NPN), |
78 priority_to_dependency(false) {} | 78 priority_to_dependency(false) {} |
79 | 79 |
80 SpdyNetworkTransactionTestParams(NextProto protocol, | 80 SpdyNetworkTransactionTestParams(NextProto protocol, |
81 SpdyNetworkTransactionTestSSLType ssl_type, | 81 SpdyNetworkTransactionTestSSLType ssl_type, |
82 bool priority_to_dependency) | 82 bool priority_to_dependency) |
83 : protocol(protocol), | 83 : protocol(protocol), |
84 ssl_type(ssl_type), | 84 ssl_type(ssl_type), |
85 priority_to_dependency(priority_to_dependency) {} | 85 priority_to_dependency(priority_to_dependency) {} |
86 | 86 |
87 friend std::ostream& operator<<(std::ostream& os, | 87 friend std::ostream& operator<<(std::ostream& os, |
88 const SpdyNetworkTransactionTestParams& p) { | 88 const SpdyNetworkTransactionTestParams& p) { |
89 std::string type_str; | 89 std::string type_str; |
90 switch (p.ssl_type) { | 90 switch (p.ssl_type) { |
91 case HTTP_SPDY_VIA_ALT_SVC: | 91 case HTTPS_SPDY_VIA_ALT_SVC: |
92 type_str = "HTTP_SPDY_VIA_ALT_SVC"; | 92 type_str = "HTTPS_SPDY_VIA_ALT_SVC"; |
93 break; | 93 break; |
94 case HTTPS_SPDY_VIA_NPN: | 94 case HTTPS_SPDY_VIA_NPN: |
95 type_str = "HTTPS_SPDY_VIA_NPN"; | 95 type_str = "HTTPS_SPDY_VIA_NPN"; |
96 break; | 96 break; |
97 } | 97 } |
98 os << "{ protocol: " << SSLClientSocket::NextProtoToString(p.protocol) | 98 os << "{ protocol: " << SSLClientSocket::NextProtoToString(p.protocol) |
99 << ", ssl_type: " << type_str | 99 << ", ssl_type: " << type_str |
100 << ", priority_to_dependency: " << p.priority_to_dependency << " }"; | 100 << ", priority_to_dependency: " << p.priority_to_dependency << " }"; |
101 return os; | 101 return os; |
102 } | 102 } |
103 | 103 |
104 NextProto protocol; | 104 NextProto protocol; |
105 SpdyNetworkTransactionTestSSLType ssl_type; | 105 SpdyNetworkTransactionTestSSLType ssl_type; |
106 bool priority_to_dependency; | 106 bool priority_to_dependency; |
107 }; | 107 }; |
108 | 108 |
109 void UpdateSpdySessionDependencies(SpdyNetworkTransactionTestParams test_params, | 109 void UpdateSpdySessionDependencies(SpdyNetworkTransactionTestParams test_params, |
110 SpdySessionDependencies* session_deps) { | 110 SpdySessionDependencies* session_deps) { |
111 if (test_params.ssl_type == HTTP_SPDY_VIA_ALT_SVC) { | 111 if (test_params.ssl_type == HTTPS_SPDY_VIA_ALT_SVC) { |
112 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 112 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
113 session_deps->http_server_properties->SetAlternativeService( | 113 session_deps->http_server_properties->SetAlternativeService( |
114 url::SchemeHostPort("http", "www.example.org", 80), | 114 url::SchemeHostPort(GURL(kDefaultUrl)), |
115 AlternativeService(AlternateProtocolFromNextProto(test_params.protocol), | 115 AlternativeService(AlternateProtocolFromNextProto(test_params.protocol), |
116 "www.example.org", 443), | 116 "mail.example.org", 443), |
117 expiration); | 117 expiration); |
118 } | 118 } |
119 session_deps->enable_priority_dependencies = | 119 session_deps->enable_priority_dependencies = |
120 test_params.priority_to_dependency; | 120 test_params.priority_to_dependency; |
121 } | 121 } |
122 | 122 |
123 std::unique_ptr<SpdySessionDependencies> CreateSpdySessionDependencies( | 123 std::unique_ptr<SpdySessionDependencies> CreateSpdySessionDependencies( |
124 SpdyNetworkTransactionTestParams test_params) { | 124 SpdyNetworkTransactionTestParams test_params) { |
125 std::unique_ptr<SpdySessionDependencies> session_deps( | 125 std::unique_ptr<SpdySessionDependencies> session_deps( |
126 new SpdySessionDependencies(test_params.protocol)); | 126 new SpdySessionDependencies(test_params.protocol)); |
(...skipping 10 matching lines...) Expand all Loading... | |
137 UpdateSpdySessionDependencies(test_params, session_deps.get()); | 137 UpdateSpdySessionDependencies(test_params, session_deps.get()); |
138 return session_deps; | 138 return session_deps; |
139 } | 139 } |
140 | 140 |
141 } // namespace | 141 } // namespace |
142 | 142 |
143 class SpdyNetworkTransactionTest | 143 class SpdyNetworkTransactionTest |
144 : public ::testing::TestWithParam<SpdyNetworkTransactionTestParams> { | 144 : public ::testing::TestWithParam<SpdyNetworkTransactionTestParams> { |
145 protected: | 145 protected: |
146 SpdyNetworkTransactionTest() | 146 SpdyNetworkTransactionTest() |
147 : spdy_util_(GetParam().protocol, GetParam().priority_to_dependency) { | 147 : default_url_(kDefaultUrl), |
148 spdy_util_.set_default_url(GURL(GetDefaultUrl())); | 148 host_port_pair_(HostPortPair::FromURL(default_url_)), |
149 } | 149 spdy_util_(GetParam().protocol, GetParam().priority_to_dependency) {} |
150 | 150 |
151 virtual ~SpdyNetworkTransactionTest() { | 151 virtual ~SpdyNetworkTransactionTest() { |
152 // UploadDataStream may post a deletion tasks back to the message loop on | 152 // UploadDataStream may post a deletion tasks back to the message loop on |
153 // destruction. | 153 // destruction. |
154 upload_data_stream_.reset(); | 154 upload_data_stream_.reset(); |
155 base::RunLoop().RunUntilIdle(); | 155 base::RunLoop().RunUntilIdle(); |
156 } | 156 } |
157 | 157 |
158 void SetUp() override { | 158 void SetUp() override { |
159 get_request_initialized_ = false; | 159 get_request_initialized_ = false; |
(...skipping 20 matching lines...) Expand all Loading... | |
180 std::unique_ptr<SpdySessionDependencies> session_deps) | 180 std::unique_ptr<SpdySessionDependencies> session_deps) |
181 : request_(request), | 181 : request_(request), |
182 priority_(priority), | 182 priority_(priority), |
183 session_deps_(session_deps.get() == NULL | 183 session_deps_(session_deps.get() == NULL |
184 ? CreateSpdySessionDependencies(test_params) | 184 ? CreateSpdySessionDependencies(test_params) |
185 : std::move(session_deps)), | 185 : std::move(session_deps)), |
186 session_( | 186 session_( |
187 SpdySessionDependencies::SpdyCreateSession(session_deps_.get())), | 187 SpdySessionDependencies::SpdyCreateSession(session_deps_.get())), |
188 log_(log), | 188 log_(log), |
189 test_params_(test_params), | 189 test_params_(test_params), |
190 port_(443), | |
191 spdy_enabled_(true) {} | 190 spdy_enabled_(true) {} |
192 | 191 |
193 ~NormalSpdyTransactionHelper() { | 192 ~NormalSpdyTransactionHelper() { |
194 // Any test which doesn't close the socket by sending it an EOF will | 193 // Any test which doesn't close the socket by sending it an EOF will |
195 // have a valid session left open, which leaks the entire session pool. | 194 // have a valid session left open, which leaks the entire session pool. |
196 // This is just fine - in fact, some of our tests intentionally do this | 195 // This is just fine - in fact, some of our tests intentionally do this |
197 // so that we can check consistency of the SpdySessionPool as the test | 196 // so that we can check consistency of the SpdySessionPool as the test |
198 // finishes. If we had put an EOF on the socket, the SpdySession would | 197 // finishes. If we had put an EOF on the socket, the SpdySession would |
199 // have closed and we wouldn't be able to check the consistency. | 198 // have closed and we wouldn't be able to check the consistency. |
200 | 199 |
201 // Forcefully close existing sessions here. | 200 // Forcefully close existing sessions here. |
202 session()->spdy_session_pool()->CloseAllSessions(); | 201 session()->spdy_session_pool()->CloseAllSessions(); |
203 } | 202 } |
204 | 203 |
205 void SetSpdyDisabled() { | 204 void SetSpdyDisabled() { |
206 spdy_enabled_ = false; | 205 spdy_enabled_ = false; |
207 port_ = test_params_.ssl_type == HTTP_SPDY_VIA_ALT_SVC ? 80 : 443; | |
208 } | 206 } |
209 | 207 |
210 void RunPreTestSetup() { | 208 void RunPreTestSetup() { |
211 if (!session_deps_.get()) | 209 if (!session_deps_.get()) |
212 session_deps_ = CreateSpdySessionDependencies(test_params_); | 210 session_deps_ = CreateSpdySessionDependencies(test_params_); |
213 if (!session_.get()) { | 211 if (!session_.get()) { |
214 session_ = SpdySessionDependencies::SpdyCreateSession( | 212 session_ = SpdySessionDependencies::SpdyCreateSession( |
215 session_deps_.get()); | 213 session_deps_.get()); |
216 } | 214 } |
217 | 215 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 EXPECT_TRUE(response->was_npn_negotiated); | 258 EXPECT_TRUE(response->was_npn_negotiated); |
261 } else { | 259 } else { |
262 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 260 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
263 EXPECT_FALSE(response->was_fetched_via_spdy); | 261 EXPECT_FALSE(response->was_fetched_via_spdy); |
264 // If SPDY is disabled, an HTTP request should not be diverted | 262 // If SPDY is disabled, an HTTP request should not be diverted |
265 // over an SSL session. | 263 // over an SSL session. |
266 EXPECT_EQ(request_.url.SchemeIs("https"), | 264 EXPECT_EQ(request_.url.SchemeIs("https"), |
267 response->was_npn_negotiated); | 265 response->was_npn_negotiated); |
268 } | 266 } |
269 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 267 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
270 EXPECT_EQ(port_, response->socket_address.port()); | 268 EXPECT_EQ(443, response->socket_address.port()); |
271 output_.status_line = response->headers->GetStatusLine(); | 269 output_.status_line = response->headers->GetStatusLine(); |
272 output_.response_info = *response; // Make a copy so we can verify. | 270 output_.response_info = *response; // Make a copy so we can verify. |
273 output_.rv = ReadTransaction(trans_.get(), &output_.response_data); | 271 output_.rv = ReadTransaction(trans_.get(), &output_.response_data); |
274 } | 272 } |
275 | 273 |
276 void FinishDefaultTestWithoutVerification() { | 274 void FinishDefaultTestWithoutVerification() { |
277 output_.rv = callback_.WaitForResult(); | 275 output_.rv = callback_.WaitForResult(); |
278 if (output_.rv != OK) | 276 if (output_.rv != OK) |
279 session_->spdy_session_pool()->CloseCurrentSessions(ERR_ABORTED); | 277 session_->spdy_session_pool()->CloseCurrentSessions(ERR_ABORTED); |
280 } | 278 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 if (ssl_provider->next_proto_status == | 330 if (ssl_provider->next_proto_status == |
333 SSLClientSocket::kNextProtoUnsupported) { | 331 SSLClientSocket::kNextProtoUnsupported) { |
334 ssl_provider->SetNextProto(test_params_.protocol); | 332 ssl_provider->SetNextProto(test_params_.protocol); |
335 } | 333 } |
336 | 334 |
337 session_deps_->socket_factory->AddSSLSocketDataProvider( | 335 session_deps_->socket_factory->AddSSLSocketDataProvider( |
338 ssl_provider.get()); | 336 ssl_provider.get()); |
339 ssl_vector_.push_back(std::move(ssl_provider)); | 337 ssl_vector_.push_back(std::move(ssl_provider)); |
340 | 338 |
341 session_deps_->socket_factory->AddSocketDataProvider(data); | 339 session_deps_->socket_factory->AddSocketDataProvider(data); |
342 if (test_params_.ssl_type == HTTP_SPDY_VIA_ALT_SVC) { | 340 if (test_params_.ssl_type == HTTPS_SPDY_VIA_ALT_SVC) { |
343 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING); | 341 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING); |
344 std::unique_ptr<StaticSocketDataProvider> hanging_non_alt_svc_socket( | 342 std::unique_ptr<StaticSocketDataProvider> hanging_non_alt_svc_socket( |
345 base::WrapUnique(new StaticSocketDataProvider(NULL, 0, NULL, 0))); | 343 base::WrapUnique(new StaticSocketDataProvider(NULL, 0, NULL, 0))); |
346 hanging_non_alt_svc_socket->set_connect_data(hanging_connect); | 344 hanging_non_alt_svc_socket->set_connect_data(hanging_connect); |
347 session_deps_->socket_factory->AddSocketDataProvider( | 345 session_deps_->socket_factory->AddSocketDataProvider( |
348 hanging_non_alt_svc_socket.get()); | 346 hanging_non_alt_svc_socket.get()); |
349 alternate_vector_.push_back(std::move(hanging_non_alt_svc_socket)); | 347 alternate_vector_.push_back(std::move(hanging_non_alt_svc_socket)); |
350 } | 348 } |
351 } | 349 } |
352 | 350 |
353 void SetSession(std::unique_ptr<HttpNetworkSession> session) { | 351 void SetSession(std::unique_ptr<HttpNetworkSession> session) { |
354 session_ = std::move(session); | 352 session_ = std::move(session); |
355 } | 353 } |
356 HttpNetworkTransaction* trans() { return trans_.get(); } | 354 HttpNetworkTransaction* trans() { return trans_.get(); } |
357 void ResetTrans() { trans_.reset(); } | 355 void ResetTrans() { trans_.reset(); } |
358 TransactionHelperResult& output() { return output_; } | 356 TransactionHelperResult& output() { return output_; } |
359 const HttpRequestInfo& request() const { return request_; } | 357 const HttpRequestInfo& request() const { return request_; } |
360 HttpNetworkSession* session() const { return session_.get(); } | 358 HttpNetworkSession* session() const { return session_.get(); } |
361 std::unique_ptr<SpdySessionDependencies>& session_deps() { | 359 std::unique_ptr<SpdySessionDependencies>& session_deps() { |
362 return session_deps_; | 360 return session_deps_; |
363 } | 361 } |
364 int port() const { return port_; } | |
365 SpdyNetworkTransactionTestParams test_params() const { | 362 SpdyNetworkTransactionTestParams test_params() const { |
366 return test_params_; | 363 return test_params_; |
367 } | 364 } |
368 | 365 |
369 private: | 366 private: |
370 typedef std::vector<SocketDataProvider*> DataVector; | 367 typedef std::vector<SocketDataProvider*> DataVector; |
371 typedef std::vector<std::unique_ptr<SSLSocketDataProvider>> SSLVector; | 368 typedef std::vector<std::unique_ptr<SSLSocketDataProvider>> SSLVector; |
372 typedef std::vector<std::unique_ptr<SocketDataProvider>> AlternateVector; | 369 typedef std::vector<std::unique_ptr<SocketDataProvider>> AlternateVector; |
373 HttpRequestInfo request_; | 370 HttpRequestInfo request_; |
374 RequestPriority priority_; | 371 RequestPriority priority_; |
375 std::unique_ptr<SpdySessionDependencies> session_deps_; | 372 std::unique_ptr<SpdySessionDependencies> session_deps_; |
376 std::unique_ptr<HttpNetworkSession> session_; | 373 std::unique_ptr<HttpNetworkSession> session_; |
377 TransactionHelperResult output_; | 374 TransactionHelperResult output_; |
378 std::unique_ptr<SocketDataProvider> first_transaction_; | 375 std::unique_ptr<SocketDataProvider> first_transaction_; |
379 SSLVector ssl_vector_; | 376 SSLVector ssl_vector_; |
380 TestCompletionCallback callback_; | 377 TestCompletionCallback callback_; |
381 std::unique_ptr<HttpNetworkTransaction> trans_; | 378 std::unique_ptr<HttpNetworkTransaction> trans_; |
382 std::unique_ptr<HttpNetworkTransaction> trans_http_; | 379 std::unique_ptr<HttpNetworkTransaction> trans_http_; |
383 DataVector data_vector_; | 380 DataVector data_vector_; |
384 AlternateVector alternate_vector_; | 381 AlternateVector alternate_vector_; |
385 const BoundNetLog log_; | 382 const BoundNetLog log_; |
386 SpdyNetworkTransactionTestParams test_params_; | 383 SpdyNetworkTransactionTestParams test_params_; |
387 int port_; | |
388 bool spdy_enabled_; | 384 bool spdy_enabled_; |
389 }; | 385 }; |
390 | 386 |
391 void ConnectStatusHelperWithExpectedStatus(const MockRead& status, | 387 void ConnectStatusHelperWithExpectedStatus(const MockRead& status, |
392 int expected_status); | 388 int expected_status); |
393 | 389 |
394 void ConnectStatusHelper(const MockRead& status); | 390 void ConnectStatusHelper(const MockRead& status); |
395 | 391 |
396 const HttpRequestInfo& CreateGetPushRequest() { | 392 const HttpRequestInfo& CreateGetPushRequest() { |
397 get_push_request_.method = "GET"; | 393 get_push_request_.method = "GET"; |
398 get_push_request_.url = GURL(GetDefaultUrlWithPath("/foo.dat")); | 394 get_push_request_.url = GURL(GetDefaultUrlWithPath("/foo.dat")); |
399 get_push_request_.load_flags = 0; | 395 get_push_request_.load_flags = 0; |
400 return get_push_request_; | 396 return get_push_request_; |
401 } | 397 } |
402 | 398 |
403 const HttpRequestInfo& CreateGetRequest() { | 399 const HttpRequestInfo& CreateGetRequest() { |
404 if (!get_request_initialized_) { | 400 if (!get_request_initialized_) { |
405 get_request_.method = "GET"; | 401 get_request_.method = "GET"; |
406 get_request_.url = GURL(GetDefaultUrl()); | 402 get_request_.url = default_url_; |
407 get_request_.load_flags = 0; | 403 get_request_.load_flags = 0; |
408 get_request_initialized_ = true; | 404 get_request_initialized_ = true; |
409 } | 405 } |
410 return get_request_; | 406 return get_request_; |
411 } | 407 } |
412 | 408 |
413 const HttpRequestInfo& CreateGetRequestWithUserAgent() { | 409 const HttpRequestInfo& CreateGetRequestWithUserAgent() { |
414 if (!get_request_initialized_) { | 410 if (!get_request_initialized_) { |
415 get_request_.method = "GET"; | 411 get_request_.method = "GET"; |
416 get_request_.url = GURL(GetDefaultUrl()); | 412 get_request_.url = default_url_; |
417 get_request_.load_flags = 0; | 413 get_request_.load_flags = 0; |
418 get_request_.extra_headers.SetHeader("User-Agent", "Chrome"); | 414 get_request_.extra_headers.SetHeader("User-Agent", "Chrome"); |
419 get_request_initialized_ = true; | 415 get_request_initialized_ = true; |
420 } | 416 } |
421 return get_request_; | 417 return get_request_; |
422 } | 418 } |
423 | 419 |
424 const HttpRequestInfo& CreatePostRequest() { | 420 const HttpRequestInfo& CreatePostRequest() { |
425 if (!post_request_initialized_) { | 421 if (!post_request_initialized_) { |
426 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 422 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
427 element_readers.push_back(base::WrapUnique( | 423 element_readers.push_back(base::WrapUnique( |
428 new UploadBytesElementReader(kUploadData, kUploadDataSize))); | 424 new UploadBytesElementReader(kUploadData, kUploadDataSize))); |
429 upload_data_stream_.reset( | 425 upload_data_stream_.reset( |
430 new ElementsUploadDataStream(std::move(element_readers), 0)); | 426 new ElementsUploadDataStream(std::move(element_readers), 0)); |
431 | 427 |
432 post_request_.method = "POST"; | 428 post_request_.method = "POST"; |
433 post_request_.url = GURL(GetDefaultUrl()); | 429 post_request_.url = default_url_; |
434 post_request_.upload_data_stream = upload_data_stream_.get(); | 430 post_request_.upload_data_stream = upload_data_stream_.get(); |
435 post_request_initialized_ = true; | 431 post_request_initialized_ = true; |
436 } | 432 } |
437 return post_request_; | 433 return post_request_; |
438 } | 434 } |
439 | 435 |
440 const HttpRequestInfo& CreateFilePostRequest() { | 436 const HttpRequestInfo& CreateFilePostRequest() { |
441 if (!post_request_initialized_) { | 437 if (!post_request_initialized_) { |
442 base::FilePath file_path; | 438 base::FilePath file_path; |
443 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); | 439 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); |
444 CHECK_EQ(static_cast<int>(kUploadDataSize), | 440 CHECK_EQ(static_cast<int>(kUploadDataSize), |
445 base::WriteFile(file_path, kUploadData, kUploadDataSize)); | 441 base::WriteFile(file_path, kUploadData, kUploadDataSize)); |
446 | 442 |
447 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 443 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
448 element_readers.push_back(base::WrapUnique(new UploadFileElementReader( | 444 element_readers.push_back(base::WrapUnique(new UploadFileElementReader( |
449 base::ThreadTaskRunnerHandle::Get().get(), file_path, 0, | 445 base::ThreadTaskRunnerHandle::Get().get(), file_path, 0, |
450 kUploadDataSize, base::Time()))); | 446 kUploadDataSize, base::Time()))); |
451 upload_data_stream_.reset( | 447 upload_data_stream_.reset( |
452 new ElementsUploadDataStream(std::move(element_readers), 0)); | 448 new ElementsUploadDataStream(std::move(element_readers), 0)); |
453 | 449 |
454 post_request_.method = "POST"; | 450 post_request_.method = "POST"; |
455 post_request_.url = GURL(GetDefaultUrl()); | 451 post_request_.url = default_url_; |
456 post_request_.upload_data_stream = upload_data_stream_.get(); | 452 post_request_.upload_data_stream = upload_data_stream_.get(); |
457 post_request_initialized_ = true; | 453 post_request_initialized_ = true; |
458 } | 454 } |
459 return post_request_; | 455 return post_request_; |
460 } | 456 } |
461 | 457 |
462 const HttpRequestInfo& CreateUnreadableFilePostRequest() { | 458 const HttpRequestInfo& CreateUnreadableFilePostRequest() { |
463 if (post_request_initialized_) | 459 if (post_request_initialized_) |
464 return post_request_; | 460 return post_request_; |
465 | 461 |
466 base::FilePath file_path; | 462 base::FilePath file_path; |
467 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); | 463 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); |
468 CHECK_EQ(static_cast<int>(kUploadDataSize), | 464 CHECK_EQ(static_cast<int>(kUploadDataSize), |
469 base::WriteFile(file_path, kUploadData, kUploadDataSize)); | 465 base::WriteFile(file_path, kUploadData, kUploadDataSize)); |
470 CHECK(base::MakeFileUnreadable(file_path)); | 466 CHECK(base::MakeFileUnreadable(file_path)); |
471 | 467 |
472 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 468 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
473 element_readers.push_back(base::WrapUnique(new UploadFileElementReader( | 469 element_readers.push_back(base::WrapUnique(new UploadFileElementReader( |
474 base::ThreadTaskRunnerHandle::Get().get(), file_path, 0, | 470 base::ThreadTaskRunnerHandle::Get().get(), file_path, 0, |
475 kUploadDataSize, base::Time()))); | 471 kUploadDataSize, base::Time()))); |
476 upload_data_stream_.reset( | 472 upload_data_stream_.reset( |
477 new ElementsUploadDataStream(std::move(element_readers), 0)); | 473 new ElementsUploadDataStream(std::move(element_readers), 0)); |
478 | 474 |
479 post_request_.method = "POST"; | 475 post_request_.method = "POST"; |
480 post_request_.url = GURL(GetDefaultUrl()); | 476 post_request_.url = default_url_; |
481 post_request_.upload_data_stream = upload_data_stream_.get(); | 477 post_request_.upload_data_stream = upload_data_stream_.get(); |
482 post_request_initialized_ = true; | 478 post_request_initialized_ = true; |
483 return post_request_; | 479 return post_request_; |
484 } | 480 } |
485 | 481 |
486 const HttpRequestInfo& CreateComplexPostRequest() { | 482 const HttpRequestInfo& CreateComplexPostRequest() { |
487 if (!post_request_initialized_) { | 483 if (!post_request_initialized_) { |
488 const int kFileRangeOffset = 1; | 484 const int kFileRangeOffset = 1; |
489 const int kFileRangeLength = 3; | 485 const int kFileRangeLength = 3; |
490 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize); | 486 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize); |
491 | 487 |
492 base::FilePath file_path; | 488 base::FilePath file_path; |
493 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); | 489 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); |
494 CHECK_EQ(static_cast<int>(kUploadDataSize), | 490 CHECK_EQ(static_cast<int>(kUploadDataSize), |
495 base::WriteFile(file_path, kUploadData, kUploadDataSize)); | 491 base::WriteFile(file_path, kUploadData, kUploadDataSize)); |
496 | 492 |
497 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 493 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
498 element_readers.push_back(base::WrapUnique( | 494 element_readers.push_back(base::WrapUnique( |
499 new UploadBytesElementReader(kUploadData, kFileRangeOffset))); | 495 new UploadBytesElementReader(kUploadData, kFileRangeOffset))); |
500 element_readers.push_back(base::WrapUnique(new UploadFileElementReader( | 496 element_readers.push_back(base::WrapUnique(new UploadFileElementReader( |
501 base::ThreadTaskRunnerHandle::Get().get(), file_path, | 497 base::ThreadTaskRunnerHandle::Get().get(), file_path, |
502 kFileRangeOffset, kFileRangeLength, base::Time()))); | 498 kFileRangeOffset, kFileRangeLength, base::Time()))); |
503 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( | 499 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( |
504 kUploadData + kFileRangeOffset + kFileRangeLength, | 500 kUploadData + kFileRangeOffset + kFileRangeLength, |
505 kUploadDataSize - (kFileRangeOffset + kFileRangeLength)))); | 501 kUploadDataSize - (kFileRangeOffset + kFileRangeLength)))); |
506 upload_data_stream_.reset( | 502 upload_data_stream_.reset( |
507 new ElementsUploadDataStream(std::move(element_readers), 0)); | 503 new ElementsUploadDataStream(std::move(element_readers), 0)); |
508 | 504 |
509 post_request_.method = "POST"; | 505 post_request_.method = "POST"; |
510 post_request_.url = GURL(GetDefaultUrl()); | 506 post_request_.url = default_url_; |
511 post_request_.upload_data_stream = upload_data_stream_.get(); | 507 post_request_.upload_data_stream = upload_data_stream_.get(); |
512 post_request_initialized_ = true; | 508 post_request_initialized_ = true; |
513 } | 509 } |
514 return post_request_; | 510 return post_request_; |
515 } | 511 } |
516 | 512 |
517 const HttpRequestInfo& CreateChunkedPostRequest() { | 513 const HttpRequestInfo& CreateChunkedPostRequest() { |
518 if (!chunked_post_request_initialized_) { | 514 if (!chunked_post_request_initialized_) { |
519 upload_chunked_data_stream_.reset(new ChunkedUploadDataStream(0)); | 515 upload_chunked_data_stream_.reset(new ChunkedUploadDataStream(0)); |
520 chunked_post_request_.method = "POST"; | 516 chunked_post_request_.method = "POST"; |
521 chunked_post_request_.url = GURL(GetDefaultUrl()); | 517 chunked_post_request_.url = default_url_; |
522 chunked_post_request_.upload_data_stream = | 518 chunked_post_request_.upload_data_stream = |
523 upload_chunked_data_stream_.get(); | 519 upload_chunked_data_stream_.get(); |
524 chunked_post_request_initialized_ = true; | 520 chunked_post_request_initialized_ = true; |
525 } | 521 } |
526 return chunked_post_request_; | 522 return chunked_post_request_; |
527 } | 523 } |
528 | 524 |
529 // Read the result of a particular transaction, knowing that we've got | 525 // Read the result of a particular transaction, knowing that we've got |
530 // multiple transactions in the read pipeline; so as we read, we may have | 526 // multiple transactions in the read pipeline; so as we read, we may have |
531 // to skip over data destined for other transactions while we consume | 527 // to skip over data destined for other transactions while we consume |
(...skipping 16 matching lines...) Expand all Loading... | |
548 bytes_read += rv; | 544 bytes_read += rv; |
549 } | 545 } |
550 return bytes_read; | 546 return bytes_read; |
551 } | 547 } |
552 | 548 |
553 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) { | 549 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) { |
554 // This lengthy block is reaching into the pool to dig out the active | 550 // This lengthy block is reaching into the pool to dig out the active |
555 // session. Once we have the session, we verify that the streams are | 551 // session. Once we have the session, we verify that the streams are |
556 // all closed and not leaked at this point. | 552 // all closed and not leaked at this point. |
557 const GURL& url = helper.request().url; | 553 const GURL& url = helper.request().url; |
558 HostPortPair host_port_pair(url.host(), 443); | 554 SpdySessionKey key(HostPortPair::FromURL(url), ProxyServer::Direct(), |
559 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | |
560 PRIVACY_MODE_DISABLED); | 555 PRIVACY_MODE_DISABLED); |
561 BoundNetLog log; | 556 BoundNetLog log; |
562 HttpNetworkSession* session = helper.session(); | 557 HttpNetworkSession* session = helper.session(); |
563 base::WeakPtr<SpdySession> spdy_session = | 558 base::WeakPtr<SpdySession> spdy_session = |
564 session->spdy_session_pool()->FindAvailableSession(key, url, log); | 559 session->spdy_session_pool()->FindAvailableSession(key, url, log); |
565 ASSERT_TRUE(spdy_session); | 560 ASSERT_TRUE(spdy_session); |
566 EXPECT_EQ(0u, spdy_session->num_active_streams()); | 561 EXPECT_EQ(0u, spdy_session->num_active_streams()); |
567 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); | 562 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); |
568 } | 563 } |
569 | 564 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 request.load_flags = 0; | 643 request.load_flags = 0; |
649 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 644 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
650 EXPECT_EQ(ERR_IO_PENDING, rv); | 645 EXPECT_EQ(ERR_IO_PENDING, rv); |
651 callback.WaitForResult(); | 646 callback.WaitForResult(); |
652 } | 647 } |
653 | 648 |
654 ChunkedUploadDataStream* upload_chunked_data_stream() const { | 649 ChunkedUploadDataStream* upload_chunked_data_stream() const { |
655 return upload_chunked_data_stream_.get(); | 650 return upload_chunked_data_stream_.get(); |
656 } | 651 } |
657 | 652 |
658 const char* GetDefaultUrl() { | 653 std::string GetDefaultUrlWithPath(const char* path) { |
659 switch (GetParam().ssl_type) { | 654 return std::string(kDefaultUrl) + path; |
660 case HTTP_SPDY_VIA_ALT_SVC: | |
661 return "http://www.example.org"; | |
662 case HTTPS_SPDY_VIA_NPN: | |
663 return "https://www.example.org"; | |
664 default: | |
665 NOTREACHED(); | |
666 return ""; | |
667 } | |
668 } | 655 } |
669 | 656 |
670 std::string GetDefaultUrlWithPath(const char* path) { | 657 const GURL default_url_; |
671 return std::string(GetDefaultUrl()) + path; | 658 const HostPortPair host_port_pair_; |
672 } | |
673 | |
674 SpdyTestUtil spdy_util_; | 659 SpdyTestUtil spdy_util_; |
675 | 660 |
676 private: | 661 private: |
677 std::unique_ptr<ChunkedUploadDataStream> upload_chunked_data_stream_; | 662 std::unique_ptr<ChunkedUploadDataStream> upload_chunked_data_stream_; |
678 std::unique_ptr<UploadDataStream> upload_data_stream_; | 663 std::unique_ptr<UploadDataStream> upload_data_stream_; |
679 bool get_request_initialized_; | 664 bool get_request_initialized_; |
680 bool post_request_initialized_; | 665 bool post_request_initialized_; |
681 bool chunked_post_request_initialized_; | 666 bool chunked_post_request_initialized_; |
682 HttpRequestInfo get_request_; | 667 HttpRequestInfo get_request_; |
683 HttpRequestInfo post_request_; | 668 HttpRequestInfo post_request_; |
684 HttpRequestInfo chunked_post_request_; | 669 HttpRequestInfo chunked_post_request_; |
685 HttpRequestInfo get_push_request_; | 670 HttpRequestInfo get_push_request_; |
686 base::ScopedTempDir temp_dir_; | 671 base::ScopedTempDir temp_dir_; |
687 }; | 672 }; |
688 | 673 |
689 //----------------------------------------------------------------------------- | 674 //----------------------------------------------------------------------------- |
690 // All tests are run with three different connection types: SPDY after NPN | 675 // All tests are run with three different connection types: SPDY after NPN |
691 // negotiation, SPDY without SSL, and SPDY with SSL. | 676 // negotiation, SPDY without SSL, and SPDY with SSL. |
692 // | 677 // |
693 // TODO(akalin): Use ::testing::Combine() when we are able to use | 678 // TODO(akalin): Use ::testing::Combine() when we are able to use |
694 // <tr1/tuple>. | 679 // <tr1/tuple>. |
695 INSTANTIATE_TEST_CASE_P( | 680 INSTANTIATE_TEST_CASE_P( |
696 Spdy, | 681 Spdy, |
697 SpdyNetworkTransactionTest, | 682 SpdyNetworkTransactionTest, |
698 ::testing::Values( | 683 ::testing::Values( |
699 SpdyNetworkTransactionTestParams(kProtoSPDY31, | 684 SpdyNetworkTransactionTestParams(kProtoSPDY31, |
700 HTTPS_SPDY_VIA_NPN, | 685 HTTPS_SPDY_VIA_NPN, |
701 false), | 686 false), |
702 SpdyNetworkTransactionTestParams(kProtoSPDY31, | 687 SpdyNetworkTransactionTestParams(kProtoSPDY31, |
703 HTTP_SPDY_VIA_ALT_SVC, | 688 HTTPS_SPDY_VIA_ALT_SVC, |
704 false), | 689 false), |
705 SpdyNetworkTransactionTestParams(kProtoHTTP2, | 690 SpdyNetworkTransactionTestParams(kProtoHTTP2, |
706 HTTPS_SPDY_VIA_NPN, | 691 HTTPS_SPDY_VIA_NPN, |
707 false), | 692 false), |
708 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTPS_SPDY_VIA_NPN, true), | 693 SpdyNetworkTransactionTestParams(kProtoHTTP2, HTTPS_SPDY_VIA_NPN, true), |
709 SpdyNetworkTransactionTestParams(kProtoHTTP2, | 694 SpdyNetworkTransactionTestParams(kProtoHTTP2, |
710 HTTP_SPDY_VIA_ALT_SVC, | 695 HTTPS_SPDY_VIA_ALT_SVC, |
711 false), | 696 false), |
712 SpdyNetworkTransactionTestParams(kProtoHTTP2, | 697 SpdyNetworkTransactionTestParams(kProtoHTTP2, |
713 HTTP_SPDY_VIA_ALT_SVC, | 698 HTTPS_SPDY_VIA_ALT_SVC, |
714 true))); | 699 true))); |
715 | 700 |
716 // Verify HttpNetworkTransaction constructor. | 701 // Verify HttpNetworkTransaction constructor. |
717 TEST_P(SpdyNetworkTransactionTest, Constructor) { | 702 TEST_P(SpdyNetworkTransactionTest, Constructor) { |
718 std::unique_ptr<SpdySessionDependencies> session_deps( | 703 std::unique_ptr<SpdySessionDependencies> session_deps( |
719 CreateSpdySessionDependencies(GetParam())); | 704 CreateSpdySessionDependencies(GetParam())); |
720 std::unique_ptr<HttpNetworkSession> session( | 705 std::unique_ptr<HttpNetworkSession> session( |
721 SpdySessionDependencies::SpdyCreateSession(session_deps.get())); | 706 SpdySessionDependencies::SpdyCreateSession(session_deps.get())); |
722 std::unique_ptr<HttpTransaction> trans( | 707 std::unique_ptr<HttpTransaction> trans( |
723 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 708 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
(...skipping 23 matching lines...) Expand all Loading... | |
747 EXPECT_EQ(OK, out.rv); | 732 EXPECT_EQ(OK, out.rv); |
748 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 733 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
749 EXPECT_EQ("hello!", out.response_data); | 734 EXPECT_EQ("hello!", out.response_data); |
750 } | 735 } |
751 | 736 |
752 TEST_P(SpdyNetworkTransactionTest, GetAtEachPriority) { | 737 TEST_P(SpdyNetworkTransactionTest, GetAtEachPriority) { |
753 for (RequestPriority p = MINIMUM_PRIORITY; p <= MAXIMUM_PRIORITY; | 738 for (RequestPriority p = MINIMUM_PRIORITY; p <= MAXIMUM_PRIORITY; |
754 p = RequestPriority(p + 1)) { | 739 p = RequestPriority(p + 1)) { |
755 SpdyTestUtil spdy_test_util(GetParam().protocol, | 740 SpdyTestUtil spdy_test_util(GetParam().protocol, |
756 GetParam().priority_to_dependency); | 741 GetParam().priority_to_dependency); |
757 spdy_test_util.set_default_url(GURL(GetDefaultUrl())); | |
758 | 742 |
759 // Construct the request. | 743 // Construct the request. |
760 std::unique_ptr<SpdySerializedFrame> req( | 744 std::unique_ptr<SpdySerializedFrame> req( |
761 spdy_test_util.ConstructSpdyGet(nullptr, 0, 1, p, true)); | 745 spdy_test_util.ConstructSpdyGet(nullptr, 0, 1, p, true)); |
762 MockWrite writes[] = {CreateMockWrite(*req, 0)}; | 746 MockWrite writes[] = {CreateMockWrite(*req, 0)}; |
763 | 747 |
764 SpdyPriority spdy_prio = 0; | 748 SpdyPriority spdy_prio = 0; |
765 EXPECT_TRUE( | 749 EXPECT_TRUE( |
766 GetSpdyPriority(spdy_test_util.spdy_version(), *req, &spdy_prio)); | 750 GetSpdyPriority(spdy_test_util.spdy_version(), *req, &spdy_prio)); |
767 // this repeats the RequestPriority-->SpdyPriority mapping from | 751 // this repeats the RequestPriority-->SpdyPriority mapping from |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1662 EXPECT_EQ(ERR_CONNECTION_RESET, out.rv); | 1646 EXPECT_EQ(ERR_CONNECTION_RESET, out.rv); |
1663 | 1647 |
1664 helper.VerifyDataConsumed(); | 1648 helper.VerifyDataConsumed(); |
1665 } | 1649 } |
1666 | 1650 |
1667 // Test that a simple PUT request works. | 1651 // Test that a simple PUT request works. |
1668 TEST_P(SpdyNetworkTransactionTest, Put) { | 1652 TEST_P(SpdyNetworkTransactionTest, Put) { |
1669 // Setup the request | 1653 // Setup the request |
1670 HttpRequestInfo request; | 1654 HttpRequestInfo request; |
1671 request.method = "PUT"; | 1655 request.method = "PUT"; |
1672 request.url = GURL(GetDefaultUrl()); | 1656 request.url = default_url_; |
1673 | 1657 |
1674 SpdyHeaderBlock put_headers( | 1658 SpdyHeaderBlock put_headers( |
1675 spdy_util_.ConstructPutHeaderBlock(GetDefaultUrl(), 0)); | 1659 spdy_util_.ConstructPutHeaderBlock(kDefaultUrl, 0)); |
1676 std::unique_ptr<SpdySerializedFrame> req( | 1660 std::unique_ptr<SpdySerializedFrame> req( |
1677 spdy_util_.ConstructSpdySyn(1, std::move(put_headers), LOWEST, true)); | 1661 spdy_util_.ConstructSpdySyn(1, std::move(put_headers), LOWEST, true)); |
1678 MockWrite writes[] = { | 1662 MockWrite writes[] = { |
1679 CreateMockWrite(*req, 0), | 1663 CreateMockWrite(*req, 0), |
1680 }; | 1664 }; |
1681 | 1665 |
1682 std::unique_ptr<SpdySerializedFrame> resp( | 1666 std::unique_ptr<SpdySerializedFrame> resp( |
1683 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 1667 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
1684 std::unique_ptr<SpdySerializedFrame> body( | 1668 std::unique_ptr<SpdySerializedFrame> body( |
1685 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 1669 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
(...skipping 11 matching lines...) Expand all Loading... | |
1697 | 1681 |
1698 EXPECT_EQ(OK, out.rv); | 1682 EXPECT_EQ(OK, out.rv); |
1699 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1683 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
1700 } | 1684 } |
1701 | 1685 |
1702 // Test that a simple HEAD request works. | 1686 // Test that a simple HEAD request works. |
1703 TEST_P(SpdyNetworkTransactionTest, Head) { | 1687 TEST_P(SpdyNetworkTransactionTest, Head) { |
1704 // Setup the request | 1688 // Setup the request |
1705 HttpRequestInfo request; | 1689 HttpRequestInfo request; |
1706 request.method = "HEAD"; | 1690 request.method = "HEAD"; |
1707 request.url = GURL(GetDefaultUrl()); | 1691 request.url = default_url_; |
1708 | 1692 |
1709 SpdyHeaderBlock head_headers( | 1693 SpdyHeaderBlock head_headers( |
1710 spdy_util_.ConstructHeadHeaderBlock(GetDefaultUrl(), 0)); | 1694 spdy_util_.ConstructHeadHeaderBlock(kDefaultUrl, 0)); |
1711 std::unique_ptr<SpdySerializedFrame> req( | 1695 std::unique_ptr<SpdySerializedFrame> req( |
1712 spdy_util_.ConstructSpdySyn(1, std::move(head_headers), LOWEST, true)); | 1696 spdy_util_.ConstructSpdySyn(1, std::move(head_headers), LOWEST, true)); |
1713 MockWrite writes[] = { | 1697 MockWrite writes[] = { |
1714 CreateMockWrite(*req, 0), | 1698 CreateMockWrite(*req, 0), |
1715 }; | 1699 }; |
1716 | 1700 |
1717 std::unique_ptr<SpdySerializedFrame> resp( | 1701 std::unique_ptr<SpdySerializedFrame> resp( |
1718 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 1702 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
1719 std::unique_ptr<SpdySerializedFrame> body( | 1703 std::unique_ptr<SpdySerializedFrame> body( |
1720 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 1704 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
1721 MockRead reads[] = { | 1705 MockRead reads[] = { |
1722 CreateMockRead(*resp, 1), | 1706 CreateMockRead(*resp, 1), |
1723 CreateMockRead(*body, 2), | 1707 CreateMockRead(*body, 2), |
1724 MockRead(ASYNC, 0, 3) // EOF | 1708 MockRead(ASYNC, 0, 3) // EOF |
1725 }; | 1709 }; |
1726 | 1710 |
1727 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 1711 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
1728 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, | 1712 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, |
1729 BoundNetLog(), GetParam(), NULL); | 1713 BoundNetLog(), GetParam(), NULL); |
1730 helper.RunToCompletion(&data); | 1714 helper.RunToCompletion(&data); |
1731 TransactionHelperResult out = helper.output(); | 1715 TransactionHelperResult out = helper.output(); |
1732 | 1716 |
1733 EXPECT_EQ(OK, out.rv); | 1717 EXPECT_EQ(OK, out.rv); |
1734 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1718 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
1735 } | 1719 } |
1736 | 1720 |
1737 // Test that a simple POST works. | 1721 // Test that a simple POST works. |
1738 TEST_P(SpdyNetworkTransactionTest, Post) { | 1722 TEST_P(SpdyNetworkTransactionTest, Post) { |
1739 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 1723 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
1740 GetDefaultUrl(), 1, kUploadDataSize, LOWEST, NULL, 0)); | 1724 kDefaultUrl, 1, kUploadDataSize, LOWEST, NULL, 0)); |
1741 std::unique_ptr<SpdySerializedFrame> body( | 1725 std::unique_ptr<SpdySerializedFrame> body( |
1742 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 1726 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
1743 MockWrite writes[] = { | 1727 MockWrite writes[] = { |
1744 CreateMockWrite(*req, 0), CreateMockWrite(*body, 1), // POST upload frame | 1728 CreateMockWrite(*req, 0), CreateMockWrite(*body, 1), // POST upload frame |
1745 }; | 1729 }; |
1746 | 1730 |
1747 std::unique_ptr<SpdySerializedFrame> resp( | 1731 std::unique_ptr<SpdySerializedFrame> resp( |
1748 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); | 1732 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); |
1749 MockRead reads[] = { | 1733 MockRead reads[] = { |
1750 CreateMockRead(*resp, 2), | 1734 CreateMockRead(*resp, 2), |
1751 CreateMockRead(*body, 3), | 1735 CreateMockRead(*body, 3), |
1752 MockRead(ASYNC, 0, 4) // EOF | 1736 MockRead(ASYNC, 0, 4) // EOF |
1753 }; | 1737 }; |
1754 | 1738 |
1755 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 1739 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
1756 NormalSpdyTransactionHelper helper(CreatePostRequest(), DEFAULT_PRIORITY, | 1740 NormalSpdyTransactionHelper helper(CreatePostRequest(), DEFAULT_PRIORITY, |
1757 BoundNetLog(), GetParam(), NULL); | 1741 BoundNetLog(), GetParam(), NULL); |
1758 helper.RunToCompletion(&data); | 1742 helper.RunToCompletion(&data); |
1759 TransactionHelperResult out = helper.output(); | 1743 TransactionHelperResult out = helper.output(); |
1760 EXPECT_EQ(OK, out.rv); | 1744 EXPECT_EQ(OK, out.rv); |
1761 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1745 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
1762 EXPECT_EQ("hello!", out.response_data); | 1746 EXPECT_EQ("hello!", out.response_data); |
1763 } | 1747 } |
1764 | 1748 |
1765 // Test that a POST with a file works. | 1749 // Test that a POST with a file works. |
1766 TEST_P(SpdyNetworkTransactionTest, FilePost) { | 1750 TEST_P(SpdyNetworkTransactionTest, FilePost) { |
1767 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 1751 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
1768 GetDefaultUrl(), 1, kUploadDataSize, LOWEST, NULL, 0)); | 1752 kDefaultUrl, 1, kUploadDataSize, LOWEST, NULL, 0)); |
1769 std::unique_ptr<SpdySerializedFrame> body( | 1753 std::unique_ptr<SpdySerializedFrame> body( |
1770 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 1754 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
1771 MockWrite writes[] = { | 1755 MockWrite writes[] = { |
1772 CreateMockWrite(*req, 0), CreateMockWrite(*body, 1), // POST upload frame | 1756 CreateMockWrite(*req, 0), CreateMockWrite(*body, 1), // POST upload frame |
1773 }; | 1757 }; |
1774 | 1758 |
1775 std::unique_ptr<SpdySerializedFrame> resp( | 1759 std::unique_ptr<SpdySerializedFrame> resp( |
1776 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); | 1760 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); |
1777 MockRead reads[] = { | 1761 MockRead reads[] = { |
1778 CreateMockRead(*resp, 2), | 1762 CreateMockRead(*resp, 2), |
(...skipping 29 matching lines...) Expand all Loading... | |
1808 helper.RunDefaultTest(); | 1792 helper.RunDefaultTest(); |
1809 | 1793 |
1810 base::RunLoop().RunUntilIdle(); | 1794 base::RunLoop().RunUntilIdle(); |
1811 helper.VerifyDataNotConsumed(); | 1795 helper.VerifyDataNotConsumed(); |
1812 EXPECT_EQ(ERR_ACCESS_DENIED, helper.output().rv); | 1796 EXPECT_EQ(ERR_ACCESS_DENIED, helper.output().rv); |
1813 } | 1797 } |
1814 | 1798 |
1815 // Test that a complex POST works. | 1799 // Test that a complex POST works. |
1816 TEST_P(SpdyNetworkTransactionTest, ComplexPost) { | 1800 TEST_P(SpdyNetworkTransactionTest, ComplexPost) { |
1817 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 1801 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
1818 GetDefaultUrl(), 1, kUploadDataSize, LOWEST, NULL, 0)); | 1802 kDefaultUrl, 1, kUploadDataSize, LOWEST, NULL, 0)); |
1819 std::unique_ptr<SpdySerializedFrame> body( | 1803 std::unique_ptr<SpdySerializedFrame> body( |
1820 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 1804 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
1821 MockWrite writes[] = { | 1805 MockWrite writes[] = { |
1822 CreateMockWrite(*req, 0), CreateMockWrite(*body, 1), // POST upload frame | 1806 CreateMockWrite(*req, 0), CreateMockWrite(*body, 1), // POST upload frame |
1823 }; | 1807 }; |
1824 | 1808 |
1825 std::unique_ptr<SpdySerializedFrame> resp( | 1809 std::unique_ptr<SpdySerializedFrame> resp( |
1826 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); | 1810 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); |
1827 MockRead reads[] = { | 1811 MockRead reads[] = { |
1828 CreateMockRead(*resp, 2), | 1812 CreateMockRead(*resp, 2), |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1933 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1917 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
1934 EXPECT_EQ(expected_response, out.response_data); | 1918 EXPECT_EQ(expected_response, out.response_data); |
1935 } | 1919 } |
1936 | 1920 |
1937 // Test that a POST without any post data works. | 1921 // Test that a POST without any post data works. |
1938 TEST_P(SpdyNetworkTransactionTest, NullPost) { | 1922 TEST_P(SpdyNetworkTransactionTest, NullPost) { |
1939 BufferedSpdyFramer framer(spdy_util_.spdy_version()); | 1923 BufferedSpdyFramer framer(spdy_util_.spdy_version()); |
1940 // Setup the request | 1924 // Setup the request |
1941 HttpRequestInfo request; | 1925 HttpRequestInfo request; |
1942 request.method = "POST"; | 1926 request.method = "POST"; |
1943 request.url = GURL(GetDefaultUrl()); | 1927 request.url = default_url_; |
1944 // Create an empty UploadData. | 1928 // Create an empty UploadData. |
1945 request.upload_data_stream = NULL; | 1929 request.upload_data_stream = NULL; |
1946 | 1930 |
1947 // When request.upload_data_stream is NULL for post, content-length is | 1931 // When request.upload_data_stream is NULL for post, content-length is |
1948 // expected to be 0. | 1932 // expected to be 0. |
1949 SpdyHeaderBlock req_block( | 1933 SpdyHeaderBlock req_block( |
1950 spdy_util_.ConstructPostHeaderBlock(GetDefaultUrl(), 0)); | 1934 spdy_util_.ConstructPostHeaderBlock(kDefaultUrl, 0)); |
1951 std::unique_ptr<SpdySerializedFrame> req( | 1935 std::unique_ptr<SpdySerializedFrame> req( |
1952 spdy_util_.ConstructSpdySyn(1, std::move(req_block), LOWEST, true)); | 1936 spdy_util_.ConstructSpdySyn(1, std::move(req_block), LOWEST, true)); |
1953 | 1937 |
1954 MockWrite writes[] = { | 1938 MockWrite writes[] = { |
1955 CreateMockWrite(*req, 0), | 1939 CreateMockWrite(*req, 0), |
1956 }; | 1940 }; |
1957 | 1941 |
1958 std::unique_ptr<SpdySerializedFrame> resp( | 1942 std::unique_ptr<SpdySerializedFrame> resp( |
1959 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); | 1943 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); |
1960 std::unique_ptr<SpdySerializedFrame> body( | 1944 std::unique_ptr<SpdySerializedFrame> body( |
(...skipping 18 matching lines...) Expand all Loading... | |
1979 // Test that a simple POST works. | 1963 // Test that a simple POST works. |
1980 TEST_P(SpdyNetworkTransactionTest, EmptyPost) { | 1964 TEST_P(SpdyNetworkTransactionTest, EmptyPost) { |
1981 BufferedSpdyFramer framer(spdy_util_.spdy_version()); | 1965 BufferedSpdyFramer framer(spdy_util_.spdy_version()); |
1982 // Create an empty UploadDataStream. | 1966 // Create an empty UploadDataStream. |
1983 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 1967 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
1984 ElementsUploadDataStream stream(std::move(element_readers), 0); | 1968 ElementsUploadDataStream stream(std::move(element_readers), 0); |
1985 | 1969 |
1986 // Setup the request | 1970 // Setup the request |
1987 HttpRequestInfo request; | 1971 HttpRequestInfo request; |
1988 request.method = "POST"; | 1972 request.method = "POST"; |
1989 request.url = GURL(GetDefaultUrl()); | 1973 request.url = default_url_; |
1990 request.upload_data_stream = &stream; | 1974 request.upload_data_stream = &stream; |
1991 | 1975 |
1992 const uint64_t kContentLength = 0; | 1976 const uint64_t kContentLength = 0; |
1993 | 1977 |
1994 SpdyHeaderBlock req_block( | 1978 SpdyHeaderBlock req_block( |
1995 spdy_util_.ConstructPostHeaderBlock(GetDefaultUrl(), kContentLength)); | 1979 spdy_util_.ConstructPostHeaderBlock(kDefaultUrl, kContentLength)); |
1996 std::unique_ptr<SpdySerializedFrame> req( | 1980 std::unique_ptr<SpdySerializedFrame> req( |
1997 spdy_util_.ConstructSpdySyn(1, std::move(req_block), LOWEST, true)); | 1981 spdy_util_.ConstructSpdySyn(1, std::move(req_block), LOWEST, true)); |
1998 | 1982 |
1999 MockWrite writes[] = { | 1983 MockWrite writes[] = { |
2000 CreateMockWrite(*req, 0), | 1984 CreateMockWrite(*req, 0), |
2001 }; | 1985 }; |
2002 | 1986 |
2003 std::unique_ptr<SpdySerializedFrame> resp( | 1987 std::unique_ptr<SpdySerializedFrame> resp( |
2004 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); | 1988 spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); |
2005 std::unique_ptr<SpdySerializedFrame> body( | 1989 std::unique_ptr<SpdySerializedFrame> body( |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2328 helper.ResetTrans(); | 2312 helper.ResetTrans(); |
2329 base::RunLoop().RunUntilIdle(); | 2313 base::RunLoop().RunUntilIdle(); |
2330 | 2314 |
2331 helper.VerifyDataConsumed(); | 2315 helper.VerifyDataConsumed(); |
2332 } | 2316 } |
2333 | 2317 |
2334 // Verify that the client can correctly deal with the user callback attempting | 2318 // Verify that the client can correctly deal with the user callback attempting |
2335 // to start another transaction on a session that is closing down. See | 2319 // to start another transaction on a session that is closing down. See |
2336 // http://crbug.com/47455 | 2320 // http://crbug.com/47455 |
2337 TEST_P(SpdyNetworkTransactionTest, StartTransactionOnReadCallback) { | 2321 TEST_P(SpdyNetworkTransactionTest, StartTransactionOnReadCallback) { |
2322 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN) | |
2323 return; | |
2324 | |
2338 std::unique_ptr<SpdySerializedFrame> req( | 2325 std::unique_ptr<SpdySerializedFrame> req( |
2339 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2326 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
2340 MockWrite writes[] = {CreateMockWrite(*req)}; | 2327 MockWrite writes[] = {CreateMockWrite(*req)}; |
2341 MockWrite writes2[] = {CreateMockWrite(*req, 0)}; | 2328 MockWrite writes2[] = {CreateMockWrite(*req, 0)}; |
2342 | 2329 |
2343 // The indicated length of this frame is longer than its actual length. When | 2330 // The indicated length of this frame is longer than its actual length. When |
2344 // the session receives an empty frame after this one, it shuts down the | 2331 // the session receives an empty frame after this one, it shuts down the |
2345 // session, and calls the read callback with the incomplete data. | 2332 // session, and calls the read callback with the incomplete data. |
2346 const uint8_t kGetBodyFrame2[] = { | 2333 const uint8_t kGetBodyFrame2[] = { |
2347 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, | 2334 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, |
(...skipping 29 matching lines...) Expand all Loading... | |
2377 TestCompletionCallback callback; | 2364 TestCompletionCallback callback; |
2378 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 2365 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
2379 EXPECT_EQ(ERR_IO_PENDING, rv); | 2366 EXPECT_EQ(ERR_IO_PENDING, rv); |
2380 rv = callback.WaitForResult(); | 2367 rv = callback.WaitForResult(); |
2381 | 2368 |
2382 const int kSize = 3000; | 2369 const int kSize = 3000; |
2383 scoped_refptr<IOBuffer> buf(new IOBuffer(kSize)); | 2370 scoped_refptr<IOBuffer> buf(new IOBuffer(kSize)); |
2384 rv = trans->Read( | 2371 rv = trans->Read( |
2385 buf.get(), kSize, | 2372 buf.get(), kSize, |
2386 base::Bind(&SpdyNetworkTransactionTest::StartTransactionCallback, | 2373 base::Bind(&SpdyNetworkTransactionTest::StartTransactionCallback, |
2387 helper.session(), GURL(GetDefaultUrl()))); | 2374 helper.session(), default_url_)); |
2388 ASSERT_EQ(ERR_IO_PENDING, rv); | 2375 ASSERT_EQ(ERR_IO_PENDING, rv); |
2389 // This forces an err_IO_pending, which sets the callback. | 2376 // This forces an err_IO_pending, which sets the callback. |
2390 data.Resume(); | 2377 data.Resume(); |
2391 data.RunUntilPaused(); | 2378 data.RunUntilPaused(); |
2392 | 2379 |
2393 // This finishes the read. | 2380 // This finishes the read. |
2394 data.Resume(); | 2381 data.Resume(); |
2395 base::RunLoop().RunUntilIdle(); | 2382 base::RunLoop().RunUntilIdle(); |
2396 helper.VerifyDataConsumed(); | 2383 helper.VerifyDataConsumed(); |
2397 } | 2384 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2441 ASSERT_EQ(ERR_IO_PENDING, rv); | 2428 ASSERT_EQ(ERR_IO_PENDING, rv); |
2442 data.Resume(); | 2429 data.Resume(); |
2443 | 2430 |
2444 // Finish running rest of tasks. | 2431 // Finish running rest of tasks. |
2445 base::RunLoop().RunUntilIdle(); | 2432 base::RunLoop().RunUntilIdle(); |
2446 helper.VerifyDataConsumed(); | 2433 helper.VerifyDataConsumed(); |
2447 } | 2434 } |
2448 | 2435 |
2449 // Send a spdy request to www.example.org that gets redirected to www.foo.com. | 2436 // Send a spdy request to www.example.org that gets redirected to www.foo.com. |
2450 TEST_P(SpdyNetworkTransactionTest, DISABLED_RedirectGetRequest) { | 2437 TEST_P(SpdyNetworkTransactionTest, DISABLED_RedirectGetRequest) { |
2451 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(GetDefaultUrl())); | 2438 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(kDefaultUrl)); |
2452 headers["user-agent"] = ""; | 2439 headers["user-agent"] = ""; |
2453 headers["accept-encoding"] = "gzip, deflate"; | 2440 headers["accept-encoding"] = "gzip, deflate"; |
2454 | 2441 |
2455 // Setup writes/reads to www.example.org | 2442 // Setup writes/reads to www.example.org |
2456 std::unique_ptr<SpdySerializedFrame> req( | 2443 std::unique_ptr<SpdySerializedFrame> req( |
2457 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); | 2444 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); |
2458 std::unique_ptr<SpdySerializedFrame> resp( | 2445 std::unique_ptr<SpdySerializedFrame> resp( |
2459 spdy_util_.ConstructSpdyGetSynReplyRedirect(1)); | 2446 spdy_util_.ConstructSpdyGetSynReplyRedirect(1)); |
2460 MockWrite writes[] = { | 2447 MockWrite writes[] = { |
2461 CreateMockWrite(*req, 1), | 2448 CreateMockWrite(*req, 1), |
(...skipping 26 matching lines...) Expand all Loading... | |
2488 }; | 2475 }; |
2489 | 2476 |
2490 SequencedSocketData data2(reads2, arraysize(reads2), writes2, | 2477 SequencedSocketData data2(reads2, arraysize(reads2), writes2, |
2491 arraysize(writes2)); | 2478 arraysize(writes2)); |
2492 | 2479 |
2493 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2480 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
2494 TestDelegate d; | 2481 TestDelegate d; |
2495 { | 2482 { |
2496 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol); | 2483 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol); |
2497 std::unique_ptr<URLRequest> r(spdy_url_request_context.CreateRequest( | 2484 std::unique_ptr<URLRequest> r(spdy_url_request_context.CreateRequest( |
2498 GURL(GetDefaultUrl()), DEFAULT_PRIORITY, &d)); | 2485 default_url_, DEFAULT_PRIORITY, &d)); |
2499 spdy_url_request_context.socket_factory(). | 2486 spdy_url_request_context.socket_factory(). |
2500 AddSocketDataProvider(&data); | 2487 AddSocketDataProvider(&data); |
2501 spdy_url_request_context.socket_factory(). | 2488 spdy_url_request_context.socket_factory(). |
2502 AddSocketDataProvider(&data2); | 2489 AddSocketDataProvider(&data2); |
2503 | 2490 |
2504 d.set_quit_on_redirect(true); | 2491 d.set_quit_on_redirect(true); |
2505 r->Start(); | 2492 r->Start(); |
2506 base::RunLoop().Run(); | 2493 base::RunLoop().Run(); |
2507 | 2494 |
2508 EXPECT_EQ(1, d.received_redirect_count()); | 2495 EXPECT_EQ(1, d.received_redirect_count()); |
2509 | 2496 |
2510 r->FollowDeferredRedirect(); | 2497 r->FollowDeferredRedirect(); |
2511 base::RunLoop().Run(); | 2498 base::RunLoop().Run(); |
2512 EXPECT_EQ(1, d.response_started_count()); | 2499 EXPECT_EQ(1, d.response_started_count()); |
2513 EXPECT_FALSE(d.received_data_before_response()); | 2500 EXPECT_FALSE(d.received_data_before_response()); |
2514 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); | 2501 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); |
2515 std::string contents("hello!"); | 2502 std::string contents("hello!"); |
2516 EXPECT_EQ(contents, d.data_received()); | 2503 EXPECT_EQ(contents, d.data_received()); |
2517 } | 2504 } |
2518 EXPECT_TRUE(data.AllReadDataConsumed()); | 2505 EXPECT_TRUE(data.AllReadDataConsumed()); |
2519 EXPECT_TRUE(data.AllWriteDataConsumed()); | 2506 EXPECT_TRUE(data.AllWriteDataConsumed()); |
2520 EXPECT_TRUE(data2.AllReadDataConsumed()); | 2507 EXPECT_TRUE(data2.AllReadDataConsumed()); |
2521 EXPECT_TRUE(data2.AllWriteDataConsumed()); | 2508 EXPECT_TRUE(data2.AllWriteDataConsumed()); |
2522 } | 2509 } |
2523 | 2510 |
2524 // Send a spdy request to www.example.org. Get a pushed stream that redirects to | 2511 // Send a spdy request to www.example.org. Get a pushed stream that redirects to |
2525 // www.foo.com. | 2512 // www.foo.com. |
2526 TEST_P(SpdyNetworkTransactionTest, DISABLED_RedirectServerPush) { | 2513 TEST_P(SpdyNetworkTransactionTest, DISABLED_RedirectServerPush) { |
2527 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(GetDefaultUrl())); | 2514 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(kDefaultUrl)); |
2528 headers["user-agent"] = ""; | 2515 headers["user-agent"] = ""; |
2529 headers["accept-encoding"] = "gzip, deflate"; | 2516 headers["accept-encoding"] = "gzip, deflate"; |
2530 | 2517 |
2531 // Setup writes/reads to www.example.org | 2518 // Setup writes/reads to www.example.org |
2532 std::unique_ptr<SpdySerializedFrame> req( | 2519 std::unique_ptr<SpdySerializedFrame> req( |
2533 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); | 2520 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); |
2534 std::unique_ptr<SpdySerializedFrame> resp( | 2521 std::unique_ptr<SpdySerializedFrame> resp( |
2535 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 2522 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
2536 std::unique_ptr<SpdySerializedFrame> rep(spdy_util_.ConstructSpdyPush( | 2523 std::unique_ptr<SpdySerializedFrame> rep(spdy_util_.ConstructSpdyPush( |
2537 NULL, 0, 2, 1, GetDefaultUrlWithPath("/foo.dat").c_str(), | 2524 NULL, 0, 2, 1, GetDefaultUrlWithPath("/foo.dat").c_str(), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2574 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2561 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
2575 SequencedSocketData data2(reads2, arraysize(reads2), writes2, | 2562 SequencedSocketData data2(reads2, arraysize(reads2), writes2, |
2576 arraysize(writes2)); | 2563 arraysize(writes2)); |
2577 | 2564 |
2578 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2565 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
2579 TestDelegate d; | 2566 TestDelegate d; |
2580 TestDelegate d2; | 2567 TestDelegate d2; |
2581 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol); | 2568 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol); |
2582 { | 2569 { |
2583 std::unique_ptr<URLRequest> r(spdy_url_request_context.CreateRequest( | 2570 std::unique_ptr<URLRequest> r(spdy_url_request_context.CreateRequest( |
2584 GURL(GetDefaultUrl()), DEFAULT_PRIORITY, &d)); | 2571 default_url_, DEFAULT_PRIORITY, &d)); |
2585 spdy_url_request_context.socket_factory(). | 2572 spdy_url_request_context.socket_factory(). |
2586 AddSocketDataProvider(&data); | 2573 AddSocketDataProvider(&data); |
2587 | 2574 |
2588 r->Start(); | 2575 r->Start(); |
2589 base::RunLoop().Run(); | 2576 base::RunLoop().Run(); |
2590 | 2577 |
2591 EXPECT_EQ(0, d.received_redirect_count()); | 2578 EXPECT_EQ(0, d.received_redirect_count()); |
2592 std::string contents("hello!"); | 2579 std::string contents("hello!"); |
2593 EXPECT_EQ(contents, d.data_received()); | 2580 EXPECT_EQ(contents, d.data_received()); |
2594 | 2581 |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3282 test_cases[0].expected_headers["hello"] = "bye"; | 3269 test_cases[0].expected_headers["hello"] = "bye"; |
3283 test_cases[1].expected_headers["hello"] = "bye"; | 3270 test_cases[1].expected_headers["hello"] = "bye"; |
3284 test_cases[2].expected_headers["hello"] = "bye"; | 3271 test_cases[2].expected_headers["hello"] = "bye"; |
3285 | 3272 |
3286 test_cases[0].expected_headers["cookie"] = base::StringPiece("val1\0val2", 9); | 3273 test_cases[0].expected_headers["cookie"] = base::StringPiece("val1\0val2", 9); |
3287 test_cases[2].expected_headers["cookie"] = "val1,val2"; | 3274 test_cases[2].expected_headers["cookie"] = "val1,val2"; |
3288 | 3275 |
3289 for (size_t i = 0; i < arraysize(test_cases); ++i) { | 3276 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
3290 SpdyTestUtil spdy_test_util(GetParam().protocol, | 3277 SpdyTestUtil spdy_test_util(GetParam().protocol, |
3291 GetParam().priority_to_dependency); | 3278 GetParam().priority_to_dependency); |
3292 spdy_test_util.set_default_url(GURL(GetDefaultUrl())); | |
3293 std::unique_ptr<SpdySerializedFrame> req( | 3279 std::unique_ptr<SpdySerializedFrame> req( |
3294 spdy_test_util.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 3280 spdy_test_util.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
3295 MockWrite writes[] = {CreateMockWrite(*req, 0)}; | 3281 MockWrite writes[] = {CreateMockWrite(*req, 0)}; |
3296 | 3282 |
3297 std::unique_ptr<SpdySerializedFrame> resp( | 3283 std::unique_ptr<SpdySerializedFrame> resp( |
3298 spdy_test_util.ConstructSpdyGetSynReply(test_cases[i].extra_headers, | 3284 spdy_test_util.ConstructSpdyGetSynReply(test_cases[i].extra_headers, |
3299 test_cases[i].num_headers, 1)); | 3285 test_cases[i].num_headers, 1)); |
3300 std::unique_ptr<SpdySerializedFrame> body( | 3286 std::unique_ptr<SpdySerializedFrame> body( |
3301 spdy_test_util.ConstructSpdyBodyFrame(1, true)); | 3287 spdy_test_util.ConstructSpdyBodyFrame(1, true)); |
3302 MockRead reads[] = { | 3288 MockRead reads[] = { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3372 true, | 3358 true, |
3373 {2, 4}, | 3359 {2, 4}, |
3374 {{"friend", "barney", "enemy", "snaggletooth", NULL}, | 3360 {{"friend", "barney", "enemy", "snaggletooth", NULL}, |
3375 {spdy_util_.GetStatusKey(), "200", spdy_util_.GetPathKey(), | 3361 {spdy_util_.GetStatusKey(), "200", spdy_util_.GetPathKey(), |
3376 "/index.php", spdy_util_.GetVersionKey(), "HTTP/1.1", "vary", | 3362 "/index.php", spdy_util_.GetVersionKey(), "HTTP/1.1", "vary", |
3377 "friend,enemy", NULL}}}}; | 3363 "friend,enemy", NULL}}}}; |
3378 | 3364 |
3379 for (size_t i = 0; i < arraysize(test_cases); ++i) { | 3365 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
3380 SpdyTestUtil spdy_test_util(GetParam().protocol, | 3366 SpdyTestUtil spdy_test_util(GetParam().protocol, |
3381 GetParam().priority_to_dependency); | 3367 GetParam().priority_to_dependency); |
3382 spdy_test_util.set_default_url(GURL(GetDefaultUrl())); | |
3383 | 3368 |
3384 // Construct the request. | 3369 // Construct the request. |
3385 std::unique_ptr<SpdySerializedFrame> frame_req( | 3370 std::unique_ptr<SpdySerializedFrame> frame_req( |
3386 spdy_test_util.ConstructSpdyGet(test_cases[i].extra_headers[0], | 3371 spdy_test_util.ConstructSpdyGet(test_cases[i].extra_headers[0], |
3387 test_cases[i].num_headers[0], 1, LOWEST, | 3372 test_cases[i].num_headers[0], 1, LOWEST, |
3388 true)); | 3373 true)); |
3389 | 3374 |
3390 MockWrite writes[] = { | 3375 MockWrite writes[] = { |
3391 CreateMockWrite(*frame_req, 0), | 3376 CreateMockWrite(*frame_req, 0), |
3392 }; | 3377 }; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3470 }, | 3455 }, |
3471 // SYN_REPLY with no headers | 3456 // SYN_REPLY with no headers |
3472 { | 3457 { |
3473 0, {NULL}, | 3458 0, {NULL}, |
3474 }, | 3459 }, |
3475 }; | 3460 }; |
3476 | 3461 |
3477 for (size_t i = 0; i < arraysize(test_cases); ++i) { | 3462 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
3478 SpdyTestUtil spdy_test_util(GetParam().protocol, | 3463 SpdyTestUtil spdy_test_util(GetParam().protocol, |
3479 GetParam().priority_to_dependency); | 3464 GetParam().priority_to_dependency); |
3480 spdy_test_util.set_default_url(GURL(GetDefaultUrl())); | |
3481 | 3465 |
3482 std::unique_ptr<SpdySerializedFrame> req( | 3466 std::unique_ptr<SpdySerializedFrame> req( |
3483 spdy_test_util.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 3467 spdy_test_util.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
3484 std::unique_ptr<SpdySerializedFrame> rst( | 3468 std::unique_ptr<SpdySerializedFrame> rst( |
3485 spdy_test_util.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); | 3469 spdy_test_util.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); |
3486 MockWrite writes[] = { | 3470 MockWrite writes[] = { |
3487 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 2), | 3471 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 2), |
3488 }; | 3472 }; |
3489 | 3473 |
3490 // Construct the reply. | 3474 // Construct the reply. |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3757 | 3741 |
3758 base::ListValue* header_list; | 3742 base::ListValue* header_list; |
3759 ASSERT_TRUE(entries[pos].params.get()); | 3743 ASSERT_TRUE(entries[pos].params.get()); |
3760 ASSERT_TRUE(entries[pos].params->GetList("headers", &header_list)); | 3744 ASSERT_TRUE(entries[pos].params->GetList("headers", &header_list)); |
3761 | 3745 |
3762 std::vector<std::string> expected; | 3746 std::vector<std::string> expected; |
3763 expected.push_back(std::string(spdy_util_.GetHostKey()) + | 3747 expected.push_back(std::string(spdy_util_.GetHostKey()) + |
3764 ": www.example.org"); | 3748 ": www.example.org"); |
3765 expected.push_back(std::string(spdy_util_.GetPathKey()) + ": /"); | 3749 expected.push_back(std::string(spdy_util_.GetPathKey()) + ": /"); |
3766 expected.push_back(std::string(spdy_util_.GetSchemeKey()) + ": " + | 3750 expected.push_back(std::string(spdy_util_.GetSchemeKey()) + ": " + |
3767 spdy_util_.default_url().scheme()); | 3751 default_url_.scheme()); |
3768 expected.push_back(std::string(spdy_util_.GetMethodKey()) + ": GET"); | 3752 expected.push_back(std::string(spdy_util_.GetMethodKey()) + ": GET"); |
3769 expected.push_back("user-agent: Chrome"); | 3753 expected.push_back("user-agent: Chrome"); |
3770 if (spdy_util_.spdy_version() < HTTP2) { | 3754 if (spdy_util_.spdy_version() < HTTP2) { |
3771 // HTTP/2 eliminates use of the :version header. | 3755 // HTTP/2 eliminates use of the :version header. |
3772 expected.push_back(std::string(spdy_util_.GetVersionKey()) + ": HTTP/1.1"); | 3756 expected.push_back(std::string(spdy_util_.GetVersionKey()) + ": HTTP/1.1"); |
3773 } | 3757 } |
3774 EXPECT_EQ(expected.size(), header_list->GetSize()); | 3758 EXPECT_EQ(expected.size(), header_list->GetSize()); |
3775 for (std::vector<std::string>::const_iterator it = expected.begin(); | 3759 for (std::vector<std::string>::const_iterator it = expected.begin(); |
3776 it != expected.end(); | 3760 it != expected.end(); |
3777 ++it) { | 3761 ++it) { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4230 0, // Data Length | 4214 0, // Data Length |
4231 DATA_FLAG_NONE // Data Flags | 4215 DATA_FLAG_NONE // Data Flags |
4232 }; | 4216 }; |
4233 | 4217 |
4234 BoundNetLog net_log; | 4218 BoundNetLog net_log; |
4235 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 4219 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
4236 net_log, GetParam(), NULL); | 4220 net_log, GetParam(), NULL); |
4237 helper.RunPreTestSetup(); | 4221 helper.RunPreTestSetup(); |
4238 | 4222 |
4239 // Verify that no settings exist initially. | 4223 // Verify that no settings exist initially. |
4240 HostPortPair host_port_pair("www.example.org", helper.port()); | 4224 url::SchemeHostPort spdy_server(default_url_); |
4241 url::SchemeHostPort spdy_server("https", host_port_pair.host(), | |
4242 host_port_pair.port()); | |
4243 | |
4244 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4225 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
4245 EXPECT_TRUE(spdy_session_pool->http_server_properties() | 4226 EXPECT_TRUE(spdy_session_pool->http_server_properties() |
4246 ->GetSpdySettings(spdy_server) | 4227 ->GetSpdySettings(spdy_server) |
4247 .empty()); | 4228 .empty()); |
4248 | 4229 |
4249 // Construct the request. | 4230 // Construct the request. |
4250 std::unique_ptr<SpdySerializedFrame> req( | 4231 std::unique_ptr<SpdySerializedFrame> req( |
4251 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 4232 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
4252 MockWrite writes[] = {CreateMockWrite(*req, 0)}; | 4233 MockWrite writes[] = {CreateMockWrite(*req, 0)}; |
4253 | 4234 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4345 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 4326 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
4346 net_log, GetParam(), NULL); | 4327 net_log, GetParam(), NULL); |
4347 helper.RunPreTestSetup(); | 4328 helper.RunPreTestSetup(); |
4348 | 4329 |
4349 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4330 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
4350 | 4331 |
4351 SpdySessionPoolPeer pool_peer(spdy_session_pool); | 4332 SpdySessionPoolPeer pool_peer(spdy_session_pool); |
4352 pool_peer.SetEnableSendingInitialData(true); | 4333 pool_peer.SetEnableSendingInitialData(true); |
4353 | 4334 |
4354 // Verify that no settings exist initially. | 4335 // Verify that no settings exist initially. |
4355 HostPortPair host_port_pair("www.example.org", helper.port()); | 4336 url::SchemeHostPort spdy_server(default_url_); |
4356 url::SchemeHostPort spdy_server("https", host_port_pair.host(), | |
4357 host_port_pair.port()); | |
4358 EXPECT_TRUE(spdy_session_pool->http_server_properties() | 4337 EXPECT_TRUE(spdy_session_pool->http_server_properties() |
4359 ->GetSpdySettings(spdy_server) | 4338 ->GetSpdySettings(spdy_server) |
4360 .empty()); | 4339 .empty()); |
4361 | 4340 |
4362 const SpdySettingsIds kSampleId1 = SETTINGS_MAX_CONCURRENT_STREAMS; | 4341 const SpdySettingsIds kSampleId1 = SETTINGS_MAX_CONCURRENT_STREAMS; |
4363 unsigned int kSampleValue1 = 0x0a0a0a0a; | 4342 unsigned int kSampleValue1 = 0x0a0a0a0a; |
4364 const SpdySettingsIds kSampleId2 = SETTINGS_INITIAL_WINDOW_SIZE; | 4343 const SpdySettingsIds kSampleId2 = SETTINGS_INITIAL_WINDOW_SIZE; |
4365 unsigned int kSampleValue2 = 0x0c0c0c0c; | 4344 unsigned int kSampleValue2 = 0x0c0c0c0c; |
4366 | 4345 |
4367 // First add a persisted setting. | 4346 // First add a persisted setting. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4531 // HTTP_1_1_REQUIRED is only supported by HTTP/2. | 4510 // HTTP_1_1_REQUIRED is only supported by HTTP/2. |
4532 if (spdy_util_.spdy_version() < HTTP2) | 4511 if (spdy_util_.spdy_version() < HTTP2) |
4533 return; | 4512 return; |
4534 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is | 4513 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is |
4535 // only spoken over SSL. | 4514 // only spoken over SSL. |
4536 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN) | 4515 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN) |
4537 return; | 4516 return; |
4538 | 4517 |
4539 HttpRequestInfo request; | 4518 HttpRequestInfo request; |
4540 request.method = "GET"; | 4519 request.method = "GET"; |
4541 request.url = GURL("https://www.example.org/"); | 4520 request.url = default_url_; |
4542 std::unique_ptr<SpdySessionDependencies> session_deps( | 4521 std::unique_ptr<SpdySessionDependencies> session_deps( |
4543 CreateSpdySessionDependencies(GetParam())); | 4522 CreateSpdySessionDependencies(GetParam())); |
4544 // Do not force SPDY so that second socket can negotiate HTTP/1.1. | 4523 // Do not force SPDY so that second socket can negotiate HTTP/1.1. |
4545 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), | 4524 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), |
4546 GetParam(), std::move(session_deps)); | 4525 GetParam(), std::move(session_deps)); |
4547 | 4526 |
4548 // First socket: HTTP/2 request rejected with HTTP_1_1_REQUIRED. | 4527 // First socket: HTTP/2 request rejected with HTTP_1_1_REQUIRED. |
4549 const char* url = request.url.spec().c_str(); | 4528 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(kDefaultUrl)); |
4550 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(url)); | |
4551 std::unique_ptr<SpdySerializedFrame> req( | 4529 std::unique_ptr<SpdySerializedFrame> req( |
4552 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); | 4530 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); |
4553 MockWrite writes0[] = {CreateMockWrite(*req, 0)}; | 4531 MockWrite writes0[] = {CreateMockWrite(*req, 0)}; |
4554 std::unique_ptr<SpdySerializedFrame> go_away(spdy_util_.ConstructSpdyGoAway( | 4532 std::unique_ptr<SpdySerializedFrame> go_away(spdy_util_.ConstructSpdyGoAway( |
4555 0, GOAWAY_HTTP_1_1_REQUIRED, "Try again using HTTP/1.1 please.")); | 4533 0, GOAWAY_HTTP_1_1_REQUIRED, "Try again using HTTP/1.1 please.")); |
4556 MockRead reads0[] = {CreateMockRead(*go_away, 1)}; | 4534 MockRead reads0[] = {CreateMockRead(*go_away, 1)}; |
4557 SequencedSocketData data0(reads0, arraysize(reads0), writes0, | 4535 SequencedSocketData data0(reads0, arraysize(reads0), writes0, |
4558 arraysize(writes0)); | 4536 arraysize(writes0)); |
4559 | 4537 |
4560 std::unique_ptr<SSLSocketDataProvider> ssl_provider0( | 4538 std::unique_ptr<SSLSocketDataProvider> ssl_provider0( |
(...skipping 21 matching lines...) Expand all Loading... | |
4582 std::unique_ptr<SSLSocketDataProvider> ssl_provider1( | 4560 std::unique_ptr<SSLSocketDataProvider> ssl_provider1( |
4583 new SSLSocketDataProvider(ASYNC, OK)); | 4561 new SSLSocketDataProvider(ASYNC, OK)); |
4584 // Expect only HTTP/1.1 protocol in SSLConfig. | 4562 // Expect only HTTP/1.1 protocol in SSLConfig. |
4585 ssl_provider1->next_protos_expected_in_ssl_config.push_back(kProtoHTTP11); | 4563 ssl_provider1->next_protos_expected_in_ssl_config.push_back(kProtoHTTP11); |
4586 // Force HTTP/1.1. | 4564 // Force HTTP/1.1. |
4587 ssl_provider1->SetNextProto(kProtoHTTP11); | 4565 ssl_provider1->SetNextProto(kProtoHTTP11); |
4588 helper.AddDataWithSSLSocketDataProvider(&data1, std::move(ssl_provider1)); | 4566 helper.AddDataWithSSLSocketDataProvider(&data1, std::move(ssl_provider1)); |
4589 | 4567 |
4590 HttpServerProperties* http_server_properties = | 4568 HttpServerProperties* http_server_properties = |
4591 helper.session()->spdy_session_pool()->http_server_properties(); | 4569 helper.session()->spdy_session_pool()->http_server_properties(); |
4592 const HostPortPair host_port_pair = HostPortPair::FromURL(GURL(url)); | 4570 EXPECT_FALSE(http_server_properties->RequiresHTTP11(host_port_pair_)); |
4593 EXPECT_FALSE(http_server_properties->RequiresHTTP11(host_port_pair)); | |
4594 | 4571 |
4595 helper.RunPreTestSetup(); | 4572 helper.RunPreTestSetup(); |
4596 helper.StartDefaultTest(); | 4573 helper.StartDefaultTest(); |
4597 helper.FinishDefaultTestWithoutVerification(); | 4574 helper.FinishDefaultTestWithoutVerification(); |
4598 helper.VerifyDataConsumed(); | 4575 helper.VerifyDataConsumed(); |
4599 EXPECT_TRUE(http_server_properties->RequiresHTTP11(host_port_pair)); | 4576 EXPECT_TRUE(http_server_properties->RequiresHTTP11(host_port_pair_)); |
4600 | 4577 |
4601 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); | 4578 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); |
4602 ASSERT_TRUE(response); | 4579 ASSERT_TRUE(response); |
4603 ASSERT_TRUE(response->headers); | 4580 ASSERT_TRUE(response->headers); |
4604 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4581 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
4605 EXPECT_FALSE(response->was_fetched_via_spdy); | 4582 EXPECT_FALSE(response->was_fetched_via_spdy); |
4606 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, response->connection_info); | 4583 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, response->connection_info); |
4607 EXPECT_TRUE(response->was_npn_negotiated); | 4584 EXPECT_TRUE(response->was_npn_negotiated); |
4608 EXPECT_TRUE(request.url.SchemeIs("https")); | 4585 EXPECT_TRUE(request.url.SchemeIs("https")); |
4609 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 4586 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
(...skipping 10 matching lines...) Expand all Loading... | |
4620 // HTTP_1_1_REQUIRED is only supported by HTTP/2. | 4597 // HTTP_1_1_REQUIRED is only supported by HTTP/2. |
4621 if (spdy_util_.spdy_version() < HTTP2) | 4598 if (spdy_util_.spdy_version() < HTTP2) |
4622 return; | 4599 return; |
4623 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is | 4600 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is |
4624 // only spoken over SSL. | 4601 // only spoken over SSL. |
4625 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN) | 4602 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN) |
4626 return; | 4603 return; |
4627 | 4604 |
4628 HttpRequestInfo request; | 4605 HttpRequestInfo request; |
4629 request.method = "GET"; | 4606 request.method = "GET"; |
4630 request.url = GURL("https://www.example.org/"); | 4607 request.url = default_url_; |
4631 std::unique_ptr<SpdySessionDependencies> session_deps( | 4608 std::unique_ptr<SpdySessionDependencies> session_deps( |
4632 CreateSpdySessionDependencies( | 4609 CreateSpdySessionDependencies( |
4633 GetParam(), | 4610 GetParam(), |
4634 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"))); | 4611 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"))); |
4635 // Do not force SPDY so that second socket can negotiate HTTP/1.1. | 4612 // Do not force SPDY so that second socket can negotiate HTTP/1.1. |
4636 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), | 4613 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), |
4637 GetParam(), std::move(session_deps)); | 4614 GetParam(), std::move(session_deps)); |
4638 | 4615 |
4639 // First socket: HTTP/2 CONNECT rejected with HTTP_1_1_REQUIRED. | 4616 // First socket: HTTP/2 CONNECT rejected with HTTP_1_1_REQUIRED. |
4640 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyConnect( | 4617 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyConnect( |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4829 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4806 const HttpResponseInfo* response = trans->GetResponseInfo(); |
4830 EXPECT_TRUE(response->headers); | 4807 EXPECT_TRUE(response->headers); |
4831 EXPECT_TRUE(response->was_fetched_via_spdy); | 4808 EXPECT_TRUE(response->was_fetched_via_spdy); |
4832 out.rv = ReadTransaction(trans, &out.response_data); | 4809 out.rv = ReadTransaction(trans, &out.response_data); |
4833 EXPECT_EQ(OK, out.rv); | 4810 EXPECT_EQ(OK, out.rv); |
4834 out.status_line = response->headers->GetStatusLine(); | 4811 out.status_line = response->headers->GetStatusLine(); |
4835 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 4812 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
4836 EXPECT_EQ("hello!", out.response_data); | 4813 EXPECT_EQ("hello!", out.response_data); |
4837 | 4814 |
4838 // Check that the SpdySession is still in the SpdySessionPool. | 4815 // Check that the SpdySession is still in the SpdySessionPool. |
4839 HostPortPair host_port_pair("www.example.org", helper.port()); | 4816 SpdySessionKey session_pool_key_direct(host_port_pair_, ProxyServer::Direct(), |
4840 SpdySessionKey session_pool_key_direct( | 4817 PRIVACY_MODE_DISABLED); |
4841 host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); | |
4842 EXPECT_TRUE(HasSpdySession(spdy_session_pool, session_pool_key_direct)); | 4818 EXPECT_TRUE(HasSpdySession(spdy_session_pool, session_pool_key_direct)); |
4843 SpdySessionKey session_pool_key_proxy( | 4819 SpdySessionKey session_pool_key_proxy( |
4844 host_port_pair, | 4820 host_port_pair_, |
4845 ProxyServer::FromURI("www.foo.com", ProxyServer::SCHEME_HTTP), | 4821 ProxyServer::FromURI("www.foo.com", ProxyServer::SCHEME_HTTP), |
4846 PRIVACY_MODE_DISABLED); | 4822 PRIVACY_MODE_DISABLED); |
4847 EXPECT_FALSE(HasSpdySession(spdy_session_pool, session_pool_key_proxy)); | 4823 EXPECT_FALSE(HasSpdySession(spdy_session_pool, session_pool_key_proxy)); |
4848 | 4824 |
4849 // New SpdyTestUtil instance for the session that will be used for the | 4825 // New SpdyTestUtil instance for the session that will be used for the |
4850 // proxy connection. | 4826 // proxy connection. |
4851 SpdyTestUtil spdy_util_2(GetParam().protocol, | 4827 SpdyTestUtil spdy_util_2(GetParam().protocol, |
4852 GetParam().priority_to_dependency); | 4828 GetParam().priority_to_dependency); |
4853 | 4829 |
4854 // Set up data for the proxy connection. | 4830 // Set up data for the proxy connection. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4916 EXPECT_EQ("hello!", response_data); | 4892 EXPECT_EQ("hello!", response_data); |
4917 | 4893 |
4918 helper_proxy.VerifyDataConsumed(); | 4894 helper_proxy.VerifyDataConsumed(); |
4919 } | 4895 } |
4920 | 4896 |
4921 // When we get a TCP-level RST, we need to retry a HttpNetworkTransaction | 4897 // When we get a TCP-level RST, we need to retry a HttpNetworkTransaction |
4922 // on a new connection, if the connection was previously known to be good. | 4898 // on a new connection, if the connection was previously known to be good. |
4923 // This can happen when a server reboots without saying goodbye, or when | 4899 // This can happen when a server reboots without saying goodbye, or when |
4924 // we're behind a NAT that masked the RST. | 4900 // we're behind a NAT that masked the RST. |
4925 TEST_P(SpdyNetworkTransactionTest, VerifyRetryOnConnectionReset) { | 4901 TEST_P(SpdyNetworkTransactionTest, VerifyRetryOnConnectionReset) { |
4902 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN) | |
4903 return; | |
4926 std::unique_ptr<SpdySerializedFrame> resp( | 4904 std::unique_ptr<SpdySerializedFrame> resp( |
4927 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 4905 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
4928 std::unique_ptr<SpdySerializedFrame> body( | 4906 std::unique_ptr<SpdySerializedFrame> body( |
4929 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 4907 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
4930 MockRead reads[] = { | 4908 MockRead reads[] = { |
4931 CreateMockRead(*resp, 1), | 4909 CreateMockRead(*resp, 1), |
4932 CreateMockRead(*body, 2), | 4910 CreateMockRead(*body, 2), |
4933 MockRead(ASYNC, ERR_IO_PENDING, 3), | 4911 MockRead(ASYNC, ERR_IO_PENDING, 3), |
4934 MockRead(ASYNC, ERR_CONNECTION_RESET, 4), | 4912 MockRead(ASYNC, ERR_CONNECTION_RESET, 4), |
4935 }; | 4913 }; |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5789 helper.RunPreTestSetup(); | 5767 helper.RunPreTestSetup(); |
5790 helper.AddData(&data); | 5768 helper.AddData(&data); |
5791 | 5769 |
5792 HttpNetworkTransaction* trans0 = helper.trans(); | 5770 HttpNetworkTransaction* trans0 = helper.trans(); |
5793 TestCompletionCallback callback0; | 5771 TestCompletionCallback callback0; |
5794 int rv = trans0->Start(&request, callback0.callback(), log); | 5772 int rv = trans0->Start(&request, callback0.callback(), log); |
5795 rv = callback0.GetResult(rv); | 5773 rv = callback0.GetResult(rv); |
5796 EXPECT_EQ(OK, rv); | 5774 EXPECT_EQ(OK, rv); |
5797 | 5775 |
5798 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 5776 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
5799 HostPortPair host_port_pair("www.example.org", 443); | 5777 SpdySessionKey key(host_port_pair_, ProxyServer::Direct(), |
5800 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | |
5801 PRIVACY_MODE_DISABLED); | 5778 PRIVACY_MODE_DISABLED); |
5802 base::WeakPtr<SpdySession> spdy_session = | 5779 base::WeakPtr<SpdySession> spdy_session = |
5803 spdy_session_pool->FindAvailableSession(key, GURL(), log); | 5780 spdy_session_pool->FindAvailableSession(key, GURL(), log); |
5804 | 5781 |
5805 EXPECT_FALSE(spdy_session->unclaimed_pushed_streams_.empty()); | 5782 EXPECT_FALSE(spdy_session->unclaimed_pushed_streams_.empty()); |
5806 EXPECT_EQ(1u, spdy_session->unclaimed_pushed_streams_.size()); | 5783 EXPECT_EQ(1u, spdy_session->unclaimed_pushed_streams_.size()); |
5807 EXPECT_EQ(1u, | 5784 EXPECT_EQ(1u, |
5808 spdy_session->unclaimed_pushed_streams_.count(GURL(url_to_push))); | 5785 spdy_session->unclaimed_pushed_streams_.count(GURL(url_to_push))); |
5809 | 5786 |
5810 std::unique_ptr<HttpNetworkTransaction> trans1( | 5787 std::unique_ptr<HttpNetworkTransaction> trans1( |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6240 // TODO(agayev): develop a socket data provider where both, reads and | 6217 // TODO(agayev): develop a socket data provider where both, reads and |
6241 // writes are ordered so that writing tests like these are easy and rewrite | 6218 // writes are ordered so that writing tests like these are easy and rewrite |
6242 // all these tests using it. Right now we are working around the | 6219 // all these tests using it. Right now we are working around the |
6243 // limitations as described above and it's not deterministic, tests may | 6220 // limitations as described above and it's not deterministic, tests may |
6244 // fail under specific circumstances. | 6221 // fail under specific circumstances. |
6245 TEST_P(SpdyNetworkTransactionTest, WindowUpdateReceived) { | 6222 TEST_P(SpdyNetworkTransactionTest, WindowUpdateReceived) { |
6246 static int kFrameCount = 2; | 6223 static int kFrameCount = 2; |
6247 std::unique_ptr<std::string> content( | 6224 std::unique_ptr<std::string> content( |
6248 new std::string(kMaxSpdyFrameChunkSize, 'a')); | 6225 new std::string(kMaxSpdyFrameChunkSize, 'a')); |
6249 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 6226 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
6250 GetDefaultUrl(), 1, kMaxSpdyFrameChunkSize * kFrameCount, LOWEST, NULL, | 6227 kDefaultUrl, 1, kMaxSpdyFrameChunkSize * kFrameCount, LOWEST, NULL, 0)); |
6251 0)); | |
6252 std::unique_ptr<SpdySerializedFrame> body(spdy_util_.ConstructSpdyBodyFrame( | 6228 std::unique_ptr<SpdySerializedFrame> body(spdy_util_.ConstructSpdyBodyFrame( |
6253 1, content->c_str(), content->size(), false)); | 6229 1, content->c_str(), content->size(), false)); |
6254 std::unique_ptr<SpdySerializedFrame> body_end( | 6230 std::unique_ptr<SpdySerializedFrame> body_end( |
6255 spdy_util_.ConstructSpdyBodyFrame(1, content->c_str(), content->size(), | 6231 spdy_util_.ConstructSpdyBodyFrame(1, content->c_str(), content->size(), |
6256 true)); | 6232 true)); |
6257 | 6233 |
6258 MockWrite writes[] = { | 6234 MockWrite writes[] = { |
6259 CreateMockWrite(*req, 0), | 6235 CreateMockWrite(*req, 0), |
6260 CreateMockWrite(*body, 1), | 6236 CreateMockWrite(*body, 1), |
6261 CreateMockWrite(*body_end, 2), | 6237 CreateMockWrite(*body_end, 2), |
(...skipping 24 matching lines...) Expand all Loading... | |
6286 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 6262 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
6287 for (int i = 0; i < kFrameCount; ++i) { | 6263 for (int i = 0; i < kFrameCount; ++i) { |
6288 element_readers.push_back(base::WrapUnique( | 6264 element_readers.push_back(base::WrapUnique( |
6289 new UploadBytesElementReader(content->c_str(), content->size()))); | 6265 new UploadBytesElementReader(content->c_str(), content->size()))); |
6290 } | 6266 } |
6291 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); | 6267 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
6292 | 6268 |
6293 // Setup the request | 6269 // Setup the request |
6294 HttpRequestInfo request; | 6270 HttpRequestInfo request; |
6295 request.method = "POST"; | 6271 request.method = "POST"; |
6296 request.url = GURL(GetDefaultUrl()); | 6272 request.url = default_url_; |
6297 request.upload_data_stream = &upload_data_stream; | 6273 request.upload_data_stream = &upload_data_stream; |
6298 | 6274 |
6299 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, | 6275 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, |
6300 BoundNetLog(), GetParam(), NULL); | 6276 BoundNetLog(), GetParam(), NULL); |
6301 helper.AddData(&data); | 6277 helper.AddData(&data); |
6302 helper.RunPreTestSetup(); | 6278 helper.RunPreTestSetup(); |
6303 | 6279 |
6304 HttpNetworkTransaction* trans = helper.trans(); | 6280 HttpNetworkTransaction* trans = helper.trans(); |
6305 | 6281 |
6306 TestCompletionCallback callback; | 6282 TestCompletionCallback callback; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6465 | 6441 |
6466 // Test that WINDOW_UPDATE frame causing overflow is handled correctly. | 6442 // Test that WINDOW_UPDATE frame causing overflow is handled correctly. |
6467 TEST_P(SpdyNetworkTransactionTest, WindowUpdateOverflow) { | 6443 TEST_P(SpdyNetworkTransactionTest, WindowUpdateOverflow) { |
6468 // Number of full frames we hope to write (but will not, used to | 6444 // Number of full frames we hope to write (but will not, used to |
6469 // set content-length header correctly) | 6445 // set content-length header correctly) |
6470 static int kFrameCount = 3; | 6446 static int kFrameCount = 3; |
6471 | 6447 |
6472 std::unique_ptr<std::string> content( | 6448 std::unique_ptr<std::string> content( |
6473 new std::string(kMaxSpdyFrameChunkSize, 'a')); | 6449 new std::string(kMaxSpdyFrameChunkSize, 'a')); |
6474 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 6450 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
6475 GetDefaultUrl(), 1, kMaxSpdyFrameChunkSize * kFrameCount, LOWEST, NULL, | 6451 kDefaultUrl, 1, kMaxSpdyFrameChunkSize * kFrameCount, LOWEST, NULL, 0)); |
6476 0)); | |
6477 std::unique_ptr<SpdySerializedFrame> body(spdy_util_.ConstructSpdyBodyFrame( | 6452 std::unique_ptr<SpdySerializedFrame> body(spdy_util_.ConstructSpdyBodyFrame( |
6478 1, content->c_str(), content->size(), false)); | 6453 1, content->c_str(), content->size(), false)); |
6479 std::unique_ptr<SpdySerializedFrame> rst( | 6454 std::unique_ptr<SpdySerializedFrame> rst( |
6480 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_FLOW_CONTROL_ERROR)); | 6455 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_FLOW_CONTROL_ERROR)); |
6481 | 6456 |
6482 // We're not going to write a data frame with FIN, we'll receive a bad | 6457 // We're not going to write a data frame with FIN, we'll receive a bad |
6483 // WINDOW_UPDATE while sending a request and will send a RST_STREAM frame. | 6458 // WINDOW_UPDATE while sending a request and will send a RST_STREAM frame. |
6484 MockWrite writes[] = { | 6459 MockWrite writes[] = { |
6485 CreateMockWrite(*req, 0), | 6460 CreateMockWrite(*req, 0), |
6486 CreateMockWrite(*body, 2), | 6461 CreateMockWrite(*body, 2), |
(...skipping 13 matching lines...) Expand all Loading... | |
6500 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 6475 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
6501 for (int i = 0; i < kFrameCount; ++i) { | 6476 for (int i = 0; i < kFrameCount; ++i) { |
6502 element_readers.push_back(base::WrapUnique( | 6477 element_readers.push_back(base::WrapUnique( |
6503 new UploadBytesElementReader(content->c_str(), content->size()))); | 6478 new UploadBytesElementReader(content->c_str(), content->size()))); |
6504 } | 6479 } |
6505 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); | 6480 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
6506 | 6481 |
6507 // Setup the request | 6482 // Setup the request |
6508 HttpRequestInfo request; | 6483 HttpRequestInfo request; |
6509 request.method = "POST"; | 6484 request.method = "POST"; |
6510 request.url = GURL(GetDefaultUrl()); | 6485 request.url = default_url_; |
6511 request.upload_data_stream = &upload_data_stream; | 6486 request.upload_data_stream = &upload_data_stream; |
6512 | 6487 |
6513 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, | 6488 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, |
6514 BoundNetLog(), GetParam(), NULL); | 6489 BoundNetLog(), GetParam(), NULL); |
6515 helper.RunPreTestSetup(); | 6490 helper.RunPreTestSetup(); |
6516 helper.AddData(&data); | 6491 helper.AddData(&data); |
6517 HttpNetworkTransaction* trans = helper.trans(); | 6492 HttpNetworkTransaction* trans = helper.trans(); |
6518 | 6493 |
6519 TestCompletionCallback callback; | 6494 TestCompletionCallback callback; |
6520 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6495 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6552 // Each upload data buffer consists of |num_frames_in_one_upload_buffer| | 6527 // Each upload data buffer consists of |num_frames_in_one_upload_buffer| |
6553 // frames, each with |kMaxSpdyFrameChunkSize| bytes except the last frame, | 6528 // frames, each with |kMaxSpdyFrameChunkSize| bytes except the last frame, |
6554 // which has kBufferSize % kMaxSpdyChunkSize bytes. | 6529 // which has kBufferSize % kMaxSpdyChunkSize bytes. |
6555 size_t num_frames_in_one_upload_buffer = | 6530 size_t num_frames_in_one_upload_buffer = |
6556 ceil(static_cast<double>(kBufferSize) / kMaxSpdyFrameChunkSize); | 6531 ceil(static_cast<double>(kBufferSize) / kMaxSpdyFrameChunkSize); |
6557 | 6532 |
6558 // Construct content for a data frame of maximum size. | 6533 // Construct content for a data frame of maximum size. |
6559 std::string content(kMaxSpdyFrameChunkSize, 'a'); | 6534 std::string content(kMaxSpdyFrameChunkSize, 'a'); |
6560 | 6535 |
6561 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 6536 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
6562 GetDefaultUrl(), 1, | 6537 kDefaultUrl, 1, |
6563 /*content_length=*/kBufferSize * num_upload_buffers + kUploadDataSize, | 6538 /*content_length=*/kBufferSize * num_upload_buffers + kUploadDataSize, |
6564 LOWEST, NULL, 0)); | 6539 LOWEST, NULL, 0)); |
6565 | 6540 |
6566 // Full frames. | 6541 // Full frames. |
6567 std::unique_ptr<SpdySerializedFrame> body1(spdy_util_.ConstructSpdyBodyFrame( | 6542 std::unique_ptr<SpdySerializedFrame> body1(spdy_util_.ConstructSpdyBodyFrame( |
6568 1, content.c_str(), content.size(), false)); | 6543 1, content.c_str(), content.size(), false)); |
6569 | 6544 |
6570 // Last frame in each upload data buffer. | 6545 // Last frame in each upload data buffer. |
6571 std::unique_ptr<SpdySerializedFrame> body2(spdy_util_.ConstructSpdyBodyFrame( | 6546 std::unique_ptr<SpdySerializedFrame> body2(spdy_util_.ConstructSpdyBodyFrame( |
6572 1, content.c_str(), kBufferSize % kMaxSpdyFrameChunkSize, false)); | 6547 1, content.c_str(), kBufferSize % kMaxSpdyFrameChunkSize, false)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6642 | 6617 |
6643 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 6618 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
6644 std::string upload_data_string(kBufferSize * num_upload_buffers, 'a'); | 6619 std::string upload_data_string(kBufferSize * num_upload_buffers, 'a'); |
6645 upload_data_string.append(kUploadData, kUploadDataSize); | 6620 upload_data_string.append(kUploadData, kUploadDataSize); |
6646 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( | 6621 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( |
6647 upload_data_string.c_str(), upload_data_string.size()))); | 6622 upload_data_string.c_str(), upload_data_string.size()))); |
6648 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); | 6623 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
6649 | 6624 |
6650 HttpRequestInfo request; | 6625 HttpRequestInfo request; |
6651 request.method = "POST"; | 6626 request.method = "POST"; |
6652 request.url = GURL(GetDefaultUrl()); | 6627 request.url = default_url_; |
6653 request.upload_data_stream = &upload_data_stream; | 6628 request.upload_data_stream = &upload_data_stream; |
6654 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), | 6629 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), |
6655 GetParam(), NULL); | 6630 GetParam(), NULL); |
6656 helper.AddData(&data); | 6631 helper.AddData(&data); |
6657 helper.RunPreTestSetup(); | 6632 helper.RunPreTestSetup(); |
6658 | 6633 |
6659 HttpNetworkTransaction* trans = helper.trans(); | 6634 HttpNetworkTransaction* trans = helper.trans(); |
6660 | 6635 |
6661 TestCompletionCallback callback; | 6636 TestCompletionCallback callback; |
6662 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6637 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6701 // Each upload data buffer consists of |num_frames_in_one_upload_buffer| | 6676 // Each upload data buffer consists of |num_frames_in_one_upload_buffer| |
6702 // frames, each with |kMaxSpdyFrameChunkSize| bytes except the last frame, | 6677 // frames, each with |kMaxSpdyFrameChunkSize| bytes except the last frame, |
6703 // which has kBufferSize % kMaxSpdyChunkSize bytes. | 6678 // which has kBufferSize % kMaxSpdyChunkSize bytes. |
6704 size_t num_frames_in_one_upload_buffer = | 6679 size_t num_frames_in_one_upload_buffer = |
6705 ceil(static_cast<double>(kBufferSize) / kMaxSpdyFrameChunkSize); | 6680 ceil(static_cast<double>(kBufferSize) / kMaxSpdyFrameChunkSize); |
6706 | 6681 |
6707 // Construct content for a data frame of maximum size. | 6682 // Construct content for a data frame of maximum size. |
6708 std::string content(kMaxSpdyFrameChunkSize, 'a'); | 6683 std::string content(kMaxSpdyFrameChunkSize, 'a'); |
6709 | 6684 |
6710 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 6685 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
6711 GetDefaultUrl(), 1, | 6686 kDefaultUrl, 1, |
6712 /*content_length=*/kBufferSize * num_upload_buffers + kUploadDataSize, | 6687 /*content_length=*/kBufferSize * num_upload_buffers + kUploadDataSize, |
6713 LOWEST, NULL, 0)); | 6688 LOWEST, NULL, 0)); |
6714 | 6689 |
6715 // Full frames. | 6690 // Full frames. |
6716 std::unique_ptr<SpdySerializedFrame> body1(spdy_util_.ConstructSpdyBodyFrame( | 6691 std::unique_ptr<SpdySerializedFrame> body1(spdy_util_.ConstructSpdyBodyFrame( |
6717 1, content.c_str(), content.size(), false)); | 6692 1, content.c_str(), content.size(), false)); |
6718 | 6693 |
6719 // Last frame in each upload data buffer. | 6694 // Last frame in each upload data buffer. |
6720 std::unique_ptr<SpdySerializedFrame> body2(spdy_util_.ConstructSpdyBodyFrame( | 6695 std::unique_ptr<SpdySerializedFrame> body2(spdy_util_.ConstructSpdyBodyFrame( |
6721 1, content.c_str(), kBufferSize % kMaxSpdyFrameChunkSize, false)); | 6696 1, content.c_str(), kBufferSize % kMaxSpdyFrameChunkSize, false)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6801 | 6776 |
6802 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 6777 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
6803 std::string upload_data_string(kBufferSize * num_upload_buffers, 'a'); | 6778 std::string upload_data_string(kBufferSize * num_upload_buffers, 'a'); |
6804 upload_data_string.append(kUploadData, kUploadDataSize); | 6779 upload_data_string.append(kUploadData, kUploadDataSize); |
6805 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( | 6780 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( |
6806 upload_data_string.c_str(), upload_data_string.size()))); | 6781 upload_data_string.c_str(), upload_data_string.size()))); |
6807 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); | 6782 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
6808 | 6783 |
6809 HttpRequestInfo request; | 6784 HttpRequestInfo request; |
6810 request.method = "POST"; | 6785 request.method = "POST"; |
6811 request.url = GURL(GetDefaultUrl()); | 6786 request.url = default_url_; |
6812 request.upload_data_stream = &upload_data_stream; | 6787 request.upload_data_stream = &upload_data_stream; |
6813 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, | 6788 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, |
6814 BoundNetLog(), GetParam(), NULL); | 6789 BoundNetLog(), GetParam(), NULL); |
6815 helper.RunPreTestSetup(); | 6790 helper.RunPreTestSetup(); |
6816 helper.AddData(&data); | 6791 helper.AddData(&data); |
6817 | 6792 |
6818 HttpNetworkTransaction* trans = helper.trans(); | 6793 HttpNetworkTransaction* trans = helper.trans(); |
6819 | 6794 |
6820 TestCompletionCallback callback; | 6795 TestCompletionCallback callback; |
6821 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6796 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6867 // Each upload data buffer consists of |num_frames_in_one_upload_buffer| | 6842 // Each upload data buffer consists of |num_frames_in_one_upload_buffer| |
6868 // frames, each with |kMaxSpdyFrameChunkSize| bytes except the last frame, | 6843 // frames, each with |kMaxSpdyFrameChunkSize| bytes except the last frame, |
6869 // which has kBufferSize % kMaxSpdyChunkSize bytes. | 6844 // which has kBufferSize % kMaxSpdyChunkSize bytes. |
6870 size_t num_frames_in_one_upload_buffer = | 6845 size_t num_frames_in_one_upload_buffer = |
6871 ceil(static_cast<double>(kBufferSize) / kMaxSpdyFrameChunkSize); | 6846 ceil(static_cast<double>(kBufferSize) / kMaxSpdyFrameChunkSize); |
6872 | 6847 |
6873 // Construct content for a data frame of maximum size. | 6848 // Construct content for a data frame of maximum size. |
6874 std::string content(kMaxSpdyFrameChunkSize, 'a'); | 6849 std::string content(kMaxSpdyFrameChunkSize, 'a'); |
6875 | 6850 |
6876 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 6851 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
6877 GetDefaultUrl(), 1, | 6852 kDefaultUrl, 1, |
6878 /*content_length=*/kBufferSize * num_upload_buffers + kUploadDataSize, | 6853 /*content_length=*/kBufferSize * num_upload_buffers + kUploadDataSize, |
6879 LOWEST, NULL, 0)); | 6854 LOWEST, NULL, 0)); |
6880 | 6855 |
6881 // Full frames. | 6856 // Full frames. |
6882 std::unique_ptr<SpdySerializedFrame> body1(spdy_util_.ConstructSpdyBodyFrame( | 6857 std::unique_ptr<SpdySerializedFrame> body1(spdy_util_.ConstructSpdyBodyFrame( |
6883 1, content.c_str(), content.size(), false)); | 6858 1, content.c_str(), content.size(), false)); |
6884 | 6859 |
6885 // Last frame in each upload data buffer. | 6860 // Last frame in each upload data buffer. |
6886 std::unique_ptr<SpdySerializedFrame> body2(spdy_util_.ConstructSpdyBodyFrame( | 6861 std::unique_ptr<SpdySerializedFrame> body2(spdy_util_.ConstructSpdyBodyFrame( |
6887 1, content.c_str(), kBufferSize % kMaxSpdyFrameChunkSize, false)); | 6862 1, content.c_str(), kBufferSize % kMaxSpdyFrameChunkSize, false)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6969 | 6944 |
6970 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 6945 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
6971 std::string upload_data_string(kBufferSize * num_upload_buffers, 'a'); | 6946 std::string upload_data_string(kBufferSize * num_upload_buffers, 'a'); |
6972 upload_data_string.append(kUploadData, kUploadDataSize); | 6947 upload_data_string.append(kUploadData, kUploadDataSize); |
6973 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( | 6948 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( |
6974 upload_data_string.c_str(), upload_data_string.size()))); | 6949 upload_data_string.c_str(), upload_data_string.size()))); |
6975 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); | 6950 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
6976 | 6951 |
6977 HttpRequestInfo request; | 6952 HttpRequestInfo request; |
6978 request.method = "POST"; | 6953 request.method = "POST"; |
6979 request.url = GURL(GetDefaultUrl()); | 6954 request.url = default_url_; |
6980 request.upload_data_stream = &upload_data_stream; | 6955 request.upload_data_stream = &upload_data_stream; |
6981 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, | 6956 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, |
6982 BoundNetLog(), GetParam(), NULL); | 6957 BoundNetLog(), GetParam(), NULL); |
6983 helper.RunPreTestSetup(); | 6958 helper.RunPreTestSetup(); |
6984 helper.AddData(&data); | 6959 helper.AddData(&data); |
6985 | 6960 |
6986 HttpNetworkTransaction* trans = helper.trans(); | 6961 HttpNetworkTransaction* trans = helper.trans(); |
6987 | 6962 |
6988 TestCompletionCallback callback; | 6963 TestCompletionCallback callback; |
6989 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6964 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7071 } | 7046 } |
7072 | 7047 |
7073 // Regression test for https://crbug.com/493348: request header exceeds 16 kB | 7048 // Regression test for https://crbug.com/493348: request header exceeds 16 kB |
7074 // and thus sent in multiple frames when using HTTP/2. | 7049 // and thus sent in multiple frames when using HTTP/2. |
7075 TEST_P(SpdyNetworkTransactionTest, LargeRequest) { | 7050 TEST_P(SpdyNetworkTransactionTest, LargeRequest) { |
7076 const std::string kKey("foo"); | 7051 const std::string kKey("foo"); |
7077 const std::string kValue(1 << 15, 'z'); | 7052 const std::string kValue(1 << 15, 'z'); |
7078 | 7053 |
7079 HttpRequestInfo request; | 7054 HttpRequestInfo request; |
7080 request.method = "GET"; | 7055 request.method = "GET"; |
7081 request.url = GURL(GetDefaultUrl()); | 7056 request.url = default_url_; |
7082 request.extra_headers.SetHeader(kKey, kValue); | 7057 request.extra_headers.SetHeader(kKey, kValue); |
7083 | 7058 |
7084 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(GetDefaultUrl())); | 7059 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(kDefaultUrl)); |
7085 headers[kKey] = kValue; | 7060 headers[kKey] = kValue; |
7086 std::unique_ptr<SpdySerializedFrame> req( | 7061 std::unique_ptr<SpdySerializedFrame> req( |
7087 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); | 7062 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); |
7088 MockWrite writes[] = { | 7063 MockWrite writes[] = { |
7089 CreateMockWrite(*req, 0), | 7064 CreateMockWrite(*req, 0), |
7090 }; | 7065 }; |
7091 | 7066 |
7092 std::unique_ptr<SpdySerializedFrame> resp( | 7067 std::unique_ptr<SpdySerializedFrame> resp( |
7093 spdy_util_.ConstructSpdyGetSynReply(nullptr, 0, 1)); | 7068 spdy_util_.ConstructSpdyGetSynReply(nullptr, 0, 1)); |
7094 std::unique_ptr<SpdySerializedFrame> body( | 7069 std::unique_ptr<SpdySerializedFrame> body( |
(...skipping 10 matching lines...) Expand all Loading... | |
7105 helper.RunToCompletion(&data); | 7080 helper.RunToCompletion(&data); |
7106 TransactionHelperResult out = helper.output(); | 7081 TransactionHelperResult out = helper.output(); |
7107 | 7082 |
7108 EXPECT_EQ(OK, out.rv); | 7083 EXPECT_EQ(OK, out.rv); |
7109 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 7084 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
7110 EXPECT_EQ("hello!", out.response_data); | 7085 EXPECT_EQ("hello!", out.response_data); |
7111 } | 7086 } |
7112 | 7087 |
7113 // Regression test for https://crbug.com/535629: response header exceeds 16 kB. | 7088 // Regression test for https://crbug.com/535629: response header exceeds 16 kB. |
7114 TEST_P(SpdyNetworkTransactionTest, LargeResponseHeader) { | 7089 TEST_P(SpdyNetworkTransactionTest, LargeResponseHeader) { |
7115 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(GetDefaultUrl())); | 7090 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(kDefaultUrl)); |
7116 std::unique_ptr<SpdySerializedFrame> req( | 7091 std::unique_ptr<SpdySerializedFrame> req( |
7117 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); | 7092 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true)); |
7118 MockWrite writes[] = { | 7093 MockWrite writes[] = { |
7119 CreateMockWrite(*req, 0), | 7094 CreateMockWrite(*req, 0), |
7120 }; | 7095 }; |
7121 | 7096 |
7122 // HPACK decoder implementation limits string literal length to 16 kB. | 7097 // HPACK decoder implementation limits string literal length to 16 kB. |
7123 const char* response_headers[2]; | 7098 const char* response_headers[2]; |
7124 const std::string kKey(16 * 1024, 'a'); | 7099 const std::string kKey(16 * 1024, 'a'); |
7125 response_headers[0] = kKey.data(); | 7100 response_headers[0] = kKey.data(); |
7126 const std::string kValue(16 * 1024, 'b'); | 7101 const std::string kValue(16 * 1024, 'b'); |
7127 response_headers[1] = kValue.data(); | 7102 response_headers[1] = kValue.data(); |
7128 | 7103 |
7129 std::unique_ptr<SpdySerializedFrame> resp( | 7104 std::unique_ptr<SpdySerializedFrame> resp( |
7130 spdy_util_.ConstructSpdyGetSynReply(response_headers, 1, 1)); | 7105 spdy_util_.ConstructSpdyGetSynReply(response_headers, 1, 1)); |
7131 std::unique_ptr<SpdySerializedFrame> body( | 7106 std::unique_ptr<SpdySerializedFrame> body( |
7132 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 7107 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
7133 MockRead reads[] = { | 7108 MockRead reads[] = { |
7134 CreateMockRead(*resp, 1), CreateMockRead(*body, 2), | 7109 CreateMockRead(*resp, 1), CreateMockRead(*body, 2), |
7135 MockRead(ASYNC, 0, 3) // EOF | 7110 MockRead(ASYNC, 0, 3) // EOF |
7136 }; | 7111 }; |
7137 | 7112 |
7138 HttpRequestInfo request; | 7113 HttpRequestInfo request; |
7139 request.method = "GET"; | 7114 request.method = "GET"; |
7140 request.url = GURL(GetDefaultUrl()); | 7115 request.url = default_url_; |
7141 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), | 7116 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), |
7142 GetParam(), nullptr); | 7117 GetParam(), nullptr); |
7143 | 7118 |
7144 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 7119 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
7145 helper.RunToCompletion(&data); | 7120 helper.RunToCompletion(&data); |
7146 TransactionHelperResult out = helper.output(); | 7121 TransactionHelperResult out = helper.output(); |
7147 | 7122 |
7148 EXPECT_EQ(OK, out.rv); | 7123 EXPECT_EQ(OK, out.rv); |
7149 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 7124 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
7150 EXPECT_EQ("hello!", out.response_data); | 7125 EXPECT_EQ("hello!", out.response_data); |
(...skipping 17 matching lines...) Expand all Loading... | |
7168 MockRead reads[] = { | 7143 MockRead reads[] = { |
7169 CreateMockRead(*resp, 1), | 7144 CreateMockRead(*resp, 1), |
7170 CreateMockRead(*body, 2), | 7145 CreateMockRead(*body, 2), |
7171 MockRead(ASYNC, 0, 3) // EOF | 7146 MockRead(ASYNC, 0, 3) // EOF |
7172 }; | 7147 }; |
7173 | 7148 |
7174 SequencedSocketData data(reads, arraysize(reads), writes, | 7149 SequencedSocketData data(reads, arraysize(reads), writes, |
7175 arraysize(writes)); | 7150 arraysize(writes)); |
7176 HttpRequestInfo request; | 7151 HttpRequestInfo request; |
7177 request.method = "GET"; | 7152 request.method = "GET"; |
7178 request.url = GURL("https://www.example.org/"); | 7153 request.url = default_url_; |
7179 NormalSpdyTransactionHelper helper( | 7154 NormalSpdyTransactionHelper helper( |
7180 request, DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); | 7155 request, DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); |
7181 helper.RunToCompletionWithSSLData(&data, std::move(ssl_provider)); | 7156 helper.RunToCompletionWithSSLData(&data, std::move(ssl_provider)); |
7182 TransactionHelperResult out = helper.output(); | 7157 TransactionHelperResult out = helper.output(); |
7183 EXPECT_EQ(OK, out.rv); | 7158 EXPECT_EQ(OK, out.rv); |
7184 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 7159 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
7185 EXPECT_EQ("hello!", out.response_data); | 7160 EXPECT_EQ("hello!", out.response_data); |
7186 } | 7161 } |
7187 }; | 7162 }; |
7188 | 7163 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7222 protected: | 7197 protected: |
7223 void RunTLSUsageCheckTest( | 7198 void RunTLSUsageCheckTest( |
7224 std::unique_ptr<SSLSocketDataProvider> ssl_provider) { | 7199 std::unique_ptr<SSLSocketDataProvider> ssl_provider) { |
7225 std::unique_ptr<SpdySerializedFrame> goaway( | 7200 std::unique_ptr<SpdySerializedFrame> goaway( |
7226 spdy_util_.ConstructSpdyGoAway(0, GOAWAY_INADEQUATE_SECURITY, "")); | 7201 spdy_util_.ConstructSpdyGoAway(0, GOAWAY_INADEQUATE_SECURITY, "")); |
7227 MockWrite writes[] = {CreateMockWrite(*goaway)}; | 7202 MockWrite writes[] = {CreateMockWrite(*goaway)}; |
7228 | 7203 |
7229 StaticSocketDataProvider data(NULL, 0, writes, arraysize(writes)); | 7204 StaticSocketDataProvider data(NULL, 0, writes, arraysize(writes)); |
7230 HttpRequestInfo request; | 7205 HttpRequestInfo request; |
7231 request.method = "GET"; | 7206 request.method = "GET"; |
7232 request.url = GURL("https://www.example.org/"); | 7207 request.url = default_url_; |
7233 NormalSpdyTransactionHelper helper( | 7208 NormalSpdyTransactionHelper helper( |
7234 request, DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); | 7209 request, DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); |
7235 helper.RunToCompletionWithSSLData(&data, std::move(ssl_provider)); | 7210 helper.RunToCompletionWithSSLData(&data, std::move(ssl_provider)); |
7236 TransactionHelperResult out = helper.output(); | 7211 TransactionHelperResult out = helper.output(); |
7237 EXPECT_EQ(ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY, out.rv); | 7212 EXPECT_EQ(ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY, out.rv); |
7238 } | 7213 } |
7239 }; | 7214 }; |
7240 | 7215 |
7241 INSTANTIATE_TEST_CASE_P( | 7216 INSTANTIATE_TEST_CASE_P( |
7242 Spdy, | 7217 Spdy, |
(...skipping 17 matching lines...) Expand all Loading... | |
7260 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 7235 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
7261 std::unique_ptr<SSLSocketDataProvider> ssl_provider( | 7236 std::unique_ptr<SSLSocketDataProvider> ssl_provider( |
7262 new SSLSocketDataProvider(ASYNC, OK)); | 7237 new SSLSocketDataProvider(ASYNC, OK)); |
7263 // Set to TLS_RSA_WITH_NULL_MD5 | 7238 // Set to TLS_RSA_WITH_NULL_MD5 |
7264 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 7239 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
7265 | 7240 |
7266 RunTLSUsageCheckTest(std::move(ssl_provider)); | 7241 RunTLSUsageCheckTest(std::move(ssl_provider)); |
7267 } | 7242 } |
7268 | 7243 |
7269 } // namespace net | 7244 } // namespace net |
OLD | NEW |