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

Side by Side Diff: Source/platform/network/HTTPParsersTest.cpp

Issue 961773002: Add a comma delimited syntax parser and use it for Accept-CH (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added layout test Created 5 years, 10 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 | « Source/platform/network/HTTPParsers.cpp ('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 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
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
OLDNEW
« no previous file with comments | « Source/platform/network/HTTPParsers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698