| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "net/cookies/cookie_constants.h" | 7 #include "net/cookies/cookie_constants.h" |
| 8 #include "net/cookies/parsed_cookie.h" | 8 #include "net/cookies/parsed_cookie.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 ParsedCookie pc6("; path=/; secure;"); | 32 ParsedCookie pc6("; path=/; secure;"); |
| 33 EXPECT_FALSE(pc6.IsValid()); | 33 EXPECT_FALSE(pc6.IsValid()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 TEST(ParsedCookieTest, TestQuoted) { | 36 TEST(ParsedCookieTest, TestQuoted) { |
| 37 // These are some quoting cases which the major browsers all | 37 // These are some quoting cases which the major browsers all |
| 38 // handle differently. I've tested Internet Explorer 6, Opera 9.6, | 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 | 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. | 40 // Firefox closely, however we now match Internet Explorer and Safari. |
| 41 const char* const values[] = { | 41 const char* const values[] = { |
| 42 // Trailing whitespace after a quoted value. The whitespace after | 42 // Trailing whitespace after a quoted value. The whitespace after |
| 43 // the quote is stripped in all browsers. | 43 // the quote is stripped in all browsers. |
| 44 "\"zzz \" ", "\"zzz \"", | 44 "\"zzz \" ", |
| 45 // Handling a quoted value with a ';', like FOO="zz;pp" ; | 45 "\"zzz \"", |
| 46 // IE and Safari: "zz; | 46 // Handling a quoted value with a ';', like FOO="zz;pp" ; |
| 47 // Firefox and Opera: "zz;pp" | 47 // IE and Safari: "zz; |
| 48 "\"zz;pp\" ;", "\"zz", | 48 // Firefox and Opera: "zz;pp" |
| 49 // Handling a value with multiple quoted parts, like FOO="zzz " "ppp" ; | 49 "\"zz;pp\" ;", |
| 50 // IE and Safari: "zzz " "ppp"; | 50 "\"zz", |
| 51 // Firefox: "zzz "; | 51 // Handling a value with multiple quoted parts, like FOO="zzz " "ppp" ; |
| 52 // Opera: <rejects cookie> | 52 // IE and Safari: "zzz " "ppp"; |
| 53 "\"zzz \" \"ppp\" ", "\"zzz \" \"ppp\"", | 53 // Firefox: "zzz "; |
| 54 // A quote in a value that didn't start quoted. like FOO=A"B ; | 54 // Opera: <rejects cookie> |
| 55 // IE, Safari, and Firefox: A"B; | 55 "\"zzz \" \"ppp\" ", |
| 56 // Opera: <rejects cookie> | 56 "\"zzz \" \"ppp\"", |
| 57 "A\"B", "A\"B", | 57 // A quote in a value that didn't start quoted. like FOO=A"B ; |
| 58 // IE, Safari, and Firefox: A"B; |
| 59 // Opera: <rejects cookie> |
| 60 "A\"B", |
| 61 "A\"B", |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 for (size_t i = 0; i < arraysize(values); i += 2) { | 64 for (size_t i = 0; i < arraysize(values); i += 2) { |
| 61 std::string input(values[i]); | 65 std::string input(values[i]); |
| 62 std::string expected(values[i + 1]); | 66 std::string expected(values[i + 1]); |
| 63 | 67 |
| 64 ParsedCookie pc("aBc=" + input + " ; path=\"/\" ; httponly "); | 68 ParsedCookie pc("aBc=" + input + " ; path=\"/\" ; httponly "); |
| 65 EXPECT_TRUE(pc.IsValid()); | 69 EXPECT_TRUE(pc.IsValid()); |
| 66 EXPECT_FALSE(pc.IsSecure()); | 70 EXPECT_FALSE(pc.IsSecure()); |
| 67 EXPECT_TRUE(pc.IsHttpOnly()); | 71 EXPECT_TRUE(pc.IsHttpOnly()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 EXPECT_EQ("== BC", pc.Value()); | 166 EXPECT_EQ("== BC", pc.Value()); |
| 163 EXPECT_FALSE(pc.HasPath()); | 167 EXPECT_FALSE(pc.HasPath()); |
| 164 EXPECT_FALSE(pc.HasDomain()); | 168 EXPECT_FALSE(pc.HasDomain()); |
| 165 EXPECT_TRUE(pc.IsSecure()); | 169 EXPECT_TRUE(pc.IsSecure()); |
| 166 EXPECT_TRUE(pc.IsHttpOnly()); | 170 EXPECT_TRUE(pc.IsHttpOnly()); |
| 167 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); | 171 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); |
| 168 EXPECT_EQ(4U, pc.NumberOfAttributes()); | 172 EXPECT_EQ(4U, pc.NumberOfAttributes()); |
| 169 } | 173 } |
| 170 | 174 |
| 171 TEST(ParsedCookieTest, QuotedTrailingWhitespace) { | 175 TEST(ParsedCookieTest, QuotedTrailingWhitespace) { |
| 172 ParsedCookie pc("ANCUUID=\"zohNumRKgI0oxyhSsV3Z7D\" ; " | 176 ParsedCookie pc( |
| 173 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; " | 177 "ANCUUID=\"zohNumRKgI0oxyhSsV3Z7D\" ; " |
| 174 "path=/ ; "); | 178 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; " |
| 179 "path=/ ; "); |
| 175 EXPECT_TRUE(pc.IsValid()); | 180 EXPECT_TRUE(pc.IsValid()); |
| 176 EXPECT_EQ("ANCUUID", pc.Name()); | 181 EXPECT_EQ("ANCUUID", pc.Name()); |
| 177 // Stripping whitespace after the quotes matches all other major browsers. | 182 // Stripping whitespace after the quotes matches all other major browsers. |
| 178 EXPECT_EQ("\"zohNumRKgI0oxyhSsV3Z7D\"", pc.Value()); | 183 EXPECT_EQ("\"zohNumRKgI0oxyhSsV3Z7D\"", pc.Value()); |
| 179 EXPECT_TRUE(pc.HasExpires()); | 184 EXPECT_TRUE(pc.HasExpires()); |
| 180 EXPECT_TRUE(pc.HasPath()); | 185 EXPECT_TRUE(pc.HasPath()); |
| 181 EXPECT_EQ("/", pc.Path()); | 186 EXPECT_EQ("/", pc.Path()); |
| 182 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); | 187 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); |
| 183 EXPECT_EQ(2U, pc.NumberOfAttributes()); | 188 EXPECT_EQ(2U, pc.NumberOfAttributes()); |
| 184 } | 189 } |
| 185 | 190 |
| 186 TEST(ParsedCookieTest, TrailingWhitespace) { | 191 TEST(ParsedCookieTest, TrailingWhitespace) { |
| 187 ParsedCookie pc("ANCUUID=zohNumRKgI0oxyhSsV3Z7D ; " | 192 ParsedCookie pc( |
| 188 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; " | 193 "ANCUUID=zohNumRKgI0oxyhSsV3Z7D ; " |
| 189 "path=/ ; "); | 194 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; " |
| 195 "path=/ ; "); |
| 190 EXPECT_TRUE(pc.IsValid()); | 196 EXPECT_TRUE(pc.IsValid()); |
| 191 EXPECT_EQ("ANCUUID", pc.Name()); | 197 EXPECT_EQ("ANCUUID", pc.Name()); |
| 192 EXPECT_EQ("zohNumRKgI0oxyhSsV3Z7D", pc.Value()); | 198 EXPECT_EQ("zohNumRKgI0oxyhSsV3Z7D", pc.Value()); |
| 193 EXPECT_TRUE(pc.HasExpires()); | 199 EXPECT_TRUE(pc.HasExpires()); |
| 194 EXPECT_TRUE(pc.HasPath()); | 200 EXPECT_TRUE(pc.HasPath()); |
| 195 EXPECT_EQ("/", pc.Path()); | 201 EXPECT_EQ("/", pc.Path()); |
| 196 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); | 202 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); |
| 197 EXPECT_EQ(2U, pc.NumberOfAttributes()); | 203 EXPECT_EQ(2U, pc.NumberOfAttributes()); |
| 198 } | 204 } |
| 199 | 205 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 EXPECT_EQ("BB", pc1.Value()); | 247 EXPECT_EQ("BB", pc1.Value()); |
| 242 EXPECT_TRUE(pc2.IsValid()); | 248 EXPECT_TRUE(pc2.IsValid()); |
| 243 EXPECT_EQ("AAA", pc2.Name()); | 249 EXPECT_EQ("AAA", pc2.Name()); |
| 244 EXPECT_EQ("BB", pc2.Value()); | 250 EXPECT_EQ("BB", pc2.Value()); |
| 245 EXPECT_TRUE(pc3.IsValid()); | 251 EXPECT_TRUE(pc3.IsValid()); |
| 246 EXPECT_EQ("AAA", pc3.Name()); | 252 EXPECT_EQ("AAA", pc3.Name()); |
| 247 EXPECT_EQ("BB", pc3.Value()); | 253 EXPECT_EQ("BB", pc3.Value()); |
| 248 } | 254 } |
| 249 | 255 |
| 250 TEST(ParsedCookieTest, ParseTokensAndValues) { | 256 TEST(ParsedCookieTest, ParseTokensAndValues) { |
| 251 EXPECT_EQ("hello", | 257 EXPECT_EQ("hello", ParsedCookie::ParseTokenString("hello\nworld")); |
| 252 ParsedCookie::ParseTokenString("hello\nworld")); | 258 EXPECT_EQ("fs!!@", ParsedCookie::ParseTokenString("fs!!@;helloworld")); |
| 253 EXPECT_EQ("fs!!@", | |
| 254 ParsedCookie::ParseTokenString("fs!!@;helloworld")); | |
| 255 EXPECT_EQ("hello world\tgood", | 259 EXPECT_EQ("hello world\tgood", |
| 256 ParsedCookie::ParseTokenString("hello world\tgood\rbye")); | 260 ParsedCookie::ParseTokenString("hello world\tgood\rbye")); |
| 257 EXPECT_EQ("A", | 261 EXPECT_EQ("A", ParsedCookie::ParseTokenString("A=B=C;D=E")); |
| 258 ParsedCookie::ParseTokenString("A=B=C;D=E")); | 262 EXPECT_EQ("hello", ParsedCookie::ParseValueString("hello\nworld")); |
| 259 EXPECT_EQ("hello", | 263 EXPECT_EQ("fs!!@", ParsedCookie::ParseValueString("fs!!@;helloworld")); |
| 260 ParsedCookie::ParseValueString("hello\nworld")); | |
| 261 EXPECT_EQ("fs!!@", | |
| 262 ParsedCookie::ParseValueString("fs!!@;helloworld")); | |
| 263 EXPECT_EQ("hello world\tgood", | 264 EXPECT_EQ("hello world\tgood", |
| 264 ParsedCookie::ParseValueString("hello world\tgood\rbye")); | 265 ParsedCookie::ParseValueString("hello world\tgood\rbye")); |
| 265 EXPECT_EQ("A=B=C", | 266 EXPECT_EQ("A=B=C", ParsedCookie::ParseValueString("A=B=C;D=E")); |
| 266 ParsedCookie::ParseValueString("A=B=C;D=E")); | |
| 267 } | 267 } |
| 268 | 268 |
| 269 TEST(ParsedCookieTest, SerializeCookieLine) { | 269 TEST(ParsedCookieTest, SerializeCookieLine) { |
| 270 const char input[] = "ANCUUID=zohNumRKgI0oxyhSsV3Z7D ; " | 270 const char input[] = |
| 271 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; " | 271 "ANCUUID=zohNumRKgI0oxyhSsV3Z7D ; " |
| 272 "path=/ ; priority=low ; "; | 272 "expires=Sun, 18-Apr-2027 21:06:29 GMT ; " |
| 273 const char output[] = "ANCUUID=zohNumRKgI0oxyhSsV3Z7D; " | 273 "path=/ ; priority=low ; "; |
| 274 "expires=Sun, 18-Apr-2027 21:06:29 GMT; " | 274 const char output[] = |
| 275 "path=/; priority=low"; | 275 "ANCUUID=zohNumRKgI0oxyhSsV3Z7D; " |
| 276 "expires=Sun, 18-Apr-2027 21:06:29 GMT; " |
| 277 "path=/; priority=low"; |
| 276 ParsedCookie pc(input); | 278 ParsedCookie pc(input); |
| 277 EXPECT_EQ(output, pc.ToCookieLine()); | 279 EXPECT_EQ(output, pc.ToCookieLine()); |
| 278 } | 280 } |
| 279 | 281 |
| 280 | |
| 281 TEST(ParsedCookieTest, SetNameAndValue) { | 282 TEST(ParsedCookieTest, SetNameAndValue) { |
| 282 ParsedCookie empty((std::string())); | 283 ParsedCookie empty((std::string())); |
| 283 EXPECT_FALSE(empty.IsValid()); | 284 EXPECT_FALSE(empty.IsValid()); |
| 284 EXPECT_FALSE(empty.SetDomain("foobar.com")); | 285 EXPECT_FALSE(empty.SetDomain("foobar.com")); |
| 285 EXPECT_TRUE(empty.SetName("name")); | 286 EXPECT_TRUE(empty.SetName("name")); |
| 286 EXPECT_TRUE(empty.SetValue("value")); | 287 EXPECT_TRUE(empty.SetValue("value")); |
| 287 EXPECT_EQ("name=value", empty.ToCookieLine()); | 288 EXPECT_EQ("name=value", empty.ToCookieLine()); |
| 288 EXPECT_TRUE(empty.IsValid()); | 289 EXPECT_TRUE(empty.IsValid()); |
| 289 | 290 |
| 290 // We don't test | 291 // We don't test |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 347 |
| 347 // Set all other attributes and check that they are appended in order. | 348 // Set all other attributes and check that they are appended in order. |
| 348 EXPECT_TRUE(pc.SetDomain("domain.com")); | 349 EXPECT_TRUE(pc.SetDomain("domain.com")); |
| 349 EXPECT_TRUE(pc.SetPath("/")); | 350 EXPECT_TRUE(pc.SetPath("/")); |
| 350 EXPECT_TRUE(pc.SetExpires("Sun, 18-Apr-2027 21:06:29 GMT")); | 351 EXPECT_TRUE(pc.SetExpires("Sun, 18-Apr-2027 21:06:29 GMT")); |
| 351 EXPECT_TRUE(pc.SetMaxAge("12345")); | 352 EXPECT_TRUE(pc.SetMaxAge("12345")); |
| 352 EXPECT_TRUE(pc.SetIsSecure(true)); | 353 EXPECT_TRUE(pc.SetIsSecure(true)); |
| 353 EXPECT_TRUE(pc.SetIsHttpOnly(true)); | 354 EXPECT_TRUE(pc.SetIsHttpOnly(true)); |
| 354 EXPECT_TRUE(pc.SetIsHttpOnly(true)); | 355 EXPECT_TRUE(pc.SetIsHttpOnly(true)); |
| 355 EXPECT_TRUE(pc.SetPriority("HIGH")); | 356 EXPECT_TRUE(pc.SetPriority("HIGH")); |
| 356 EXPECT_EQ("name=value; domain=domain.com; path=/; " | 357 EXPECT_EQ( |
| 357 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; " | 358 "name=value; domain=domain.com; path=/; " |
| 358 "httponly; priority=HIGH", | 359 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; " |
| 359 pc.ToCookieLine()); | 360 "httponly; priority=HIGH", |
| 361 pc.ToCookieLine()); |
| 360 EXPECT_TRUE(pc.HasDomain()); | 362 EXPECT_TRUE(pc.HasDomain()); |
| 361 EXPECT_TRUE(pc.HasPath()); | 363 EXPECT_TRUE(pc.HasPath()); |
| 362 EXPECT_TRUE(pc.HasExpires()); | 364 EXPECT_TRUE(pc.HasExpires()); |
| 363 EXPECT_TRUE(pc.HasMaxAge()); | 365 EXPECT_TRUE(pc.HasMaxAge()); |
| 364 EXPECT_TRUE(pc.IsSecure()); | 366 EXPECT_TRUE(pc.IsSecure()); |
| 365 EXPECT_TRUE(pc.IsHttpOnly()); | 367 EXPECT_TRUE(pc.IsHttpOnly()); |
| 366 EXPECT_EQ(COOKIE_PRIORITY_HIGH, pc.Priority()); | 368 EXPECT_EQ(COOKIE_PRIORITY_HIGH, pc.Priority()); |
| 367 | 369 |
| 368 // Clear one attribute from the middle. | 370 // Clear one attribute from the middle. |
| 369 EXPECT_TRUE(pc.SetPath("/foo")); | 371 EXPECT_TRUE(pc.SetPath("/foo")); |
| 370 EXPECT_TRUE(pc.HasDomain()); | 372 EXPECT_TRUE(pc.HasDomain()); |
| 371 EXPECT_TRUE(pc.HasPath()); | 373 EXPECT_TRUE(pc.HasPath()); |
| 372 EXPECT_TRUE(pc.HasExpires()); | 374 EXPECT_TRUE(pc.HasExpires()); |
| 373 EXPECT_TRUE(pc.IsSecure()); | 375 EXPECT_TRUE(pc.IsSecure()); |
| 374 EXPECT_TRUE(pc.IsHttpOnly()); | 376 EXPECT_TRUE(pc.IsHttpOnly()); |
| 375 EXPECT_EQ("name=value; domain=domain.com; path=/foo; " | 377 EXPECT_EQ( |
| 376 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; " | 378 "name=value; domain=domain.com; path=/foo; " |
| 377 "httponly; priority=HIGH", | 379 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; " |
| 378 pc.ToCookieLine()); | 380 "httponly; priority=HIGH", |
| 381 pc.ToCookieLine()); |
| 379 | 382 |
| 380 // Set priority to medium. | 383 // Set priority to medium. |
| 381 EXPECT_TRUE(pc.SetPriority("medium")); | 384 EXPECT_TRUE(pc.SetPriority("medium")); |
| 382 EXPECT_EQ("name=value; domain=domain.com; path=/foo; " | 385 EXPECT_EQ( |
| 383 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; " | 386 "name=value; domain=domain.com; path=/foo; " |
| 384 "httponly; priority=medium", | 387 "expires=Sun, 18-Apr-2027 21:06:29 GMT; max-age=12345; secure; " |
| 385 pc.ToCookieLine()); | 388 "httponly; priority=medium", |
| 389 pc.ToCookieLine()); |
| 386 | 390 |
| 387 // Clear the rest and change the name and value. | 391 // Clear the rest and change the name and value. |
| 388 EXPECT_TRUE(pc.SetDomain(std::string())); | 392 EXPECT_TRUE(pc.SetDomain(std::string())); |
| 389 EXPECT_TRUE(pc.SetPath(std::string())); | 393 EXPECT_TRUE(pc.SetPath(std::string())); |
| 390 EXPECT_TRUE(pc.SetExpires(std::string())); | 394 EXPECT_TRUE(pc.SetExpires(std::string())); |
| 391 EXPECT_TRUE(pc.SetMaxAge(std::string())); | 395 EXPECT_TRUE(pc.SetMaxAge(std::string())); |
| 392 EXPECT_TRUE(pc.SetIsSecure(false)); | 396 EXPECT_TRUE(pc.SetIsSecure(false)); |
| 393 EXPECT_TRUE(pc.SetIsHttpOnly(false)); | 397 EXPECT_TRUE(pc.SetIsHttpOnly(false)); |
| 394 EXPECT_TRUE(pc.SetName("name2")); | 398 EXPECT_TRUE(pc.SetName("name2")); |
| 395 EXPECT_TRUE(pc.SetValue("value2")); | 399 EXPECT_TRUE(pc.SetValue("value2")); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 EXPECT_EQ("name=value; priority=lowerest", pc.ToCookieLine()); | 436 EXPECT_EQ("name=value; priority=lowerest", pc.ToCookieLine()); |
| 433 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); | 437 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); |
| 434 | 438 |
| 435 EXPECT_TRUE(pc.SetPriority("")); | 439 EXPECT_TRUE(pc.SetPriority("")); |
| 436 EXPECT_EQ("name=value", pc.ToCookieLine()); | 440 EXPECT_EQ("name=value", pc.ToCookieLine()); |
| 437 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); | 441 EXPECT_EQ(COOKIE_PRIORITY_DEFAULT, pc.Priority()); |
| 438 } | 442 } |
| 439 | 443 |
| 440 TEST(ParsedCookieTest, InvalidNonAlphanumericChars) { | 444 TEST(ParsedCookieTest, InvalidNonAlphanumericChars) { |
| 441 ParsedCookie pc1("name=\x05"); | 445 ParsedCookie pc1("name=\x05"); |
| 442 ParsedCookie pc2("name=foo" "\x1c" "bar"); | 446 ParsedCookie pc2( |
| 443 ParsedCookie pc3("name=foobar" "\x11"); | 447 "name=foo" |
| 444 ParsedCookie pc4("name=\x02" "foobar"); | 448 "\x1c" |
| 449 "bar"); |
| 450 ParsedCookie pc3( |
| 451 "name=foobar" |
| 452 "\x11"); |
| 453 ParsedCookie pc4( |
| 454 "name=\x02" |
| 455 "foobar"); |
| 445 | 456 |
| 446 ParsedCookie pc5("\x05=value"); | 457 ParsedCookie pc5("\x05=value"); |
| 447 ParsedCookie pc6("foo" "\x05" "bar=value"); | 458 ParsedCookie pc6( |
| 448 ParsedCookie pc7("foobar" "\x05" "=value"); | 459 "foo" |
| 449 ParsedCookie pc8("\x05" "foobar" "=value"); | 460 "\x05" |
| 461 "bar=value"); |
| 462 ParsedCookie pc7( |
| 463 "foobar" |
| 464 "\x05" |
| 465 "=value"); |
| 466 ParsedCookie pc8( |
| 467 "\x05" |
| 468 "foobar" |
| 469 "=value"); |
| 450 | 470 |
| 451 ParsedCookie pc9("foo" "\x05" "bar" "=foo" "\x05" "bar"); | 471 ParsedCookie pc9( |
| 472 "foo" |
| 473 "\x05" |
| 474 "bar" |
| 475 "=foo" |
| 476 "\x05" |
| 477 "bar"); |
| 452 | 478 |
| 453 ParsedCookie pc10("foo=bar;ba" "\x05" "z=boo"); | 479 ParsedCookie pc10( |
| 454 ParsedCookie pc11("foo=bar;baz=bo" "\x05" "o"); | 480 "foo=bar;ba" |
| 455 ParsedCookie pc12("foo=bar;ba" "\05" "z=bo" "\x05" "o"); | 481 "\x05" |
| 482 "z=boo"); |
| 483 ParsedCookie pc11( |
| 484 "foo=bar;baz=bo" |
| 485 "\x05" |
| 486 "o"); |
| 487 ParsedCookie pc12( |
| 488 "foo=bar;ba" |
| 489 "\05" |
| 490 "z=bo" |
| 491 "\x05" |
| 492 "o"); |
| 456 | 493 |
| 457 EXPECT_FALSE(pc1.IsValid()); | 494 EXPECT_FALSE(pc1.IsValid()); |
| 458 EXPECT_FALSE(pc2.IsValid()); | 495 EXPECT_FALSE(pc2.IsValid()); |
| 459 EXPECT_FALSE(pc3.IsValid()); | 496 EXPECT_FALSE(pc3.IsValid()); |
| 460 EXPECT_FALSE(pc4.IsValid()); | 497 EXPECT_FALSE(pc4.IsValid()); |
| 461 EXPECT_FALSE(pc5.IsValid()); | 498 EXPECT_FALSE(pc5.IsValid()); |
| 462 EXPECT_FALSE(pc6.IsValid()); | 499 EXPECT_FALSE(pc6.IsValid()); |
| 463 EXPECT_FALSE(pc7.IsValid()); | 500 EXPECT_FALSE(pc7.IsValid()); |
| 464 EXPECT_FALSE(pc8.IsValid()); | 501 EXPECT_FALSE(pc8.IsValid()); |
| 465 EXPECT_FALSE(pc9.IsValid()); | 502 EXPECT_FALSE(pc9.IsValid()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 EXPECT_EQ(pc4_literal, pc4.ToCookieLine()); | 535 EXPECT_EQ(pc4_literal, pc4.ToCookieLine()); |
| 499 EXPECT_TRUE(pc5.IsValid()); | 536 EXPECT_TRUE(pc5.IsValid()); |
| 500 EXPECT_EQ(pc5_literal, pc5.ToCookieLine()); | 537 EXPECT_EQ(pc5_literal, pc5.ToCookieLine()); |
| 501 EXPECT_TRUE(pc6.IsValid()); | 538 EXPECT_TRUE(pc6.IsValid()); |
| 502 EXPECT_EQ(pc6_literal, pc6.ToCookieLine()); | 539 EXPECT_EQ(pc6_literal, pc6.ToCookieLine()); |
| 503 EXPECT_TRUE(pc7.IsValid()); | 540 EXPECT_TRUE(pc7.IsValid()); |
| 504 EXPECT_EQ(pc7_literal, pc7.ToCookieLine()); | 541 EXPECT_EQ(pc7_literal, pc7.ToCookieLine()); |
| 505 EXPECT_TRUE(pc8.IsValid()); | 542 EXPECT_TRUE(pc8.IsValid()); |
| 506 EXPECT_EQ(pc8_literal, pc8.ToCookieLine()); | 543 EXPECT_EQ(pc8_literal, pc8.ToCookieLine()); |
| 507 } | 544 } |
| 508 | |
| 509 } | 545 } |
| OLD | NEW |