Chromium Code Reviews

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

Issue 352583006: HPACK changes required for specification draft '08 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
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/hpack_input_stream.h" 5 #include "net/spdy/hpack_input_stream.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...)
29 virtual void SetUp() { 29 virtual void SetUp() {
30 std::vector<HpackHuffmanSymbol> code = HpackHuffmanCode(); 30 std::vector<HpackHuffmanSymbol> code = HpackHuffmanCode();
31 EXPECT_TRUE(huffman_table_.Initialize(&code[0], code.size())); 31 EXPECT_TRUE(huffman_table_.Initialize(&code[0], code.size()));
32 } 32 }
33 33
34 protected: 34 protected:
35 HpackHuffmanTable huffman_table_; 35 HpackHuffmanTable huffman_table_;
36 }; 36 };
37 37
38 // Hex representation of encoded length and Huffman string. 38 // Hex representation of encoded length and Huffman string.
39 const char kEncodedHuffmanFixture[] = "31" // Length prefix. 39 const char kEncodedHuffmanFixture[] = "2d" // Length prefix.
40 "e0d6cf9f6e8f9fd3e5f6fa76fefd3c7e" 40 "94e7821dd7f2e6c7b335dfdfcd5b3960"
41 "df9eff1f2f0f3cfe9f6fcf7f8f879f61" 41 "d5af27087f3672c1ab270fb5291f9587"
42 "ad4f4cc9a973a2200ec3725e18b1b74e" 42 "316065c003ed4ee5b1063d5007";
43 "3f";
44 43
45 const char kDecodedHuffmanFixture[] = 44 const char kDecodedHuffmanFixture[] =
46 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1"; 45 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1";
47 46
48 // Utility function to decode an assumed-valid uint32 with an N-bit 47 // Utility function to decode an assumed-valid uint32 with an N-bit
49 // prefix. 48 // prefix.
50 uint32 DecodeValidUint32(uint8 N, StringPiece str) { 49 uint32 DecodeValidUint32(uint8 N, StringPiece str) {
51 EXPECT_GT(N, 0); 50 EXPECT_GT(N, 0);
52 EXPECT_LE(N, 8); 51 EXPECT_LE(N, 8);
53 HpackInputStream input_stream(kLiteralBound, str); 52 HpackInputStream input_stream(kLiteralBound, str);
(...skipping 567 matching lines...)
621 620
622 input_stream.ConsumeBits(6); 621 input_stream.ConsumeBits(6);
623 EXPECT_TRUE(input_stream.HasMoreData()); 622 EXPECT_TRUE(input_stream.HasMoreData());
624 input_stream.ConsumeByteRemainder(); 623 input_stream.ConsumeByteRemainder();
625 EXPECT_FALSE(input_stream.HasMoreData()); 624 EXPECT_FALSE(input_stream.HasMoreData());
626 } 625 }
627 626
628 } // namespace 627 } // namespace
629 628
630 } // namespace net 629 } // namespace net
OLDNEW

Powered by Google App Engine