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

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

Issue 2710053002: HTTP/2 Check header names in HeaderCoalescer (Closed)
Patch Set: fix pseudo and add test Created 3 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
« net/spdy/header_coalescer.cc ('K') | « net/spdy/header_coalescer.cc ('k') | 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 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 <string>
8 8
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ElementsAre(Pair("foo", base::StringPiece("bar\0quux", 8)), 69 ElementsAre(Pair("foo", base::StringPiece("bar\0quux", 8)),
70 Pair("cookie", "baz; qux"))); 70 Pair("cookie", "baz; qux")));
71 } 71 }
72 72
73 TEST_F(HeaderCoalescerTest, CRLFInHeaderValue) { 73 TEST_F(HeaderCoalescerTest, CRLFInHeaderValue) {
74 EXPECT_FALSE(header_coalescer_.error_seen()); 74 EXPECT_FALSE(header_coalescer_.error_seen());
75 header_coalescer_.OnHeader("foo", "bar\r\nbaz"); 75 header_coalescer_.OnHeader("foo", "bar\r\nbaz");
76 EXPECT_TRUE(header_coalescer_.error_seen()); 76 EXPECT_TRUE(header_coalescer_.error_seen());
77 } 77 }
78 78
79 TEST_F(HeaderCoalescerTest, HeaderNameNotValid) {
asanka 2017/02/23 17:45:13 There should be a test that stakes out RFC 7230's
xunjieli 2017/02/23 23:07:38 Done.
80 std::string header_name("\x01\x7F\x80\xff");
81 header_coalescer_.OnHeader(header_name, "foo");
82 EXPECT_TRUE(header_coalescer_.error_seen());
83 }
asanka 2017/02/23 17:45:13 Similar to the above test requirement. Add one for
xunjieli 2017/02/23 23:07:37 Done.
84
79 } // namespace test 85 } // namespace test
86
80 } // namespace net 87 } // namespace net
OLDNEW
« net/spdy/header_coalescer.cc ('K') | « net/spdy/header_coalescer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698