| 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 3630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3641 // SPDY4 treats a header decompression failure as a connection-level error. | 3641 // SPDY4 treats a header decompression failure as a connection-level error. |
| 3642 TEST_P(SpdyNetworkTransactionTest, CorruptFrameSessionErrorSpdy4) { | 3642 TEST_P(SpdyNetworkTransactionTest, CorruptFrameSessionErrorSpdy4) { |
| 3643 if (spdy_util_.spdy_version() < SPDY4) { | 3643 if (spdy_util_.spdy_version() < SPDY4) { |
| 3644 return; | 3644 return; |
| 3645 } | 3645 } |
| 3646 // This is the length field that's too short. | 3646 // This is the length field that's too short. |
| 3647 scoped_ptr<SpdyFrame> syn_reply_wrong_length( | 3647 scoped_ptr<SpdyFrame> syn_reply_wrong_length( |
| 3648 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3648 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 3649 BufferedSpdyFramer framer(spdy_util_.spdy_version(), false); | 3649 BufferedSpdyFramer framer(spdy_util_.spdy_version(), false); |
| 3650 size_t right_size = | 3650 size_t right_size = |
| 3651 (spdy_util_.spdy_version() < SPDY4) ? | 3651 syn_reply_wrong_length->size() - framer.GetControlFrameHeaderSize(); |
| 3652 syn_reply_wrong_length->size() - framer.GetControlFrameHeaderSize() : | |
| 3653 syn_reply_wrong_length->size(); | |
| 3654 size_t wrong_size = right_size - 4; | 3652 size_t wrong_size = right_size - 4; |
| 3655 test::SetFrameLength(syn_reply_wrong_length.get(), | 3653 test::SetFrameLength(syn_reply_wrong_length.get(), |
| 3656 wrong_size, | 3654 wrong_size, |
| 3657 spdy_util_.spdy_version()); | 3655 spdy_util_.spdy_version()); |
| 3658 | 3656 |
| 3659 // TODO(jgraettinger): SpdySession::OnError() should send a GOAWAY before | 3657 // TODO(jgraettinger): SpdySession::OnError() should send a GOAWAY before |
| 3660 // breaking the connection. | 3658 // breaking the connection. |
| 3661 scoped_ptr<SpdyFrame> req( | 3659 scoped_ptr<SpdyFrame> req( |
| 3662 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 3660 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 3663 MockWrite writes[] = { | 3661 MockWrite writes[] = { |
| 3664 CreateMockWrite(*req), | 3662 CreateMockWrite(*req), |
| 3665 }; | 3663 }; |
| 3666 | 3664 |
| 3667 scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 3665 scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 3668 MockRead reads[] = { | 3666 MockRead reads[] = { |
| 3669 MockRead(ASYNC, syn_reply_wrong_length->data(), wrong_size), | 3667 MockRead(ASYNC, syn_reply_wrong_length->data(), |
| 3668 syn_reply_wrong_length->size() - 4), |
| 3670 }; | 3669 }; |
| 3671 | 3670 |
| 3672 DelayedSocketData data(1, reads, arraysize(reads), | 3671 DelayedSocketData data(1, reads, arraysize(reads), |
| 3673 writes, arraysize(writes)); | 3672 writes, arraysize(writes)); |
| 3674 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 3673 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 3675 BoundNetLog(), GetParam(), NULL); | 3674 BoundNetLog(), GetParam(), NULL); |
| 3676 helper.RunToCompletion(&data); | 3675 helper.RunToCompletion(&data); |
| 3677 TransactionHelperResult out = helper.output(); | 3676 TransactionHelperResult out = helper.output(); |
| 3678 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); | 3677 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); |
| 3679 } | 3678 } |
| (...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6551 // since we're send-stalled. | 6550 // since we're send-stalled. |
| 6552 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); | 6551 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
| 6553 | 6552 |
| 6554 // Read in WINDOW_UPDATE or SETTINGS frame. | 6553 // Read in WINDOW_UPDATE or SETTINGS frame. |
| 6555 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); | 6554 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); |
| 6556 rv = callback.WaitForResult(); | 6555 rv = callback.WaitForResult(); |
| 6557 helper.VerifyDataConsumed(); | 6556 helper.VerifyDataConsumed(); |
| 6558 } | 6557 } |
| 6559 | 6558 |
| 6560 } // namespace net | 6559 } // namespace net |
| OLD | NEW |