OLD | NEW |
---|---|
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 Loading... | |
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 |
OLD | NEW |