1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 #include "net/cookies/cookie_constants.h"
8 #include "net/cookies/parsed_cookie.h"
9 #include "testing/gtest/include/gtest/gtest.h"
13 TEST(ParsedCookieTest
, TestBasic
) {
14 ParsedCookie
pc("a=b");
15 EXPECT_TRUE(pc
.IsValid());
16 EXPECT_FALSE(pc
.IsSecure());
17 EXPECT_EQ("a", pc
.Name());
18 EXPECT_EQ("b", pc
.Value());
21 TEST(ParsedCookieTest
, TestEmpty
) {
22 ParsedCookie
pc1("=; path=/; secure;");
23 EXPECT_FALSE(pc1
.IsValid());
24 ParsedCookie
pc2("= ; path=/; secure;");
25 EXPECT_FALSE(pc2
.IsValid());
26 ParsedCookie
pc3(" =; path=/; secure;");
27 EXPECT_FALSE(pc3
.IsValid());
28 ParsedCookie
pc4(" = ; path=/; secure;");
29 EXPECT_FALSE(pc4
.IsValid());
30 ParsedCookie
pc5(" ; path=/; secure;");
31 EXPECT_FALSE(pc5
.IsValid());
32 ParsedCookie
pc6("; path=/; secure;");
33 EXPECT_FALSE(pc6
.IsValid());
36 TEST(ParsedCookieTest
, TestQuoted
) {
37 // These are some quoting cases which the major browsers all
38 // handle differently. I've tested Internet Explorer 6, Opera 9.6,
39 // Firefox 3, and Safari Windows 3.2.1. We originally tried to match
40 // Firefox closely, however we now match Internet Explorer and Safari.
41 const char* values
[] = {
42 // Trailing whitespace after a quoted value. The whitespace after
43 // the quote is stripped in all browsers.
44 "\"zzz \" ", "\"zzz \"",
45 // Handling a quoted value with a ';', like FOO="zz;pp" ;
46 // IE and Safari: "zz;
47 // Firefox and Opera: "zz;pp"
48 "\"zz;pp\" ;", "\"zz",
49 // Handling a value with multiple quoted parts, like FOO="zzz " "ppp" ;
50 // IE and Safari: "zzz " "ppp";
52 // Opera: <rejects cookie>
53 "\"zzz \" \"ppp\" ", "\"zzz \" \"ppp\"",
54 // A quote in a value that didn't start quoted. like FOO=A"B ;
55 // IE, Safari, and Firefox: A"B;
56 // Opera: <rejects cookie>
60 for (size_t i
= 0; i
< arraysize(values
); i
+= 2) {
61 std::string
input(values
[i
]);
62 std::string
expected(values
[i
+ 1]);
64 ParsedCookie
pc("aBc=" + input
+ " ; path=\"/\" ; httponly ");
65 EXPECT_TRUE(pc
.IsValid());
66 EXPECT_FALSE(pc
.IsSecure());
67 EXPECT_TRUE(pc
.IsHttpOnly());
68 EXPECT_TRUE(pc
.HasPath());
69 EXPECT_EQ("aBc", pc
.Name());
70 EXPECT_EQ(expected
, pc
.Value());
72 // If a path was quoted, the path attribute keeps the quotes. This will
73 // make the cookie effectively useless, but path parameters aren't supposed
74 // to be quoted. Bug 1261605.
75 EXPECT_EQ("\"/\"", pc
.Path());
79 TEST(ParsedCookieTest
, TestNameless
) {
80 ParsedCookie
pc("BLAHHH; path=/; secure;");
81 EXPECT_TRUE(pc
.IsValid());
82 EXPECT_TRUE(pc
.IsSecure());
83 EXPECT_TRUE(pc
.HasPath());
84 EXPECT_EQ("/", pc
.Path());
85 EXPECT_EQ("", pc
.Name());
86 EXPECT_EQ("BLAHHH", pc
.Value());
87 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
90 TEST(ParsedCookieTest
, TestAttributeCase
) {
91 ParsedCookie
pc("BLAHHH; Path=/; sECuRe; httpONLY; pRIoRitY=hIgH");
92 EXPECT_TRUE(pc
.IsValid());
93 EXPECT_TRUE(pc
.IsSecure());
94 EXPECT_TRUE(pc
.IsHttpOnly());
95 EXPECT_TRUE(pc
.HasPath());
96 EXPECT_EQ("/", pc
.Path());
97 EXPECT_EQ("", pc
.Name());
98 EXPECT_EQ("BLAHHH", pc
.Value());
99 EXPECT_EQ(COOKIE_PRIORITY_HIGH
, pc
.Priority());
100 EXPECT_EQ(4U, pc
.NumberOfAttributes());
103 TEST(ParsedCookieTest
, TestDoubleQuotedNameless
) {
104 ParsedCookie
pc("\"BLA\\\"HHH\"; path=/; secure;");
105 EXPECT_TRUE(pc
.IsValid());
106 EXPECT_TRUE(pc
.IsSecure());
107 EXPECT_TRUE(pc
.HasPath());
108 EXPECT_EQ("/", pc
.Path());
109 EXPECT_EQ("", pc
.Name());
110 EXPECT_EQ("\"BLA\\\"HHH\"", pc
.Value());
111 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
112 EXPECT_EQ(2U, pc
.NumberOfAttributes());
115 TEST(ParsedCookieTest
, QuoteOffTheEnd
) {
116 ParsedCookie
pc("a=\"B");
117 EXPECT_TRUE(pc
.IsValid());
118 EXPECT_EQ("a", pc
.Name());
119 EXPECT_EQ("\"B", pc
.Value());
120 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
121 EXPECT_EQ(0U, pc
.NumberOfAttributes());
124 TEST(ParsedCookieTest
, MissingName
) {
125 ParsedCookie
pc("=ABC");
126 EXPECT_TRUE(pc
.IsValid());
127 EXPECT_EQ("", pc
.Name());
128 EXPECT_EQ("ABC", pc
.Value());
129 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
130 EXPECT_EQ(0U, pc
.NumberOfAttributes());
133 TEST(ParsedCookieTest
, MissingValue
) {
134 ParsedCookie
pc("ABC=; path = /wee");
135 EXPECT_TRUE(pc
.IsValid());
136 EXPECT_EQ("ABC", pc
.Name());
137 EXPECT_EQ("", pc
.Value());
138 EXPECT_TRUE(pc
.HasPath());
139 EXPECT_EQ("/wee", pc
.Path());
140 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
141 EXPECT_EQ(1U, pc
.NumberOfAttributes());
144 TEST(ParsedCookieTest
, Whitespace
) {
145 ParsedCookie
pc(" A = BC ;secure;;; httponly");
146 EXPECT_TRUE(pc
.IsValid());
147 EXPECT_EQ("A", pc
.Name());
148 EXPECT_EQ("BC", pc
.Value());
149 EXPECT_FALSE(pc
.HasPath());
150 EXPECT_FALSE(pc
.HasDomain());
151 EXPECT_TRUE(pc
.IsSecure());
152 EXPECT_TRUE(pc
.IsHttpOnly());
153 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
154 // We parse anything between ; as attributes, so we end up with two
155 // attributes with an empty string name and value.
156 EXPECT_EQ(4U, pc
.NumberOfAttributes());
158 TEST(ParsedCookieTest
, MultipleEquals
) {
159 ParsedCookie
pc(" A=== BC ;secure;;; httponly");
160 EXPECT_TRUE(pc
.IsValid());
161 EXPECT_EQ("A", pc
.Name());
162 EXPECT_EQ("== BC", pc
.Value());
163 EXPECT_FALSE(pc
.HasPath());
164 EXPECT_FALSE(pc
.HasDomain());
165 EXPECT_TRUE(pc
.IsSecure());
166 EXPECT_TRUE(pc
.IsHttpOnly());
167 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
168 EXPECT_EQ(4U, pc
.NumberOfAttributes());
171 TEST(ParsedCookieTest
, QuotedTrailingWhitespace
) {
172 ParsedCookie
pc("ANCUUID=\"zohNumRKgI0oxyhSsV3Z7D\" ; "
173 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; "
175 EXPECT_TRUE(pc
.IsValid());
176 EXPECT_EQ("ANCUUID", pc
.Name());
177 // Stripping whitespace after the quotes matches all other major browsers.
178 EXPECT_EQ("\"zohNumRKgI0oxyhSsV3Z7D\"", pc
.Value());
179 EXPECT_TRUE(pc
.HasExpires());
180 EXPECT_TRUE(pc
.HasPath());
181 EXPECT_EQ("/", pc
.Path());
182 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
183 EXPECT_EQ(2U, pc
.NumberOfAttributes());
186 TEST(ParsedCookieTest
, TrailingWhitespace
) {
187 ParsedCookie
pc("ANCUUID=zohNumRKgI0oxyhSsV3Z7D ; "
188 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; "
190 EXPECT_TRUE(pc
.IsValid());
191 EXPECT_EQ("ANCUUID", pc
.Name());
192 EXPECT_EQ("zohNumRKgI0oxyhSsV3Z7D", pc
.Value());
193 EXPECT_TRUE(pc
.HasExpires());
194 EXPECT_TRUE(pc
.HasPath());
195 EXPECT_EQ("/", pc
.Path());
196 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
197 EXPECT_EQ(2U, pc
.NumberOfAttributes());
200 TEST(ParsedCookieTest
, TooManyPairs
) {
201 std::string blankpairs
;
202 blankpairs
.resize(ParsedCookie::kMaxPairs
- 2, ';');
204 ParsedCookie
pc1("a=b;" + blankpairs
+ "secure");
205 EXPECT_TRUE(pc1
.IsValid());
206 EXPECT_TRUE(pc1
.IsSecure());
208 ParsedCookie
pc2("a=b;" + blankpairs
+ ";secure");
209 EXPECT_TRUE(pc2
.IsValid());
210 EXPECT_FALSE(pc2
.IsSecure());
213 // TODO(erikwright): some better test cases for invalid cookies.
214 TEST(ParsedCookieTest
, InvalidWhitespace
) {
215 ParsedCookie
pc(" ");
216 EXPECT_FALSE(pc
.IsValid());
219 TEST(ParsedCookieTest
, InvalidTooLong
) {
221 maxstr
.resize(ParsedCookie::kMaxCookieSize
, 'a');
223 ParsedCookie
pc1(maxstr
);
224 EXPECT_TRUE(pc1
.IsValid());
226 ParsedCookie
pc2(maxstr
+ "A");
227 EXPECT_FALSE(pc2
.IsValid());
230 TEST(ParsedCookieTest
, InvalidEmpty
) {
231 ParsedCookie
pc((std::string()));
232 EXPECT_FALSE(pc
.IsValid());
235 TEST(ParsedCookieTest
, EmbeddedTerminator
) {
236 ParsedCookie
pc1("AAA=BB\0ZYX");
237 ParsedCookie
pc2("AAA=BB\rZYX");
238 ParsedCookie
pc3("AAA=BB\nZYX");
239 EXPECT_TRUE(pc1
.IsValid());
240 EXPECT_EQ("AAA", pc1
.Name());
241 EXPECT_EQ("BB", pc1
.Value());
242 EXPECT_TRUE(pc2
.IsValid());
243 EXPECT_EQ("AAA", pc2
.Name());
244 EXPECT_EQ("BB", pc2
.Value());
245 EXPECT_TRUE(pc3
.IsValid());
246 EXPECT_EQ("AAA", pc3
.Name());
247 EXPECT_EQ("BB", pc3
.Value());
250 TEST(ParsedCookieTest
, ParseTokensAndValues
) {
252 ParsedCookie::ParseTokenString("hello\nworld"));
254 ParsedCookie::ParseTokenString("fs!!@;helloworld"));
255 EXPECT_EQ("hello world\tgood",
256 ParsedCookie::ParseTokenString("hello world\tgood\rbye"));
258 ParsedCookie::ParseTokenString("A=B=C;D=E"));
260 ParsedCookie::ParseValueString("hello\nworld"));
262 ParsedCookie::ParseValueString("fs!!@;helloworld"));
263 EXPECT_EQ("hello world\tgood",
264 ParsedCookie::ParseValueString("hello world\tgood\rbye"));
266 ParsedCookie::ParseValueString("A=B=C;D=E"));
269 TEST(ParsedCookieTest
, SerializeCookieLine
) {
270 const char input
[] = "ANCUUID=zohNumRKgI0oxyhSsV3Z7D ; "
271 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; "
272 "path=/ ; priority=low ; ";
273 const char output
[] = "ANCUUID=zohNumRKgI0oxyhSsV3Z7D; "
274 "expires=Sun, 18-Apr-2027 21:06:29 GMT; "
275 "path=/; priority=low";
276 ParsedCookie
pc(input
);
277 EXPECT_EQ(output
, pc
.ToCookieLine());
281 TEST(ParsedCookieTest
, SetNameAndValue
) {
282 ParsedCookie
empty((std::string()));
283 EXPECT_FALSE(empty
.IsValid());
284 EXPECT_FALSE(empty
.SetDomain("foobar.com"));
285 EXPECT_TRUE(empty
.SetName("name"));
286 EXPECT_TRUE(empty
.SetValue("value"));
287 EXPECT_EQ("name=value", empty
.ToCookieLine());
288 EXPECT_TRUE(empty
.IsValid());
291 // ParsedCookie invalid("@foo=bar");
292 // EXPECT_FALSE(invalid.IsValid());
293 // here because we are slightly more tolerant to invalid cookie names and
294 // values that are set by webservers. We only enforce a correct name and
295 // value if set via SetName() and SetValue().
297 ParsedCookie
pc("name=value");
298 EXPECT_TRUE(pc
.IsValid());
300 // Set invalid name / value.
301 EXPECT_FALSE(pc
.SetName("@foobar"));
302 EXPECT_EQ("name=value", pc
.ToCookieLine());
303 EXPECT_TRUE(pc
.IsValid());
305 EXPECT_FALSE(pc
.SetName(std::string()));
306 EXPECT_EQ("name=value", pc
.ToCookieLine());
307 EXPECT_TRUE(pc
.IsValid());
309 EXPECT_FALSE(pc
.SetValue("foo bar"));
310 EXPECT_EQ("name=value", pc
.ToCookieLine());
311 EXPECT_TRUE(pc
.IsValid());
313 EXPECT_FALSE(pc
.SetValue("\"foobar"));
314 EXPECT_EQ("name=value", pc
.ToCookieLine());
315 EXPECT_TRUE(pc
.IsValid());
317 // Set valid name / value
318 EXPECT_TRUE(pc
.SetName("test"));
319 EXPECT_EQ("test=value", pc
.ToCookieLine());
320 EXPECT_TRUE(pc
.IsValid());
322 EXPECT_TRUE(pc
.SetValue("\"foobar\""));
323 EXPECT_EQ("test=\"foobar\"", pc
.ToCookieLine());
324 EXPECT_TRUE(pc
.IsValid());
326 EXPECT_TRUE(pc
.SetValue(std::string()));
327 EXPECT_EQ("test=", pc
.ToCookieLine());
328 EXPECT_TRUE(pc
.IsValid());
331 TEST(ParsedCookieTest
, SetAttributes
) {
332 ParsedCookie
pc("name=value");
333 EXPECT_TRUE(pc
.IsValid());
335 // Clear an unset attribute.
336 EXPECT_TRUE(pc
.SetDomain(std::string()));
337 EXPECT_FALSE(pc
.HasDomain());
338 EXPECT_EQ("name=value", pc
.ToCookieLine());
339 EXPECT_TRUE(pc
.IsValid());
341 // Set a string containing an invalid character
342 EXPECT_FALSE(pc
.SetDomain("foo;bar"));
343 EXPECT_FALSE(pc
.HasDomain());
344 EXPECT_EQ("name=value", pc
.ToCookieLine());
345 EXPECT_TRUE(pc
.IsValid());
347 // Set all other attributes and check that they are appended in order.
348 EXPECT_TRUE(pc
.SetDomain("domain.com"));
349 EXPECT_TRUE(pc
.SetPath("/"));
350 EXPECT_TRUE(pc
.SetExpires("Sun, 18-Apr-2027 21:06:29 GMT"));
351 EXPECT_TRUE(pc
.SetMaxAge("12345"));
352 EXPECT_TRUE(pc
.SetIsSecure(true));
353 EXPECT_TRUE(pc
.SetIsHttpOnly(true));
354 EXPECT_TRUE(pc
.SetIsHttpOnly(true));
355 EXPECT_TRUE(pc
.SetPriority("HIGH"));
356 EXPECT_EQ("name=value; domain=domain.com; path=/; "
357 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; "
358 "httponly; priority=HIGH",
360 EXPECT_TRUE(pc
.HasDomain());
361 EXPECT_TRUE(pc
.HasPath());
362 EXPECT_TRUE(pc
.HasExpires());
363 EXPECT_TRUE(pc
.HasMaxAge());
364 EXPECT_TRUE(pc
.IsSecure());
365 EXPECT_TRUE(pc
.IsHttpOnly());
366 EXPECT_EQ(COOKIE_PRIORITY_HIGH
, pc
.Priority());
368 // Clear one attribute from the middle.
369 EXPECT_TRUE(pc
.SetPath("/foo"));
370 EXPECT_TRUE(pc
.HasDomain());
371 EXPECT_TRUE(pc
.HasPath());
372 EXPECT_TRUE(pc
.HasExpires());
373 EXPECT_TRUE(pc
.IsSecure());
374 EXPECT_TRUE(pc
.IsHttpOnly());
375 EXPECT_EQ("name=value; domain=domain.com; path=/foo; "
376 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; "
377 "httponly; priority=HIGH",
380 // Set priority to medium.
381 EXPECT_TRUE(pc
.SetPriority("medium"));
382 EXPECT_EQ("name=value; domain=domain.com; path=/foo; "
383 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; "
384 "httponly; priority=medium",
387 // Clear the rest and change the name and value.
388 EXPECT_TRUE(pc
.SetDomain(std::string()));
389 EXPECT_TRUE(pc
.SetPath(std::string()));
390 EXPECT_TRUE(pc
.SetExpires(std::string()));
391 EXPECT_TRUE(pc
.SetMaxAge(std::string()));
392 EXPECT_TRUE(pc
.SetIsSecure(false));
393 EXPECT_TRUE(pc
.SetIsHttpOnly(false));
394 EXPECT_TRUE(pc
.SetName("name2"));
395 EXPECT_TRUE(pc
.SetValue("value2"));
396 EXPECT_TRUE(pc
.SetPriority(std::string()));
397 EXPECT_FALSE(pc
.HasDomain());
398 EXPECT_FALSE(pc
.HasPath());
399 EXPECT_FALSE(pc
.HasExpires());
400 EXPECT_FALSE(pc
.HasMaxAge());
401 EXPECT_FALSE(pc
.IsSecure());
402 EXPECT_FALSE(pc
.IsHttpOnly());
403 EXPECT_EQ("name2=value2", pc
.ToCookieLine());
406 TEST(ParsedCookieTest
, SetPriority
) {
407 ParsedCookie
pc("name=value");
408 EXPECT_TRUE(pc
.IsValid());
410 EXPECT_EQ("name=value", pc
.ToCookieLine());
411 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
413 // Test each priority, expect case-insensitive compare.
414 EXPECT_TRUE(pc
.SetPriority("high"));
415 EXPECT_EQ("name=value; priority=high", pc
.ToCookieLine());
416 EXPECT_EQ(COOKIE_PRIORITY_HIGH
, pc
.Priority());
418 EXPECT_TRUE(pc
.SetPriority("mEDium"));
419 EXPECT_EQ("name=value; priority=mEDium", pc
.ToCookieLine());
420 EXPECT_EQ(COOKIE_PRIORITY_MEDIUM
, pc
.Priority());
422 EXPECT_TRUE(pc
.SetPriority("LOW"));
423 EXPECT_EQ("name=value; priority=LOW", pc
.ToCookieLine());
424 EXPECT_EQ(COOKIE_PRIORITY_LOW
, pc
.Priority());
426 // Interpret invalid priority values as COOKIE_PRIORITY_DEFAULT.
427 EXPECT_TRUE(pc
.SetPriority("Blah"));
428 EXPECT_EQ("name=value; priority=Blah", pc
.ToCookieLine());
429 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
431 EXPECT_TRUE(pc
.SetPriority("lowerest"));
432 EXPECT_EQ("name=value; priority=lowerest", pc
.ToCookieLine());
433 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
435 EXPECT_TRUE(pc
.SetPriority(""));
436 EXPECT_EQ("name=value", pc
.ToCookieLine());
437 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT
, pc
.Priority());
440 TEST(ParsedCookieTest
, InvalidNonAlphanumericChars
) {
441 ParsedCookie
pc1("name=\x05");
442 ParsedCookie
pc2("name=foo" "\x1c" "bar");
443 ParsedCookie
pc3("name=foobar" "\x11");
444 ParsedCookie
pc4("name=\x02" "foobar");
446 ParsedCookie
pc5("\x05=value");
447 ParsedCookie
pc6("foo" "\x05" "bar=value");
448 ParsedCookie
pc7("foobar" "\x05" "=value");
449 ParsedCookie
pc8("\x05" "foobar" "=value");
451 ParsedCookie
pc9("foo" "\x05" "bar" "=foo" "\x05" "bar");
453 ParsedCookie
pc10("foo=bar;ba" "\x05" "z=boo");
454 ParsedCookie
pc11("foo=bar;baz=bo" "\x05" "o");
455 ParsedCookie
pc12("foo=bar;ba" "\05" "z=bo" "\x05" "o");
457 EXPECT_FALSE(pc1
.IsValid());
458 EXPECT_FALSE(pc2
.IsValid());
459 EXPECT_FALSE(pc3
.IsValid());
460 EXPECT_FALSE(pc4
.IsValid());
461 EXPECT_FALSE(pc5
.IsValid());
462 EXPECT_FALSE(pc6
.IsValid());
463 EXPECT_FALSE(pc7
.IsValid());
464 EXPECT_FALSE(pc8
.IsValid());
465 EXPECT_FALSE(pc9
.IsValid());
466 EXPECT_FALSE(pc10
.IsValid());
467 EXPECT_FALSE(pc11
.IsValid());
468 EXPECT_FALSE(pc12
.IsValid());
471 TEST(ParsedCookieTest
, ValidNonAlphanumericChars
) {
472 // Note that some of these words are pasted backwords thanks to poor vim bidi
473 // support. This should not affect the tests, however.
474 const char* pc1_literal
= "name=العربية";
475 const char* pc2_literal
= "name=普通話";
476 const char* pc3_literal
= "name=ภาษาไทย";
477 const char* pc4_literal
= "name=עִבְרִית";
478 const char* pc5_literal
= "العربية=value";
479 const char* pc6_literal
= "普通話=value";
480 const char* pc7_literal
= "ภาษาไทย=value";
481 const char* pc8_literal
= "עִבְרִית=value";
482 ParsedCookie
pc1(pc1_literal
);
483 ParsedCookie
pc2(pc2_literal
);
484 ParsedCookie
pc3(pc3_literal
);
485 ParsedCookie
pc4(pc4_literal
);
486 ParsedCookie
pc5(pc5_literal
);
487 ParsedCookie
pc6(pc6_literal
);
488 ParsedCookie
pc7(pc7_literal
);
489 ParsedCookie
pc8(pc8_literal
);
491 EXPECT_TRUE(pc1
.IsValid());
492 EXPECT_EQ(pc1_literal
, pc1
.ToCookieLine());
493 EXPECT_TRUE(pc2
.IsValid());
494 EXPECT_EQ(pc2_literal
, pc2
.ToCookieLine());
495 EXPECT_TRUE(pc3
.IsValid());
496 EXPECT_EQ(pc3_literal
, pc3
.ToCookieLine());
497 EXPECT_TRUE(pc4
.IsValid());
498 EXPECT_EQ(pc4_literal
, pc4
.ToCookieLine());
499 EXPECT_TRUE(pc5
.IsValid());
500 EXPECT_EQ(pc5_literal
, pc5
.ToCookieLine());
501 EXPECT_TRUE(pc6
.IsValid());
502 EXPECT_EQ(pc6_literal
, pc6
.ToCookieLine());
503 EXPECT_TRUE(pc7
.IsValid());
504 EXPECT_EQ(pc7_literal
, pc7
.ToCookieLine());
505 EXPECT_TRUE(pc8
.IsValid());
506 EXPECT_EQ(pc8_literal
, pc8
.ToCookieLine());