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

Side by Side Diff: net/spdy/core/hpack/hpack_input_stream_test.cc

Issue 2895993003: Misc cleanup in net/spdy/core. (Closed)
Patch Set: Rebase. Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/spdy/core/hpack/hpack_input_stream.h" 5 #include "net/spdy/core/hpack/hpack_input_stream.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 HpackInputStream input_stream2("\x0e"); 753 HpackInputStream input_stream2("\x0e");
754 HpackInputStreamPeer input_stream2_peer(&input_stream2); 754 HpackInputStreamPeer input_stream2_peer(&input_stream2);
755 EXPECT_FALSE(input_stream2.DecodeNextIdentityString(&string_piece)); 755 EXPECT_FALSE(input_stream2.DecodeNextIdentityString(&string_piece));
756 // Only parsed first byte. 756 // Only parsed first byte.
757 EXPECT_EQ(1u, input_stream2_peer.ParsedBytesCurrent()); 757 EXPECT_EQ(1u, input_stream2_peer.ParsedBytesCurrent());
758 EXPECT_TRUE(input_stream2.NeedMoreData()); 758 EXPECT_TRUE(input_stream2.NeedMoreData());
759 } 759 }
760 760
761 TEST(HpackInputStreamTest, IncompleteHeaderDecodeNextHuffmanString) { 761 TEST(HpackInputStreamTest, IncompleteHeaderDecodeNextHuffmanString) {
762 SpdyString output, input(a2b_hex(kEncodedHuffmanFixture)); 762 SpdyString output, input(a2b_hex(kEncodedHuffmanFixture));
763 input.resize(input.size() - 1); // Remove last byte. 763 input.pop_back(); // Remove last byte.
764 HpackInputStream input_stream1(input); 764 HpackInputStream input_stream1(input);
765 HpackInputStreamPeer input_stream1_peer(&input_stream1); 765 HpackInputStreamPeer input_stream1_peer(&input_stream1);
766 EXPECT_FALSE(input_stream1.DecodeNextHuffmanString(&output)); 766 EXPECT_FALSE(input_stream1.DecodeNextHuffmanString(&output));
767 EXPECT_EQ(1u, input_stream1_peer.ParsedBytesCurrent()); 767 EXPECT_EQ(1u, input_stream1_peer.ParsedBytesCurrent());
768 EXPECT_TRUE(input_stream1.NeedMoreData()); 768 EXPECT_TRUE(input_stream1.NeedMoreData());
769 769
770 input.erase(1, input.size()); // Remove all bytes except the first one. 770 input.erase(1, input.size()); // Remove all bytes except the first one.
771 HpackInputStream input_stream2(input); 771 HpackInputStream input_stream2(input);
772 HpackInputStreamPeer input_stream2_peer(&input_stream2); 772 HpackInputStreamPeer input_stream2_peer(&input_stream2);
773 EXPECT_FALSE(input_stream2.DecodeNextHuffmanString(&output)); 773 EXPECT_FALSE(input_stream2.DecodeNextHuffmanString(&output));
774 EXPECT_EQ(1u, input_stream2_peer.ParsedBytesCurrent()); 774 EXPECT_EQ(1u, input_stream2_peer.ParsedBytesCurrent());
775 EXPECT_TRUE(input_stream2.NeedMoreData()); 775 EXPECT_TRUE(input_stream2.NeedMoreData());
776 } 776 }
777 777
778 } // namespace test 778 } // namespace test
779 779
780 } // namespace net 780 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698