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

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

Issue 2801603003: Add SpdyString alias for std::string in net/spdy. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « net/spdy/header_coalescer.cc ('k') | net/spdy/hpack/hpack_decoder.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "header_coalescer.h" 5 #include "header_coalescer.h"
6 6
7 #include <string> 7 #include "net/spdy/platform/api/spdy_string.h"
8
9 #include "net/spdy/platform/api/spdy_string_utils.h" 8 #include "net/spdy/platform/api/spdy_string_utils.h"
10 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 11
13 using ::testing::ElementsAre; 12 using ::testing::ElementsAre;
14 using ::testing::Pair; 13 using ::testing::Pair;
15 14
16 namespace net { 15 namespace net {
17 namespace test { 16 namespace test {
18 17
(...skipping 15 matching lines...) Expand all
34 33
35 TEST_F(HeaderCoalescerTest, EmptyHeaderKey) { 34 TEST_F(HeaderCoalescerTest, EmptyHeaderKey) {
36 EXPECT_FALSE(header_coalescer_.error_seen()); 35 EXPECT_FALSE(header_coalescer_.error_seen());
37 header_coalescer_.OnHeader("", "foo"); 36 header_coalescer_.OnHeader("", "foo");
38 EXPECT_TRUE(header_coalescer_.error_seen()); 37 EXPECT_TRUE(header_coalescer_.error_seen());
39 } 38 }
40 39
41 TEST_F(HeaderCoalescerTest, HeaderBlockTooLarge) { 40 TEST_F(HeaderCoalescerTest, HeaderBlockTooLarge) {
42 // 3 byte key, 256 * 1024 - 40 byte value, 32 byte overhead: 41 // 3 byte key, 256 * 1024 - 40 byte value, 32 byte overhead:
43 // less than 256 * 1024 bytes in total. 42 // less than 256 * 1024 bytes in total.
44 std::string data(256 * 1024 - 40, 'a'); 43 SpdyString data(256 * 1024 - 40, 'a');
45 header_coalescer_.OnHeader("foo", data); 44 header_coalescer_.OnHeader("foo", data);
46 EXPECT_FALSE(header_coalescer_.error_seen()); 45 EXPECT_FALSE(header_coalescer_.error_seen());
47 46
48 // Another 3 + 3 + 32 bytes: too large. 47 // Another 3 + 3 + 32 bytes: too large.
49 header_coalescer_.OnHeader("bar", "baz"); 48 header_coalescer_.OnHeader("bar", "baz");
50 EXPECT_TRUE(header_coalescer_.error_seen()); 49 EXPECT_TRUE(header_coalescer_.error_seen());
51 } 50 }
52 51
53 TEST_F(HeaderCoalescerTest, PseudoHeadersMustNotFollowRegularHeaders) { 52 TEST_F(HeaderCoalescerTest, PseudoHeadersMustNotFollowRegularHeaders) {
54 header_coalescer_.OnHeader("foo", "bar"); 53 header_coalescer_.OnHeader("foo", "bar");
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 header_block, 129 header_block,
131 ElementsAre(Pair("foo_0", SpdyStringPiece(header_values[0].data(), 130 ElementsAre(Pair("foo_0", SpdyStringPiece(header_values[0].data(),
132 header_values[0].size())), 131 header_values[0].size())),
133 Pair("foo_1", SpdyStringPiece(header_values[1].data(), 132 Pair("foo_1", SpdyStringPiece(header_values[1].data(),
134 header_values[1].size())))); 133 header_values[1].size()))));
135 } 134 }
136 135
137 } // namespace test 136 } // namespace test
138 137
139 } // namespace net 138 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/header_coalescer.cc ('k') | net/spdy/hpack/hpack_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698