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

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

Issue 247793002: HPACK: Refactor and simplify HpackOutputStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « net/spdy/hpack_encoder.cc ('k') | net/spdy/hpack_huffman_table_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_encoder.h" 5 #include "net/spdy/hpack_encoder.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 std::map<string, string> header_set; 90 std::map<string, string> header_set;
91 header_set["Cookie"] = "key1=value1; key2=value2"; 91 header_set["Cookie"] = "key1=value1; key2=value2";
92 92
93 string encoded_header_set; 93 string encoded_header_set;
94 EXPECT_TRUE(encoder.EncodeHeaderSet(header_set, &encoded_header_set)); 94 EXPECT_TRUE(encoder.EncodeHeaderSet(header_set, &encoded_header_set));
95 EXPECT_EQ("\x40\x06""Cookie\x0bkey1=value1" 95 EXPECT_EQ("\x40\x06""Cookie\x0bkey1=value1"
96 "\x40\x06""Cookie\x0bkey2=value2", encoded_header_set); 96 "\x40\x06""Cookie\x0bkey2=value2", encoded_header_set);
97 } 97 }
98 98
99 // Test that trying to encode a header set with a too-long header
100 // field will fail.
101 TEST(HpackEncoderTest, HeaderTooLarge) {
102 HpackEncoder encoder;
103 test::HpackEncoderPeer(&encoder).set_max_string_literal_size(10);
104
105 std::map<string, string> header_set;
106 header_set["name1"] = "too-long value";
107 header_set["name2"] = "value2";
108
109 // TODO(akalin): Verify that the encoder did not attempt to encode
110 // the second header field.
111 string encoded_header_set;
112 EXPECT_FALSE(encoder.EncodeHeaderSet(header_set, &encoded_header_set));
113 }
114
115 } // namespace 99 } // namespace
116 100
117 } // namespace net 101 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack_encoder.cc ('k') | net/spdy/hpack_huffman_table_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698