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

Unified Diff: net/cookies/cookie_monster_unittest.cc

Issue 1766613002: Revert of Replace std::string::find with base::StartsWith when comparing cookie paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/cookie_monster.cc ('k') | net/cookies/cookie_store_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_monster_unittest.cc
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index 8a884e938a65991a15f8db8352f4a56e7e1291da..4f64b2f00c23d9ff86a5526c2dffa8b40541a684 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -1565,6 +1565,27 @@
EXPECT_EQ("A2", cookies[3].Value());
EXPECT_EQ("B1", cookies[4].Value());
EXPECT_EQ("A1", cookies[5].Value());
+}
+
+TEST_F(CookieMonsterTest, DeleteCookieByName) {
+ scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL));
+
+ EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "A=A1; path=/"));
+ EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "A=A2; path=/foo"));
+ EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "A=A3; path=/bar"));
+ EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "B=B1; path=/"));
+ EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "B=B2; path=/foo"));
+ EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "B=B3; path=/bar"));
+
+ DeleteCookie(cm.get(), http_www_google_.AppendPath("foo/bar"), "A");
+
+ CookieList cookies = GetAllCookies(cm.get());
+ size_t expected_size = 4;
+ EXPECT_EQ(expected_size, cookies.size());
+ for (CookieList::iterator it = cookies.begin(); it != cookies.end(); ++it) {
+ EXPECT_NE("A1", it->Value());
+ EXPECT_NE("A2", it->Value());
+ }
}
// Tests importing from a persistent cookie store that contains duplicate
« no previous file with comments | « net/cookies/cookie_monster.cc ('k') | net/cookies/cookie_store_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698