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

Unified Diff: net/cookies/cookie_monster_unittest.cc

Issue 2930893002: Change all "google.com" references in net/cookies to "foo.com" to avoid repeatedly tripping ov… (Closed)
Patch Set: 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
Index: net/cookies/cookie_monster_unittest.cc
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index 3b958f2703ededa5bf8a5d496e16d9d62af423f2..16449d88d9b52475dd1b38fd1a391093600b81c4 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -1744,20 +1744,20 @@ TEST_F(CookieMonsterTest, DontImportDuplicateCookies) {
// dates. We expect only the most recent one to be preserved following
// the import.
- AddCookieToList(GURL("http://www.google.com"),
+ AddCookieToList(GURL("http://www.google.izzle"),
"X=1; path=/; expires=Mon, 18-Apr-22 22:50:14 GMT",
Time::Now() + TimeDelta::FromDays(3), &initial_cookies);
- AddCookieToList(GURL("http://www.google.com"),
+ AddCookieToList(GURL("http://www.google.izzle"),
"X=2; path=/; expires=Mon, 18-Apr-22 22:50:14 GMT",
Time::Now() + TimeDelta::FromDays(1), &initial_cookies);
// ===> This one is the WINNER (biggest creation time). <====
- AddCookieToList(GURL("http://www.google.com"),
+ AddCookieToList(GURL("http://www.google.izzle"),
"X=3; path=/; expires=Mon, 18-Apr-22 22:50:14 GMT",
Time::Now() + TimeDelta::FromDays(4), &initial_cookies);
- AddCookieToList(GURL("http://www.google.com"),
+ AddCookieToList(GURL("http://www.google.izzle"),
"X=4; path=/; expires=Mon, 18-Apr-22 22:50:14 GMT",
Time::Now(), &initial_cookies);
@@ -1765,16 +1765,16 @@ TEST_F(CookieMonsterTest, DontImportDuplicateCookies) {
// dates. We expect only the most recent one to be preserved the import.
// ===> This one is the WINNER (biggest creation time). <====
- AddCookieToList(GURL("http://www.google.com"),
+ AddCookieToList(GURL("http://www.google.izzle"),
"X=a1; path=/2; expires=Mon, 18-Apr-22 22:50:14 GMT",
Time::Now() + TimeDelta::FromDays(9), &initial_cookies);
- AddCookieToList(GURL("http://www.google.com"),
+ AddCookieToList(GURL("http://www.google.izzle"),
"X=a2; path=/2; expires=Mon, 18-Apr-22 22:50:14 GMT",
Time::Now() + TimeDelta::FromDays(2), &initial_cookies);
// Insert 1 cookie with name "Y" on path "/".
- AddCookieToList(GURL("http://www.google.com"),
+ AddCookieToList(GURL("http://www.google.izzle"),
"Y=a; path=/; expires=Mon, 18-Apr-22 22:50:14 GMT",
Time::Now() + TimeDelta::FromDays(10), &initial_cookies);
@@ -1785,12 +1785,12 @@ TEST_F(CookieMonsterTest, DontImportDuplicateCookies) {
// Verify that duplicates were not imported for path "/".
// (If this had failed, GetCookies() would have also returned X=1, X=2, X=4).
- EXPECT_EQ("X=3; Y=a", GetCookies(cm.get(), GURL("http://www.google.com/")));
+ EXPECT_EQ("X=3; Y=a", GetCookies(cm.get(), GURL("http://www.google.izzle/")));
// Verify that same-named cookie on a different path ("/x2") didn't get
// messed up.
EXPECT_EQ("X=a1; X=3; Y=a",
- GetCookies(cm.get(), GURL("http://www.google.com/2/x")));
+ GetCookies(cm.get(), GURL("http://www.google.izzle/2/x")));
// Verify that the PersistentCookieStore was told to kill its 4 duplicates.
ASSERT_EQ(4u, store->commands().size());
@@ -1816,22 +1816,22 @@ TEST_F(CookieMonsterTest, DontImportDuplicateCreationTimes) {
// two cookies remaining, but which two (other than that there should
// be one from each set) will be random.
std::vector<std::unique_ptr<CanonicalCookie>> initial_cookies;
- AddCookieToList(GURL("http://www.google.com"), "X=1; path=/", now,
+ AddCookieToList(GURL("http://www.google.izzle"), "X=1; path=/", now,
&initial_cookies);
- AddCookieToList(GURL("http://www.google.com"), "X=2; path=/", now,
+ AddCookieToList(GURL("http://www.google.izzle"), "X=2; path=/", now,
&initial_cookies);
- AddCookieToList(GURL("http://www.google.com"), "X=3; path=/", now,
+ AddCookieToList(GURL("http://www.google.izzle"), "X=3; path=/", now,
&initial_cookies);
- AddCookieToList(GURL("http://www.google.com"), "X=4; path=/", now,
+ AddCookieToList(GURL("http://www.google.izzle"), "X=4; path=/", now,
&initial_cookies);
- AddCookieToList(GURL("http://www.google.com"), "Y=1; path=/", earlier,
+ AddCookieToList(GURL("http://www.google.izzle"), "Y=1; path=/", earlier,
&initial_cookies);
- AddCookieToList(GURL("http://www.google.com"), "Y=2; path=/", earlier,
+ AddCookieToList(GURL("http://www.google.izzle"), "Y=2; path=/", earlier,
&initial_cookies);
- AddCookieToList(GURL("http://www.google.com"), "Y=3; path=/", earlier,
+ AddCookieToList(GURL("http://www.google.izzle"), "Y=3; path=/", earlier,
&initial_cookies);
- AddCookieToList(GURL("http://www.google.com"), "Y=4; path=/", earlier,
+ AddCookieToList(GURL("http://www.google.izzle"), "Y=4; path=/", earlier,
&initial_cookies);
// Inject our initial cookies into the mock PersistentCookieStore.
@@ -2020,7 +2020,7 @@ TEST_F(CookieMonsterTest, GetKey) {
std::unique_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr));
// This test is really only interesting if GetKey() actually does something.
- EXPECT_EQ("google.com", cm->GetKey("www.google.com"));
+ EXPECT_EQ("google.izzle", cm->GetKey("www.google.izzle"));
EXPECT_EQ("google.izzie", cm->GetKey("www.google.izzie"));
EXPECT_EQ("google.izzie", cm->GetKey(".google.izzie"));
EXPECT_EQ("bbc.co.uk", cm->GetKey("bbc.co.uk"));
@@ -2049,12 +2049,13 @@ TEST_F(CookieMonsterTest, BackingStoreCommunication) {
base::Time expires(base::Time::Now() + base::TimeDelta::FromSeconds(100));
const CookiesInputInfo input_info[] = {
- {GURL("http://a.b.google.com"), "a", "1", "", "/path/to/cookie", expires,
- false, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT},
- {GURL("https://www.google.com"), "b", "2", ".google.com",
+ {GURL("http://a.b.google.izzle"), "a", "1", "", "/path/to/cookie",
+ expires, false, false, CookieSameSite::DEFAULT_MODE,
+ COOKIE_PRIORITY_DEFAULT},
+ {GURL("https://www.google.izzle"), "b", "2", ".google.izzle",
"/path/from/cookie", expires + TimeDelta::FromSeconds(10), true, true,
CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT},
- {GURL("https://google.com"), "c", "3", "", "/another/path/to/cookie",
+ {GURL("https://google.izzle"), "c", "3", "", "/another/path/to/cookie",
base::Time::Now() + base::TimeDelta::FromSeconds(100), true, false,
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT}};
const int INPUT_DELETE = 1;
@@ -2110,23 +2111,25 @@ TEST_F(CookieMonsterTest, CookieListOrdering) {
// Put a random set of cookies into a monster and make sure
// they're returned in the right order.
std::unique_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr));
- EXPECT_TRUE(
- SetCookie(cm.get(), GURL("http://d.c.b.a.google.com/aa/x.html"), "c=1"));
- EXPECT_TRUE(SetCookie(cm.get(), GURL("http://b.a.google.com/aa/bb/cc/x.html"),
- "d=1; domain=b.a.google.com"));
- EXPECT_TRUE(SetCookie(cm.get(), GURL("http://b.a.google.com/aa/bb/cc/x.html"),
- "a=4; domain=b.a.google.com"));
+ EXPECT_TRUE(SetCookie(cm.get(), GURL("http://d.c.b.a.google.izzle/aa/x.html"),
+ "c=1"));
+ EXPECT_TRUE(SetCookie(cm.get(),
+ GURL("http://b.a.google.izzle/aa/bb/cc/x.html"),
+ "d=1; domain=b.a.google.izzle"));
EXPECT_TRUE(SetCookie(cm.get(),
- GURL("http://c.b.a.google.com/aa/bb/cc/x.html"),
- "e=1; domain=c.b.a.google.com"));
+ GURL("http://b.a.google.izzle/aa/bb/cc/x.html"),
+ "a=4; domain=b.a.google.izzle"));
EXPECT_TRUE(SetCookie(cm.get(),
- GURL("http://d.c.b.a.google.com/aa/bb/x.html"), "b=1"));
+ GURL("http://c.b.a.google.izzle/aa/bb/cc/x.html"),
+ "e=1; domain=c.b.a.google.izzle"));
+ EXPECT_TRUE(SetCookie(
+ cm.get(), GURL("http://d.c.b.a.google.izzle/aa/bb/x.html"), "b=1"));
EXPECT_TRUE(SetCookie(cm.get(), GURL("http://news.bbc.co.uk/midpath/x.html"),
"g=10"));
{
unsigned int i = 0;
CookieList cookies(GetAllCookiesForURL(
- cm.get(), GURL("http://d.c.b.a.google.com/aa/bb/cc/dd")));
+ cm.get(), GURL("http://d.c.b.a.google.izzle/aa/bb/cc/dd")));
ASSERT_EQ(5u, cookies.size());
EXPECT_EQ("d", cookies[i++].Name());
EXPECT_EQ("a", cookies[i++].Name());
@@ -3051,9 +3054,9 @@ TEST_F(CookieMonsterTest, CookieDeleteEquivalentHistogramTest) {
TEST_F(CookieMonsterTest, SetSecureCookies) {
std::unique_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr));
- GURL http_url("http://www.google.com");
- GURL http_superdomain_url("http://google.com");
- GURL https_url("https://www.google.com");
+ GURL http_url("http://www.google.izzle");
+ GURL http_superdomain_url("http://google.izzle");
+ GURL https_url("https://www.google.izzle");
// A non-secure cookie can be created from either a URL with a secure or
// insecure scheme.
@@ -3101,13 +3104,14 @@ TEST_F(CookieMonsterTest, SetSecureCookies) {
// a secure cookie with the same name already exists, if the domain strings
// domain-match, do not update the cookie.
EXPECT_TRUE(SetCookie(cm.get(), https_url, "A=B; Secure"));
- EXPECT_FALSE(SetCookie(cm.get(), http_url, "A=C; domain=google.com"));
- EXPECT_FALSE(SetCookie(cm.get(), http_url, "A=C; domain=www.google.com"));
+ EXPECT_FALSE(SetCookie(cm.get(), http_url, "A=C; domain=google.izzle"));
+ EXPECT_FALSE(SetCookie(cm.get(), http_url, "A=C; domain=www.google.izzle"));
// Since A=B was set above with no domain string, set a different cookie here
// so the insecure examples aren't trying to overwrite the one above.
- EXPECT_TRUE(SetCookie(cm.get(), https_url, "B=C; Secure; domain=google.com"));
- EXPECT_FALSE(SetCookie(cm.get(), http_url, "B=D; domain=google.com"));
+ EXPECT_TRUE(
+ SetCookie(cm.get(), https_url, "B=C; Secure; domain=google.izzle"));
+ EXPECT_FALSE(SetCookie(cm.get(), http_url, "B=D; domain=google.izzle"));
EXPECT_FALSE(SetCookie(cm.get(), http_url, "B=D"));
EXPECT_FALSE(SetCookie(cm.get(), http_superdomain_url, "B=D"));
@@ -3254,9 +3258,9 @@ TEST_F(CookieMonsterTest, EvictSecureCookies) {
// accidentally. Regression test for https://crbug.com/569943.
TEST_F(CookieMonsterTest, EquivalentCookies) {
std::unique_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr));
- GURL http_url("http://www.google.com");
- GURL http_superdomain_url("http://google.com");
- GURL https_url("https://www.google.com");
+ GURL http_url("http://www.google.izzle");
+ GURL http_superdomain_url("http://google.izzle");
+ GURL https_url("https://www.google.izzle");
// Tests that non-equivalent cookies because of the path attribute can be set
// successfully.
@@ -3267,14 +3271,14 @@ TEST_F(CookieMonsterTest, EquivalentCookies) {
// Tests that non-equivalent cookies because of the domain attribute can be
// set successfully.
EXPECT_TRUE(SetCookie(cm.get(), https_url, "A=B; Secure"));
- EXPECT_TRUE(SetCookie(cm.get(), https_url, "A=C; domain=google.com"));
- EXPECT_FALSE(SetCookie(cm.get(), http_url, "A=D; domain=google.com"));
+ EXPECT_TRUE(SetCookie(cm.get(), https_url, "A=C; domain=google.izzle"));
+ EXPECT_FALSE(SetCookie(cm.get(), http_url, "A=D; domain=google.izzle"));
}
class CookieMonsterNotificationTest : public CookieMonsterTest {
public:
CookieMonsterNotificationTest()
- : test_url_("http://www.google.com/foo"),
+ : test_url_("http://www.google.izzle/foo"),
store_(new MockPersistentCookieStore),
monster_(new CookieMonster(store_.get(), nullptr)) {}

Powered by Google App Engine
This is Rietveld 408576698