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

Unified Diff: net/cookies/canonical_cookie_unittest.cc

Issue 2959123002: Allow paths constructed from URLs rather as well as cookie attributes. (Closed)
Patch Set: Remove test for space in path--GURL escapes those. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cookies/canonical_cookie.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/canonical_cookie_unittest.cc
diff --git a/net/cookies/canonical_cookie_unittest.cc b/net/cookies/canonical_cookie_unittest.cc
index a2f3cf720231618598ab8d394370f44155915246..ecbe8a90de8c44848f88f7414272ff998f8da24b 100644
--- a/net/cookies/canonical_cookie_unittest.cc
+++ b/net/cookies/canonical_cookie_unittest.cc
@@ -44,14 +44,21 @@ TEST(CanonicalCookieTest, Constructor) {
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie2->SameSite());
}
-TEST(CanonicalCookie, SpaceInName) {
- GURL url("http://www.example.com/test/foo.html");
+TEST(CanonicalCookie, CreationCornerCases) {
base::Time creation_time = base::Time::Now();
CookieOptions options;
- std::unique_ptr<CanonicalCookie> cookie(
- CanonicalCookie::Create(url, "A C=2", creation_time, options));
+ std::unique_ptr<CanonicalCookie> cookie;
+
+ // Space in name.
+ cookie = CanonicalCookie::Create(GURL("http://www.example.com/test/foo.html"),
+ "A C=2", creation_time, options);
EXPECT_TRUE(cookie.get());
EXPECT_EQ("A C", cookie->Name());
+
+ // Semicolon in path.
+ cookie = CanonicalCookie::Create(GURL("http://fool/;/"), "*", creation_time,
+ options);
+ EXPECT_TRUE(cookie.get());
}
TEST(CanonicalCookieTest, Create) {
@@ -742,20 +749,6 @@ TEST(CanonicalCookieTest, IsCanonical) {
COOKIE_PRIORITY_LOW)
.IsCanonical());
- // Path suffixed with a space.
- EXPECT_FALSE(CanonicalCookie("A", "B", "x.y", "/path ", base::Time(),
- base::Time(), base::Time(), false, false,
- CookieSameSite::NO_RESTRICTION,
- COOKIE_PRIORITY_LOW)
- .IsCanonical());
-
- // Path suffixed with separator.
- EXPECT_FALSE(CanonicalCookie("A", "B", "x.y", "/path;", base::Time(),
- base::Time(), base::Time(), false, false,
- CookieSameSite::NO_RESTRICTION,
- COOKIE_PRIORITY_LOW)
- .IsCanonical());
-
// Simple IPv4 address as domain.
EXPECT_TRUE(CanonicalCookie("A", "B", "1.2.3.4", "/path", base::Time(),
base::Time(), base::Time(), false, false,
« no previous file with comments | « net/cookies/canonical_cookie.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698