| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 5367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5378 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 5378 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); |
| 5379 | 5379 |
| 5380 // Read the final EOF (which will close the session) | 5380 // Read the final EOF (which will close the session) |
| 5381 data.RunFor(1); | 5381 data.RunFor(1); |
| 5382 | 5382 |
| 5383 // Verify that we consumed all test data. | 5383 // Verify that we consumed all test data. |
| 5384 EXPECT_TRUE(data.at_read_eof()); | 5384 EXPECT_TRUE(data.at_read_eof()); |
| 5385 EXPECT_TRUE(data.at_write_eof()); | 5385 EXPECT_TRUE(data.at_write_eof()); |
| 5386 } | 5386 } |
| 5387 | 5387 |
| 5388 // TODO(baranovich): HTTP 2 does not allow multiple HEADERS frames |
| 5388 TEST_P(SpdyNetworkTransactionTest, ServerPushWithTwoHeaderFrames) { | 5389 TEST_P(SpdyNetworkTransactionTest, ServerPushWithTwoHeaderFrames) { |
| 5389 // We push a stream and attempt to claim it before the headers come down. | 5390 // We push a stream and attempt to claim it before the headers come down. |
| 5390 scoped_ptr<SpdyFrame> stream1_syn( | 5391 scoped_ptr<SpdyFrame> stream1_syn( |
| 5391 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 5392 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 5392 scoped_ptr<SpdyFrame> stream1_body( | 5393 scoped_ptr<SpdyFrame> stream1_body( |
| 5393 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 5394 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 5394 MockWrite writes[] = { | 5395 MockWrite writes[] = { |
| 5395 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS), | 5396 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS), |
| 5396 }; | 5397 }; |
| 5397 | 5398 |
| 5398 scoped_ptr<SpdyHeaderBlock> initial_headers(new SpdyHeaderBlock()); | 5399 scoped_ptr<SpdyHeaderBlock> initial_headers(new SpdyHeaderBlock()); |
| 5400 (*initial_headers)["alpha"] = "beta"; |
| 5399 spdy_util_.AddUrlToHeaderBlock( | 5401 spdy_util_.AddUrlToHeaderBlock( |
| 5400 "http://www.google.com/foo.dat", initial_headers.get()); | 5402 "http://www.google.com/foo.dat", initial_headers.get()); |
| 5401 scoped_ptr<SpdyFrame> stream2_syn( | 5403 scoped_ptr<SpdyFrame> stream2_syn( |
| 5402 spdy_util_.ConstructSpdyControlFrame(initial_headers.Pass(), | 5404 spdy_util_.ConstructSpdyControlFrame(initial_headers.Pass(), |
| 5403 false, | 5405 false, |
| 5404 2, | 5406 2, |
| 5405 LOWEST, | 5407 LOWEST, |
| 5406 SYN_STREAM, | 5408 SYN_STREAM, |
| 5407 CONTROL_FLAG_NONE, | 5409 CONTROL_FLAG_NONE, |
| 5408 1)); | 5410 1)); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5505 VerifyStreamsClosed(helper); | 5507 VerifyStreamsClosed(helper); |
| 5506 | 5508 |
| 5507 // Verify the SYN_REPLY. | 5509 // Verify the SYN_REPLY. |
| 5508 EXPECT_TRUE(response.headers.get() != NULL); | 5510 EXPECT_TRUE(response.headers.get() != NULL); |
| 5509 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 5511 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
| 5510 | 5512 |
| 5511 // Verify the pushed stream. | 5513 // Verify the pushed stream. |
| 5512 EXPECT_TRUE(response2.headers.get() != NULL); | 5514 EXPECT_TRUE(response2.headers.get() != NULL); |
| 5513 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 5515 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); |
| 5514 | 5516 |
| 5515 // Verify we got all the headers | 5517 // Verify we got all the headers from all header blocks. |
| 5516 if (spdy_util_.spdy_version() < SPDY3) { | 5518 EXPECT_TRUE(response2.headers->HasHeaderValue("alpha", "beta")); |
| 5517 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5518 "url", | |
| 5519 "http://www.google.com/foo.dat")); | |
| 5520 } else { | |
| 5521 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5522 "scheme", "http")); | |
| 5523 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5524 "path", "/foo.dat")); | |
| 5525 if (spdy_util_.spdy_version() < SPDY4) { | |
| 5526 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5527 "host", "www.google.com")); | |
| 5528 } else { | |
| 5529 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5530 "authority", "www.google.com")); | |
| 5531 } | |
| 5532 } | |
| 5533 EXPECT_TRUE(response2.headers->HasHeaderValue("hello", "bye")); | 5519 EXPECT_TRUE(response2.headers->HasHeaderValue("hello", "bye")); |
| 5534 EXPECT_TRUE(response2.headers->HasHeaderValue("status", "200")); | 5520 EXPECT_TRUE(response2.headers->HasHeaderValue("status", "200")); |
| 5535 | 5521 |
| 5536 // Read the final EOF (which will close the session) | 5522 // Read the final EOF (which will close the session) |
| 5537 data.RunFor(1); | 5523 data.RunFor(1); |
| 5538 | 5524 |
| 5539 // Verify that we consumed all test data. | 5525 // Verify that we consumed all test data. |
| 5540 EXPECT_TRUE(data.at_read_eof()); | 5526 EXPECT_TRUE(data.at_read_eof()); |
| 5541 EXPECT_TRUE(data.at_write_eof()); | 5527 EXPECT_TRUE(data.at_write_eof()); |
| 5542 } | 5528 } |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6753 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6739 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6754 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6740 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
| 6755 new SSLSocketDataProvider(ASYNC, OK)); | 6741 new SSLSocketDataProvider(ASYNC, OK)); |
| 6756 // Set to TLS_RSA_WITH_NULL_MD5 | 6742 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6757 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6743 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6758 | 6744 |
| 6759 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6745 RunTLSUsageCheckTest(ssl_provider.Pass()); |
| 6760 } | 6746 } |
| 6761 | 6747 |
| 6762 } // namespace net | 6748 } // namespace net |
| OLD | NEW |