| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <iostream> | 6 #include <iostream> |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3380 | 3380 |
| 3381 // Send the first 100 bytes of the padding payload. | 3381 // Send the first 100 bytes of the padding payload. |
| 3382 EXPECT_CALL(visitor, OnStreamFrameData(1, NULL, 100, false)); | 3382 EXPECT_CALL(visitor, OnStreamFrameData(1, NULL, 100, false)); |
| 3383 CHECK_EQ(100u, framer.ProcessInput(frame->data() + bytes_consumed, 100)); | 3383 CHECK_EQ(100u, framer.ProcessInput(frame->data() + bytes_consumed, 100)); |
| 3384 CHECK_EQ(framer.state(), SpdyFramer::SPDY_CONSUME_PADDING); | 3384 CHECK_EQ(framer.state(), SpdyFramer::SPDY_CONSUME_PADDING); |
| 3385 CHECK_EQ(framer.error_code(), SpdyFramer::SPDY_NO_ERROR); | 3385 CHECK_EQ(framer.error_code(), SpdyFramer::SPDY_NO_ERROR); |
| 3386 bytes_consumed += 100; | 3386 bytes_consumed += 100; |
| 3387 | 3387 |
| 3388 // Send rest of the padding payload. | 3388 // Send rest of the padding payload. |
| 3389 EXPECT_CALL(visitor, OnStreamFrameData(1, NULL, 410, false)); | 3389 EXPECT_CALL(visitor, OnStreamFrameData(1, NULL, 410, false)); |
| 3390 CHECK_EQ(412u, framer.ProcessInput(frame->data() + bytes_consumed, 412)); | 3390 CHECK_EQ(410u, framer.ProcessInput(frame->data() + bytes_consumed, 410)); |
| 3391 CHECK_EQ(framer.state(), SpdyFramer::SPDY_READING_COMMON_HEADER); | 3391 CHECK_EQ(framer.state(), SpdyFramer::SPDY_RESET); |
| 3392 CHECK_EQ(framer.error_code(), SpdyFramer::SPDY_NO_ERROR); | 3392 CHECK_EQ(framer.error_code(), SpdyFramer::SPDY_NO_ERROR); |
| 3393 } | 3393 } |
| 3394 | 3394 |
| 3395 TEST_P(SpdyFramerTest, ReadWindowUpdate) { | 3395 TEST_P(SpdyFramerTest, ReadWindowUpdate) { |
| 3396 SpdyFramer framer(spdy_version_); | 3396 SpdyFramer framer(spdy_version_); |
| 3397 scoped_ptr<SpdyFrame> control_frame( | 3397 scoped_ptr<SpdyFrame> control_frame( |
| 3398 framer.SerializeWindowUpdate(net::SpdyWindowUpdateIR(1, 2))); | 3398 framer.SerializeWindowUpdate(net::SpdyWindowUpdateIR(1, 2))); |
| 3399 TestSpdyVisitor visitor(spdy_version_); | 3399 TestSpdyVisitor visitor(spdy_version_); |
| 3400 visitor.SimulateInFramer( | 3400 visitor.SimulateInFramer( |
| 3401 reinterpret_cast<unsigned char*>(control_frame->data()), | 3401 reinterpret_cast<unsigned char*>(control_frame->data()), |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4751 SpdyBlockedIR blocked_ir(0); | 4751 SpdyBlockedIR blocked_ir(0); |
| 4752 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); | 4752 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); |
| 4753 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); | 4753 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); |
| 4754 | 4754 |
| 4755 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); | 4755 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); |
| 4756 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) | 4756 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) |
| 4757 << SpdyFramer::ErrorCodeToString(framer.error_code()); | 4757 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
| 4758 } | 4758 } |
| 4759 | 4759 |
| 4760 } // namespace net | 4760 } // namespace net |
| OLD | NEW |