Index: net/cookies/cookie_store_unittest.h |
diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h |
index 134a19339fe2f0161419283a135882f1e279e5db..0d2d7eda888bb561b28686a6f9af6c3814975a03 100644 |
--- a/net/cookies/cookie_store_unittest.h |
+++ b/net/cookies/cookie_store_unittest.h |
@@ -275,9 +275,10 @@ TYPED_TEST_P(CookieStoreTest, DomainTest) { |
// Test domain enforcement, should fail on a sub-domain or something too deep. |
EXPECT_FALSE(this->SetCookie(cs, this->url_google_, "I=J; domain=.izzle")); |
- this->MatchCookieLines("", this->GetCookies(cs, GURL("http://a.izzle"))); |
- EXPECT_FALSE(this->SetCookie(cs, this->url_google_, |
- "K=L; domain=.bla.www.google.izzle")); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, GURL("http://a.izzle"))); |
+ EXPECT_FALSE(this->SetCookie( |
+ cs, this->url_google_, "K=L; domain=.bla.www.google.izzle")); |
this->MatchCookieLines("C=D; E=F; G=H", |
this->GetCookies(cs, GURL("http://bla.www.google.izzle"))); |
this->MatchCookieLines("A=B; C=D; E=F; G=H", |
@@ -292,7 +293,8 @@ TYPED_TEST_P(CookieStoreTest, DomainWithTrailingDotTest) { |
"a=1; domain=.www.google.com.")); |
EXPECT_FALSE(this->SetCookie(cs, this->url_google_, |
"b=2; domain=.www.google.com..")); |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
} |
// Test that cookies can bet set on higher level domains. |
@@ -366,7 +368,7 @@ TYPED_TEST_P(CookieStoreTest, InvalidDomainTest) { |
EXPECT_FALSE(this->SetCookie(cs, url_foobar, |
"o=15; domain=.foo.bar.com#sup")); |
- this->MatchCookieLines("", this->GetCookies(cs, url_foobar)); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, url_foobar)); |
} |
{ |
@@ -377,7 +379,7 @@ TYPED_TEST_P(CookieStoreTest, InvalidDomainTest) { |
GURL url_foocom("http://foo.com.com"); |
EXPECT_FALSE(this->SetCookie(cs, url_foocom, |
"a=1; domain=.foo.com.com.com")); |
- this->MatchCookieLines("", this->GetCookies(cs, url_foocom)); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, url_foocom)); |
} |
} |
@@ -402,8 +404,8 @@ TYPED_TEST_P(CookieStoreTest, DomainWithoutLeadingDotTest) { |
this->MatchCookieLines("a=1", this->GetCookies(cs, url)); |
this->MatchCookieLines("a=1", |
this->GetCookies(cs, GURL("http://sub.www.google.com"))); |
- this->MatchCookieLines("", |
- this->GetCookies(cs, GURL("http://something-else.com"))); |
+ this->MatchCookieLines( |
+ std::string(), this->GetCookies(cs, GURL("http://something-else.com"))); |
} |
} |
@@ -429,11 +431,11 @@ TYPED_TEST_P(CookieStoreTest, TestIpAddress) { |
scoped_refptr<CookieStore> cs(this->GetCookieStore()); |
EXPECT_FALSE(this->SetCookie(cs, url_ip, "b=2; domain=.1.2.3.4")); |
EXPECT_FALSE(this->SetCookie(cs, url_ip, "c=3; domain=.3.4")); |
- this->MatchCookieLines("", this->GetCookies(cs, url_ip)); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, url_ip)); |
// It should be allowed to set a cookie if domain= matches the IP address |
// exactly. This matches IE/Firefox, even though it seems a bit wrong. |
EXPECT_FALSE(this->SetCookie(cs, url_ip, "b=2; domain=1.2.3.3")); |
- this->MatchCookieLines("", this->GetCookies(cs, url_ip)); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, url_ip)); |
EXPECT_TRUE(this->SetCookie(cs, url_ip, "b=2; domain=1.2.3.4")); |
this->MatchCookieLines("b=2", this->GetCookies(cs, url_ip)); |
} |
@@ -451,10 +453,12 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { |
this->MatchCookieLines("a=1", this->GetCookies(cs, url)); |
// Make sure it doesn't show up for a normal .com, it should be a host |
// not a domain cookie. |
- this->MatchCookieLines("", |
+ this->MatchCookieLines( |
+ std::string(), |
this->GetCookies(cs, GURL("http://hopefully-no-cookies.com/"))); |
if (TypeParam::supports_non_dotted_domains) { |
- this->MatchCookieLines("", this->GetCookies(cs, GURL("http://.com/"))); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, GURL("http://.com/"))); |
} |
} |
@@ -465,7 +469,8 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { |
if (TypeParam::supports_trailing_dots) { |
EXPECT_TRUE(this->SetCookie(cs, url, "a=1")); |
this->MatchCookieLines("a=1", this->GetCookies(cs, url)); |
- this->MatchCookieLines("", |
+ this->MatchCookieLines( |
+ std::string(), |
this->GetCookies(cs, GURL("http://hopefully-no-cookies.com./"))); |
} else { |
EXPECT_FALSE(this->SetCookie(cs, url, "a=1")); |
@@ -477,7 +482,7 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { |
GURL url("http://a.b"); |
EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.b")); |
EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=b")); |
- this->MatchCookieLines("", this->GetCookies(cs, url)); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); |
} |
{ // Same test as above, but explicitly on a known TLD (com). |
@@ -485,7 +490,7 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { |
GURL url("http://google.com"); |
EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.com")); |
EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=com")); |
- this->MatchCookieLines("", this->GetCookies(cs, url)); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); |
} |
{ // Make sure can't set cookie on TLD which is dotted. |
@@ -493,11 +498,12 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { |
GURL url("http://google.co.uk"); |
EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.co.uk")); |
EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=.uk")); |
- this->MatchCookieLines("", this->GetCookies(cs, url)); |
- this->MatchCookieLines("", |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); |
+ this->MatchCookieLines( |
+ std::string(), |
this->GetCookies(cs, GURL("http://something-else.co.uk"))); |
- this->MatchCookieLines("", |
- this->GetCookies(cs, GURL("http://something-else.uk"))); |
+ this->MatchCookieLines( |
+ std::string(), this->GetCookies(cs, GURL("http://something-else.uk"))); |
} |
{ // Intranet URLs should only be able to set host cookies. |
@@ -533,9 +539,11 @@ TYPED_TEST_P(CookieStoreTest, TestHostEndsWithDot) { |
} |
// Make sure there weren't any side effects. |
- this->MatchCookieLines("", |
+ this->MatchCookieLines( |
+ std::string(), |
this->GetCookies(cs, GURL("http://hopefully-no-cookies.com/"))); |
- this->MatchCookieLines("", this->GetCookies(cs, GURL("http://.com/"))); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, GURL("http://.com/"))); |
} |
TYPED_TEST_P(CookieStoreTest, InvalidScheme) { |
@@ -552,7 +560,7 @@ TYPED_TEST_P(CookieStoreTest, InvalidScheme_Read) { |
scoped_refptr<CookieStore> cs(this->GetCookieStore()); |
EXPECT_TRUE(this->SetCookie(cs, GURL(kUrlGoogle), kValidDomainCookieLine)); |
- this->MatchCookieLines("", this->GetCookies(cs, GURL(kUrlFtp))); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, GURL(kUrlFtp))); |
} |
TYPED_TEST_P(CookieStoreTest, PathTest) { |
@@ -565,8 +573,9 @@ TYPED_TEST_P(CookieStoreTest, PathTest) { |
this->MatchCookieLines("A=B", |
this->GetCookies(cs, GURL(url + "/wee/war/more/more"))); |
if (!TypeParam::has_path_prefix_bug) |
- this->MatchCookieLines("", this->GetCookies(cs, GURL(url + "/weehee"))); |
- this->MatchCookieLines("", this->GetCookies(cs, GURL(url + "/"))); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, GURL(url + "/weehee"))); |
+ this->MatchCookieLines(std::string(), this->GetCookies(cs, GURL(url + "/"))); |
// If we add a 0 length path, it should default to / |
EXPECT_TRUE(this->SetCookie(cs, GURL(url), "A=C; path=")); |
@@ -612,15 +621,17 @@ TYPED_TEST_P(CookieStoreTest, HttpOnlyTest) { |
options)); |
// Check httponly read protection. |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
- this->MatchCookieLines("A=B", |
- this->GetCookiesWithOptions(cs, this->url_google_, options)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines( |
+ "A=B", this->GetCookiesWithOptions(cs, this->url_google_, options)); |
// Check httponly overwrite protection. |
EXPECT_FALSE(this->SetCookie(cs, this->url_google_, "A=C")); |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
- this->MatchCookieLines("A=B", |
- this->GetCookiesWithOptions(cs, this->url_google_, options)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines( |
+ "A=B", this->GetCookiesWithOptions(cs, this->url_google_, options)); |
EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, "A=C", |
options)); |
this->MatchCookieLines("A=C", this->GetCookies(cs, this->url_google_)); |
@@ -645,7 +656,7 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { |
// Delete it via Max-Age. |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
std::string(kValidCookieLine) + "; max-age=0")); |
- this->MatchCookieLineWithTimeout(cs, this->url_google_, ""); |
+ this->MatchCookieLineWithTimeout(cs, this->url_google_, std::string()); |
// Create a session cookie. |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, kValidCookieLine)); |
@@ -654,7 +665,8 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
std::string(kValidCookieLine) + |
"; expires=Mon, 18-Apr-1977 22:50:13 GMT")); |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
// Create a persistent cookie. |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
@@ -665,7 +677,7 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { |
// Delete it via Max-Age. |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
std::string(kValidCookieLine) + "; max-age=0")); |
- this->MatchCookieLineWithTimeout(cs, this->url_google_, ""); |
+ this->MatchCookieLineWithTimeout(cs, this->url_google_, std::string()); |
// Create a persistent cookie. |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
@@ -676,7 +688,8 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
std::string(kValidCookieLine) + |
"; expires=Mon, 18-Apr-1977 22:50:13 GMT")); |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
// Create a persistent cookie. |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
@@ -703,7 +716,8 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, |
std::string(kValidCookieLine) + |
"; expires=Thu, 1-Jan-1970 00:00:00 GMT")); |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
} |
TYPED_TEST_P(CookieStoreTest, TestDeleteAllCreatedBetween) { |
@@ -731,7 +745,8 @@ TYPED_TEST_P(CookieStoreTest, TestDeleteAllCreatedBetween) { |
// Remove the cookie with an interval defined by two dates. |
EXPECT_EQ(1, this->DeleteCreatedBetween(cs, last_minute, next_minute)); |
// Check that the cookie disappeared. |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
// Add another cookie. |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_, "C=D")); |
@@ -741,7 +756,8 @@ TYPED_TEST_P(CookieStoreTest, TestDeleteAllCreatedBetween) { |
// Remove the cookie with a null ending time. |
EXPECT_EQ(1, this->DeleteCreatedBetween(cs, last_minute, base::Time())); |
// Check that the cookie disappeared. |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
} |
TYPED_TEST_P(CookieStoreTest, TestSecure) { |
@@ -753,11 +769,13 @@ TYPED_TEST_P(CookieStoreTest, TestSecure) { |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_secure_, "A=B; secure")); |
// The secure should overwrite the non-secure. |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
this->MatchCookieLines("A=B", this->GetCookies(cs, this->url_google_secure_)); |
EXPECT_TRUE(this->SetCookie(cs, this->url_google_secure_, "D=E; secure")); |
- this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); |
+ this->MatchCookieLines(std::string(), |
+ this->GetCookies(cs, this->url_google_)); |
this->MatchCookieLines("A=B; D=E", |
this->GetCookies(cs, this->url_google_secure_)); |