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

Unified Diff: net/cookies/parsed_cookie_unittest.cc

Issue 2876463006: Allow an arbitrary number of cookie string pairs. (Closed)
Patch Set: Created 3 years, 7 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/parsed_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/parsed_cookie_unittest.cc
diff --git a/net/cookies/parsed_cookie_unittest.cc b/net/cookies/parsed_cookie_unittest.cc
index 61a7d0454d61667ef14126f082439e6153800d47..562bb100b57c7d60be109ef7afae9730e0173c94 100644
--- a/net/cookies/parsed_cookie_unittest.cc
+++ b/net/cookies/parsed_cookie_unittest.cc
@@ -217,17 +217,17 @@ TEST(ParsedCookieTest, TrailingWhitespace) {
EXPECT_EQ(2U, pc.NumberOfAttributes());
}
-TEST(ParsedCookieTest, TooManyPairs) {
- std::string blankpairs;
- blankpairs.resize(ParsedCookie::kMaxPairs - 2, ';');
-
- ParsedCookie pc1("a=b;" + blankpairs + "secure");
- EXPECT_TRUE(pc1.IsValid());
- EXPECT_TRUE(pc1.IsSecure());
-
- ParsedCookie pc2("a=b;" + blankpairs + ";secure");
- EXPECT_TRUE(pc2.IsValid());
- EXPECT_FALSE(pc2.IsSecure());
+TEST(ParsedCookieTest, LotsOfPairs) {
+ for (int i = 1; i < 100; i++) {
+ std::string blankpairs;
+ blankpairs.resize(i, ';');
+
+ ParsedCookie c("a=b;" + blankpairs + "secure");
+ EXPECT_EQ("a", c.Name());
+ EXPECT_EQ("b", c.Value());
+ EXPECT_TRUE(c.IsValid());
+ EXPECT_TRUE(c.IsSecure());
+ }
}
// TODO(erikwright): some better test cases for invalid cookies.
« no previous file with comments | « net/cookies/parsed_cookie.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698