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

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 failing path tests. 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..50c95d8048ae8acb8ca74302a099555c5b0c6970 100644
--- a/net/cookies/canonical_cookie_unittest.cc
+++ b/net/cookies/canonical_cookie_unittest.cc
@@ -44,14 +44,26 @@ 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());
+
+ // Space in path.
+ cookie = CanonicalCookie::Create(GURL("http://fool/xyzzy wwwww/"), "A=B",
mmenke 2017/06/28 00:26:20 Doesn't GURL precent-escape spaces in paths?
Randy Smith (Not in Mondays) 2017/06/28 14:58:05 Yeah, it does :-J. Ok. What I think that means i
mmenke 2017/06/28 17:13:48 I'm wondering if it's worth the effort - I don't t
Randy Smith (Not in Mondays) 2017/06/28 17:41:21 Sure. My goal at the moment is just to get the fu
+ creation_time, options);
+ EXPECT_TRUE(cookie.get());
}
TEST(CanonicalCookieTest, Create) {
@@ -742,20 +754,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