Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: net/spdy/spdy_framer_test.cc

Issue 197863004: Fix SpdyFramerTest.ProcessDataFrameWithPadding so it no longer tells SpdyFramer to read past the en… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698