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

Unified Diff: net/base/cookie_monster_unittest.cc

Issue 4630001: Implement Origin cookies. Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/base/cookie_monster_store_test.h ('k') | net/base/cookie_options.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cookie_monster_unittest.cc
===================================================================
--- net/base/cookie_monster_unittest.cc (revision 65294)
+++ net/base/cookie_monster_unittest.cc (working copy)
@@ -57,30 +57,30 @@
// Domain cookies
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_1,
"dom_1", "X", ".harvard.edu", "/",
- base::Time(), false, false));
+ base::Time(), false, false, false));
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2,
"dom_2", "X", ".math.harvard.edu", "/",
- base::Time(), false, false));
+ base::Time(), false, false, false));
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_3,
"dom_3", "X",
".bourbaki.math.harvard.edu", "/",
- base::Time(), false, false));
+ base::Time(), false, false, false));
// Host cookies
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_1,
"host_1", "X", "", "/",
- base::Time(), false, false));
+ base::Time(), false, false, false));
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2,
"host_2", "X", "", "/",
- base::Time(), false, false));
+ base::Time(), false, false, false));
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_3,
"host_3", "X", "", "/",
- base::Time(), false, false));
+ base::Time(), false, false, false));
// Http_only cookie
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2,
"httpo_check", "X", "", "/",
- base::Time(), false, true));
+ base::Time(), false, true, false));
// Secure cookies
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2_secure,
@@ -88,27 +88,27 @@
"/", base::Time(), true, false));
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2_secure,
"sec_host", "X", "", "/",
- base::Time(), true, false));
+ base::Time(), true, false, false));
// Domain path cookies
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2,
"dom_path_1", "X",
".math.harvard.edu", "/dir1",
- base::Time(), false, false));
+ base::Time(), false, false, false));
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2,
"dom_path_2", "X",
".math.harvard.edu", "/dir1/dir2",
- base::Time(), false, false));
+ base::Time(), false, false, false));
// Host path cookies
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2,
"host_path_1", "X",
"", "/dir1",
- base::Time(), false, false));
+ base::Time(), false, false, false));
EXPECT_TRUE(cm->SetCookieWithDetails(url_top_level_domain_plus_2,
"host_path_2", "X",
"", "/dir1/dir2",
- base::Time(), false, false));
+ base::Time(), false, false, false));
EXPECT_EQ(13U, cm->GetAllCookies().size());
}
@@ -156,6 +156,7 @@
EXPECT_TRUE(pc.IsValid());
EXPECT_FALSE(pc.IsSecure());
EXPECT_TRUE(pc.IsHttpOnly());
+ EXPECT_FALSE(pc.IsOrigin());
EXPECT_TRUE(pc.HasPath());
EXPECT_EQ("aBc", pc.Name());
EXPECT_EQ(expected, pc.Value());
@@ -182,6 +183,7 @@
EXPECT_TRUE(pc.IsValid());
EXPECT_TRUE(pc.IsSecure());
EXPECT_TRUE(pc.IsHttpOnly());
+ EXPECT_FALSE(pc.IsOrigin());
EXPECT_TRUE(pc.HasPath());
EXPECT_EQ("/", pc.Path());
EXPECT_EQ("", pc.Name());
@@ -235,6 +237,7 @@
EXPECT_FALSE(pc.HasDomain());
EXPECT_TRUE(pc.IsSecure());
EXPECT_TRUE(pc.IsHttpOnly());
+ EXPECT_FALSE(pc.IsOrigin());
// We parse anything between ; as attributes, so we end up with two
// attributes with an empty string name and value.
EXPECT_EQ(4U, pc.NumberOfAttributes());
@@ -248,6 +251,7 @@
EXPECT_FALSE(pc.HasDomain());
EXPECT_TRUE(pc.IsSecure());
EXPECT_TRUE(pc.IsHttpOnly());
+ EXPECT_FALSE(pc.IsOrigin());
EXPECT_EQ(4U, pc.NumberOfAttributes());
}
@@ -1592,30 +1596,30 @@
EXPECT_TRUE(cm->SetCookieWithDetails(
url_google_foo, "A", "B", std::string(), "/foo", base::Time(),
- false, false));
+ false, false, false));
EXPECT_TRUE(cm->SetCookieWithDetails(
url_google_bar, "C", "D", "google.izzle", "/bar", base::Time(),
- false, true));
+ false, true, false));
EXPECT_TRUE(cm->SetCookieWithDetails(
url_google, "E", "F", std::string(), std::string(), base::Time(),
- true, false));
+ true, false, false));
// Test that malformed attributes fail to set the cookie.
EXPECT_FALSE(cm->SetCookieWithDetails(
url_google_foo, " A", "B", std::string(), "/foo", base::Time(),
- false, false));
+ false, false, false));
EXPECT_FALSE(cm->SetCookieWithDetails(
url_google_foo, "A;", "B", std::string(), "/foo", base::Time(),
- false, false));
+ false, false, false));
EXPECT_FALSE(cm->SetCookieWithDetails(
url_google_foo, "A=", "B", std::string(), "/foo", base::Time(),
- false, false));
+ false, false, false));
EXPECT_FALSE(cm->SetCookieWithDetails(
url_google_foo, "A", "B", "google.ozzzzzzle", "foo", base::Time(),
- false, false));
+ false, false, false));
EXPECT_FALSE(cm->SetCookieWithDetails(
url_google_foo, "A=", "B", std::string(), "foo", base::Time(),
- false, false));
+ false, false, false));
net::CookieMonster::CookieList cookies =
cm->GetAllCookiesForURL(url_google_foo);
@@ -1629,6 +1633,7 @@
EXPECT_FALSE(it->DoesExpire());
EXPECT_FALSE(it->IsSecure());
EXPECT_FALSE(it->IsHttpOnly());
+ EXPECT_FALSE(it->IsOrigin());
ASSERT_TRUE(++it == cookies.end());
@@ -1642,6 +1647,7 @@
EXPECT_EQ("/bar", it->Path());
EXPECT_FALSE(it->IsSecure());
EXPECT_TRUE(it->IsHttpOnly());
+ EXPECT_FALSE(it->IsOrigin());
ASSERT_TRUE(++it == cookies.end());
@@ -1655,6 +1661,7 @@
EXPECT_EQ("www.google.izzle", it->Domain());
EXPECT_TRUE(it->IsSecure());
EXPECT_FALSE(it->IsHttpOnly());
+ EXPECT_FALSE(it->IsOrigin());
ASSERT_TRUE(++it == cookies.end());
}
@@ -1764,11 +1771,11 @@
cm->SetCookieWithOptions(url_google, "setCookieWithOptions3=A", options);
cm->SetCookieWithDetails(url_google, "setCookieWithDetails1", "A",
- ".google.com", "/", Time(), false, false);
+ ".google.com", "/", Time(), false, false, false);
cm->SetCookieWithDetails(url_google, "setCookieWithDetails2", "A",
- ".google.com", "/", Time(), false, false);
+ ".google.com", "/", Time(), false, false, false);
cm->SetCookieWithDetails(url_google, "setCookieWithDetails3", "A",
- ".google.com", "/", Time(), false, false);
+ ".google.com", "/", Time(), false, false, false);
// Now we check
net::CookieMonster::CookieList cookie_list(cm->GetAllCookies());
@@ -1838,15 +1845,16 @@
base::Time expires;
bool secure;
bool http_only;
+ bool origin;
};
const CookiesInputInfo input_info[] = {
{"http://a.b.google.com", "a", "1", "", "/path/to/cookie", expires,
- false, false},
+ false, false, false},
{"https://www.google.com", "b", "2", ".google.com", "/path/from/cookie",
- expires + TimeDelta::FromSeconds(10), true, true},
+ expires + TimeDelta::FromSeconds(10), true, true, false},
{"https://google.com", "c", "3", "", "/another/path/to/cookie",
base::Time::Now() + base::TimeDelta::FromSeconds(100),
- true, false}
+ true, false, false}
};
const int INPUT_DELETE = 1;
@@ -1857,7 +1865,8 @@
p < &input_info[ARRAYSIZE_UNSAFE(input_info)]; p++) {
EXPECT_TRUE(cmout->SetCookieWithDetails(GURL(p->gurl), p->name, p->value,
p->domain, p->path, p->expires,
- p->secure, p->http_only));
+ p->secure, p->http_only,
+ p->origin));
}
cmout->DeleteCookie(GURL(std::string(input_info[INPUT_DELETE].gurl) +
input_info[INPUT_DELETE].path),
@@ -1885,6 +1894,7 @@
output->CreationDate().ToInternalValue());
EXPECT_EQ(input->secure, output->IsSecure());
EXPECT_EQ(input->http_only, output->IsHttpOnly());
+ EXPECT_EQ(input->origin, output->IsOrigin());
EXPECT_TRUE(output->IsPersistent());
EXPECT_EQ(input->expires.ToInternalValue(),
output->ExpiryDate().ToInternalValue());
« no previous file with comments | « net/base/cookie_monster_store_test.h ('k') | net/base/cookie_options.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698