| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 5449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5460 }; | 5460 }; |
| 5461 | 5461 |
| 5462 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 5462 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 5463 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 5463 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 5464 BoundNetLog(), GetParam(), NULL); | 5464 BoundNetLog(), GetParam(), NULL); |
| 5465 helper.RunToCompletion(&data); | 5465 helper.RunToCompletion(&data); |
| 5466 TransactionHelperResult out = helper.output(); | 5466 TransactionHelperResult out = helper.output(); |
| 5467 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); | 5467 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); |
| 5468 } | 5468 } |
| 5469 | 5469 |
| 5470 TEST_P(SpdyNetworkTransactionTest, SynReplyWithLateHeaders) { | 5470 // Tests that receiving HEADERS, DATA, HEADERS, and DATA in that sequence will |
| 5471 // trigger a ERR_SPDY_PROTOCOL_ERROR because trailing HEADERS must not be |
| 5472 // followed by any DATA frames. |
| 5473 TEST_P(SpdyNetworkTransactionTest, SyncReplyDataAfterTrailers) { |
| 5471 scoped_ptr<SpdyFrame> req( | 5474 scoped_ptr<SpdyFrame> req( |
| 5472 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 5475 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 5473 scoped_ptr<SpdyFrame> rst( | 5476 scoped_ptr<SpdyFrame> rst( |
| 5474 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); | 5477 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR)); |
| 5475 MockWrite writes[] = { | 5478 MockWrite writes[] = { |
| 5476 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 4), | 5479 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 5), |
| 5477 }; | 5480 }; |
| 5478 | 5481 |
| 5479 scoped_ptr<SpdyFrame> stream1_reply( | 5482 scoped_ptr<SpdyFrame> stream1_reply( |
| 5480 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 5483 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 5481 | 5484 |
| 5482 scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); | 5485 scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); |
| 5483 (*late_headers)["hello"] = "bye"; | 5486 (*late_headers)["hello"] = "bye"; |
| 5484 scoped_ptr<SpdyFrame> stream1_headers( | 5487 scoped_ptr<SpdyFrame> stream1_headers( |
| 5485 spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), | 5488 spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), |
| 5486 false, | 5489 false, |
| 5487 1, | 5490 1, |
| 5488 LOWEST, | 5491 LOWEST, |
| 5489 HEADERS, | 5492 HEADERS, |
| 5490 CONTROL_FLAG_NONE, | 5493 CONTROL_FLAG_NONE, |
| 5491 0)); | 5494 0)); |
| 5492 scoped_ptr<SpdyFrame> stream1_body( | 5495 scoped_ptr<SpdyFrame> stream1_body( |
| 5493 spdy_util_.ConstructSpdyBodyFrame(1, false)); | 5496 spdy_util_.ConstructSpdyBodyFrame(1, false)); |
| 5494 scoped_ptr<SpdyFrame> stream1_body2( | 5497 scoped_ptr<SpdyFrame> stream1_body2( |
| 5495 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 5498 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 5496 MockRead reads[] = { | 5499 MockRead reads[] = { |
| 5497 CreateMockRead(*stream1_reply, 1), | 5500 CreateMockRead(*stream1_reply, 1), CreateMockRead(*stream1_body, 2), |
| 5498 CreateMockRead(*stream1_body, 2), | 5501 CreateMockRead(*stream1_headers, 3), CreateMockRead(*stream1_body2, 4), |
| 5499 CreateMockRead(*stream1_headers, 3), | |
| 5500 CreateMockRead(*stream1_body2, 5), | |
| 5501 MockRead(ASYNC, 0, 6) // EOF | 5502 MockRead(ASYNC, 0, 6) // EOF |
| 5502 }; | 5503 }; |
| 5503 | 5504 |
| 5504 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 5505 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 5505 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 5506 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 5506 BoundNetLog(), GetParam(), NULL); | 5507 BoundNetLog(), GetParam(), NULL); |
| 5507 helper.RunToCompletion(&data); | 5508 helper.RunToCompletion(&data); |
| 5508 TransactionHelperResult out = helper.output(); | 5509 TransactionHelperResult out = helper.output(); |
| 5509 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); | 5510 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); |
| 5510 } | 5511 } |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6629 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6630 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6630 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6631 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
| 6631 new SSLSocketDataProvider(ASYNC, OK)); | 6632 new SSLSocketDataProvider(ASYNC, OK)); |
| 6632 // Set to TLS_RSA_WITH_NULL_MD5 | 6633 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6633 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6634 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6634 | 6635 |
| 6635 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6636 RunTLSUsageCheckTest(ssl_provider.Pass()); |
| 6636 } | 6637 } |
| 6637 | 6638 |
| 6638 } // namespace net | 6639 } // namespace net |
| OLD | NEW |