| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "HTTPParsers.h" | 6 #include "HTTPParsers.h" |
| 7 | 7 |
| 8 #include "wtf/MathExtras.h" | 8 #include "wtf/MathExtras.h" |
| 9 #include "wtf/testing/WTFTestHelpers.h" | 9 #include "wtf/testing/WTFTestHelpers.h" |
| 10 #include "wtf/text/AtomicString.h" | 10 #include "wtf/text/AtomicString.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 EXPECT_TRUE(failureReason.isEmpty()); | 216 EXPECT_TRUE(failureReason.isEmpty()); |
| 217 EXPECT_EQ("foo", name.string()); | 217 EXPECT_EQ("foo", name.string()); |
| 218 EXPECT_EQ("bar", value.string()); | 218 EXPECT_EQ("bar", value.string()); |
| 219 | 219 |
| 220 EXPECT_EQ(12u, parseHTTPHeader(data + 10, failureReason, name, value)); | 220 EXPECT_EQ(12u, parseHTTPHeader(data + 10, failureReason, name, value)); |
| 221 EXPECT_TRUE(failureReason.isEmpty()); | 221 EXPECT_TRUE(failureReason.isEmpty()); |
| 222 EXPECT_EQ("hoge", name.string()); | 222 EXPECT_EQ("hoge", name.string()); |
| 223 EXPECT_EQ("fuga", value.string()); | 223 EXPECT_EQ("fuga", value.string()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 TEST(HTTPParsersTest, CommaDelimitedHeaderSet) |
| 227 { |
| 228 CommaDelimitedHeaderSet set1; |
| 229 CommaDelimitedHeaderSet set2; |
| 230 parseCommaDelimitedHeader("dpr, rw, whatever", set1); |
| 231 EXPECT_TRUE(set1.contains("dpr")); |
| 232 EXPECT_TRUE(set1.contains("rw")); |
| 233 EXPECT_TRUE(set1.contains("whatever")); |
| 234 parseCommaDelimitedHeader("dprw\t , fo\to", set2); |
| 235 EXPECT_FALSE(set2.contains("dpr")); |
| 236 EXPECT_FALSE(set2.contains("rw")); |
| 237 EXPECT_FALSE(set2.contains("whatever")); |
| 238 EXPECT_TRUE(set2.contains("dprw")); |
| 239 EXPECT_FALSE(set2.contains("foo")); |
| 240 EXPECT_TRUE(set2.contains("fo\to")); |
| 241 } |
| 242 |
| 226 } // namespace blink | 243 } // namespace blink |
| 227 | 244 |
| OLD | NEW |