| 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 5320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5331 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 5331 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); |
| 5332 | 5332 |
| 5333 // Read the final EOF (which will close the session) | 5333 // Read the final EOF (which will close the session) |
| 5334 data.RunFor(1); | 5334 data.RunFor(1); |
| 5335 | 5335 |
| 5336 // Verify that we consumed all test data. | 5336 // Verify that we consumed all test data. |
| 5337 EXPECT_TRUE(data.at_read_eof()); | 5337 EXPECT_TRUE(data.at_read_eof()); |
| 5338 EXPECT_TRUE(data.at_write_eof()); | 5338 EXPECT_TRUE(data.at_write_eof()); |
| 5339 } | 5339 } |
| 5340 | 5340 |
| 5341 // TODO(baranovich): HTTP 2 does not allow multiple HEADERS frames |
| 5341 TEST_P(SpdyNetworkTransactionTest, ServerPushWithTwoHeaderFrames) { | 5342 TEST_P(SpdyNetworkTransactionTest, ServerPushWithTwoHeaderFrames) { |
| 5342 // We push a stream and attempt to claim it before the headers come down. | 5343 // We push a stream and attempt to claim it before the headers come down. |
| 5343 scoped_ptr<SpdyFrame> stream1_syn( | 5344 scoped_ptr<SpdyFrame> stream1_syn( |
| 5344 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 5345 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 5345 scoped_ptr<SpdyFrame> stream1_body( | 5346 scoped_ptr<SpdyFrame> stream1_body( |
| 5346 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 5347 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 5347 MockWrite writes[] = { | 5348 MockWrite writes[] = { |
| 5348 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS), | 5349 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS), |
| 5349 }; | 5350 }; |
| 5350 | 5351 |
| 5351 scoped_ptr<SpdyHeaderBlock> initial_headers(new SpdyHeaderBlock()); | 5352 scoped_ptr<SpdyHeaderBlock> initial_headers(new SpdyHeaderBlock()); |
| 5353 (*initial_headers)["alpha"] = "beta"; |
| 5352 spdy_util_.AddUrlToHeaderBlock( | 5354 spdy_util_.AddUrlToHeaderBlock( |
| 5353 "http://www.google.com/foo.dat", initial_headers.get()); | 5355 "http://www.google.com/foo.dat", initial_headers.get()); |
| 5354 scoped_ptr<SpdyFrame> stream2_syn( | 5356 scoped_ptr<SpdyFrame> stream2_syn( |
| 5355 spdy_util_.ConstructSpdyControlFrame(initial_headers.Pass(), | 5357 spdy_util_.ConstructSpdyControlFrame(initial_headers.Pass(), |
| 5356 false, | 5358 false, |
| 5357 2, | 5359 2, |
| 5358 LOWEST, | 5360 LOWEST, |
| 5359 SYN_STREAM, | 5361 SYN_STREAM, |
| 5360 CONTROL_FLAG_NONE, | 5362 CONTROL_FLAG_NONE, |
| 5361 1)); | 5363 1)); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5458 VerifyStreamsClosed(helper); | 5460 VerifyStreamsClosed(helper); |
| 5459 | 5461 |
| 5460 // Verify the SYN_REPLY. | 5462 // Verify the SYN_REPLY. |
| 5461 EXPECT_TRUE(response.headers.get() != NULL); | 5463 EXPECT_TRUE(response.headers.get() != NULL); |
| 5462 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 5464 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
| 5463 | 5465 |
| 5464 // Verify the pushed stream. | 5466 // Verify the pushed stream. |
| 5465 EXPECT_TRUE(response2.headers.get() != NULL); | 5467 EXPECT_TRUE(response2.headers.get() != NULL); |
| 5466 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 5468 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); |
| 5467 | 5469 |
| 5468 // Verify we got all the headers | 5470 // Verify we got all the headers from all header blocks. |
| 5469 if (spdy_util_.spdy_version() < SPDY3) { | 5471 EXPECT_TRUE(response2.headers->HasHeaderValue("alpha", "beta")); |
| 5470 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5471 "url", | |
| 5472 "http://www.google.com/foo.dat")); | |
| 5473 } else { | |
| 5474 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5475 "scheme", "http")); | |
| 5476 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5477 "path", "/foo.dat")); | |
| 5478 if (spdy_util_.spdy_version() < SPDY4) { | |
| 5479 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5480 "host", "www.google.com")); | |
| 5481 } else { | |
| 5482 EXPECT_TRUE(response2.headers->HasHeaderValue( | |
| 5483 "authority", "www.google.com")); | |
| 5484 } | |
| 5485 } | |
| 5486 EXPECT_TRUE(response2.headers->HasHeaderValue("hello", "bye")); | 5472 EXPECT_TRUE(response2.headers->HasHeaderValue("hello", "bye")); |
| 5487 EXPECT_TRUE(response2.headers->HasHeaderValue("status", "200")); | 5473 EXPECT_TRUE(response2.headers->HasHeaderValue("status", "200")); |
| 5488 | 5474 |
| 5489 // Read the final EOF (which will close the session) | 5475 // Read the final EOF (which will close the session) |
| 5490 data.RunFor(1); | 5476 data.RunFor(1); |
| 5491 | 5477 |
| 5492 // Verify that we consumed all test data. | 5478 // Verify that we consumed all test data. |
| 5493 EXPECT_TRUE(data.at_read_eof()); | 5479 EXPECT_TRUE(data.at_read_eof()); |
| 5494 EXPECT_TRUE(data.at_write_eof()); | 5480 EXPECT_TRUE(data.at_write_eof()); |
| 5495 } | 5481 } |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6709 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6695 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6710 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6696 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
| 6711 new SSLSocketDataProvider(ASYNC, OK)); | 6697 new SSLSocketDataProvider(ASYNC, OK)); |
| 6712 // Set to TLS_RSA_WITH_NULL_MD5 | 6698 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6713 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6699 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6714 | 6700 |
| 6715 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6701 RunTLSUsageCheckTest(ssl_provider.Pass()); |
| 6716 } | 6702 } |
| 6717 | 6703 |
| 6718 } // namespace net | 6704 } // namespace net |
| OLD | NEW |