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 6434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6445 // But the body is not yet fully sent (kUploadData is not yet sent) | 6445 // But the body is not yet fully sent (kUploadData is not yet sent) |
6446 // since we're send-stalled. | 6446 // since we're send-stalled. |
6447 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); | 6447 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
6448 | 6448 |
6449 // Read in WINDOW_UPDATE or SETTINGS frame. | 6449 // Read in WINDOW_UPDATE or SETTINGS frame. |
6450 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 9 : 8); | 6450 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 9 : 8); |
6451 rv = callback.WaitForResult(); | 6451 rv = callback.WaitForResult(); |
6452 helper.VerifyDataConsumed(); | 6452 helper.VerifyDataConsumed(); |
6453 } | 6453 } |
6454 | 6454 |
| 6455 TEST_P(SpdyNetworkTransactionTest, GoAwayOnOddPushStreamId) { |
| 6456 if (spdy_util_.spdy_version() < SPDY3) |
| 6457 return; |
| 6458 |
| 6459 scoped_ptr<SpdyHeaderBlock> push_headers(new SpdyHeaderBlock); |
| 6460 spdy_util_.AddUrlToHeaderBlock("http://www.google.com/a.dat", |
| 6461 push_headers.get()); |
| 6462 scoped_ptr<SpdyFrame> push( |
| 6463 spdy_util_.ConstructInitialSpdyPushFrame(push_headers.Pass(), 3, 1)); |
| 6464 MockRead reads[] = {CreateMockRead(*push, 1)}; |
| 6465 |
| 6466 scoped_ptr<SpdyFrame> req( |
| 6467 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 6468 scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway( |
| 6469 0, GOAWAY_PROTOCOL_ERROR, "Odd push stream id.")); |
| 6470 MockWrite writes[] = { |
| 6471 CreateMockWrite(*req, 0), CreateMockWrite(*goaway, 2), |
| 6472 }; |
| 6473 |
| 6474 DelayedSocketData data(1, reads, arraysize(reads), writes, arraysize(writes)); |
| 6475 NormalSpdyTransactionHelper helper( |
| 6476 CreateGetRequest(), DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); |
| 6477 helper.RunToCompletion(&data); |
| 6478 TransactionHelperResult out = helper.output(); |
| 6479 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); |
| 6480 } |
| 6481 |
| 6482 TEST_P(SpdyNetworkTransactionTest, |
| 6483 GoAwayOnPushStreamIdLesserOrEqualThanLastAccepted) { |
| 6484 if (spdy_util_.spdy_version() < SPDY3) |
| 6485 return; |
| 6486 |
| 6487 scoped_ptr<SpdyFrame> push_a(spdy_util_.ConstructSpdyPush( |
| 6488 NULL, 0, 4, 1, "http://www.google.com/a.dat")); |
| 6489 scoped_ptr<SpdyHeaderBlock> push_b_headers(new SpdyHeaderBlock); |
| 6490 spdy_util_.AddUrlToHeaderBlock("http://www.google.com/b.dat", |
| 6491 push_b_headers.get()); |
| 6492 scoped_ptr<SpdyFrame> push_b( |
| 6493 spdy_util_.ConstructInitialSpdyPushFrame(push_b_headers.Pass(), 2, 1)); |
| 6494 MockRead reads[] = { |
| 6495 CreateMockRead(*push_a, 1), CreateMockRead(*push_b, 2), |
| 6496 }; |
| 6497 |
| 6498 scoped_ptr<SpdyFrame> req( |
| 6499 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 6500 scoped_ptr<SpdyFrame> goaway(spdy_util_.ConstructSpdyGoAway( |
| 6501 4, |
| 6502 GOAWAY_PROTOCOL_ERROR, |
| 6503 "New push stream id must be greater than the last accepted.")); |
| 6504 MockWrite writes[] = { |
| 6505 CreateMockWrite(*req, 0), CreateMockWrite(*goaway, 3), |
| 6506 }; |
| 6507 |
| 6508 DelayedSocketData data(1, reads, arraysize(reads), writes, arraysize(writes)); |
| 6509 NormalSpdyTransactionHelper helper( |
| 6510 CreateGetRequest(), DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); |
| 6511 helper.RunToCompletion(&data); |
| 6512 TransactionHelperResult out = helper.output(); |
| 6513 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); |
| 6514 } |
| 6515 |
6455 class SpdyNetworkTransactionNoTLSUsageCheckTest | 6516 class SpdyNetworkTransactionNoTLSUsageCheckTest |
6456 : public SpdyNetworkTransactionTest { | 6517 : public SpdyNetworkTransactionTest { |
6457 protected: | 6518 protected: |
6458 void RunNoTLSUsageCheckTest(scoped_ptr<SSLSocketDataProvider> ssl_provider) { | 6519 void RunNoTLSUsageCheckTest(scoped_ptr<SSLSocketDataProvider> ssl_provider) { |
6459 // Construct the request. | 6520 // Construct the request. |
6460 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyGet( | 6521 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyGet( |
6461 "https://www.google.com/", false, 1, LOWEST)); | 6522 "https://www.google.com/", false, 1, LOWEST)); |
6462 MockWrite writes[] = {CreateMockWrite(*req)}; | 6523 MockWrite writes[] = {CreateMockWrite(*req)}; |
6463 | 6524 |
6464 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 6525 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6552 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6613 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6553 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6614 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
6554 new SSLSocketDataProvider(ASYNC, OK)); | 6615 new SSLSocketDataProvider(ASYNC, OK)); |
6555 // Set to TLS_RSA_WITH_NULL_MD5 | 6616 // Set to TLS_RSA_WITH_NULL_MD5 |
6556 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6617 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6557 | 6618 |
6558 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6619 RunTLSUsageCheckTest(ssl_provider.Pass()); |
6559 } | 6620 } |
6560 | 6621 |
6561 } // namespace net | 6622 } // namespace net |
OLD | NEW |