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

Unified Diff: net/cookies/canonical_cookie_unittest.cc

Issue 14113014: Adding Priority field to cookies. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 7 years, 8 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/canonical_cookie_unittest.cc
diff --git a/net/cookies/canonical_cookie_unittest.cc b/net/cookies/canonical_cookie_unittest.cc
index 161b27f3db669cceffd0f687ca36d38302d7fdc7..efbca705f7c9ad52c7c693f42247b2c5629ada96 100644
--- a/net/cookies/canonical_cookie_unittest.cc
+++ b/net/cookies/canonical_cookie_unittest.cc
@@ -6,6 +6,7 @@
#include "base/memory/scoped_ptr.h"
#include "googleurl/src/gurl.h"
+#include "net/cookies/cookie_constants.h"
#include "net/cookies/cookie_options.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -46,8 +47,8 @@ TEST(CanonicalCookieTest, Constructor) {
base::Time current_time = base::Time::Now();
CanonicalCookie cookie(url, "A", "2", "www.example.com", "/test",
- current_time, base::Time(), current_time, false,
- false);
+ current_time, base::Time(), current_time, false, false,
+ PRIORITY_DEFAULT);
EXPECT_EQ(url.GetOrigin().spec(), cookie.Source());
EXPECT_EQ("A", cookie.Name());
EXPECT_EQ("2", cookie.Value());
@@ -64,7 +65,8 @@ TEST(CanonicalCookieTest, Constructor) {
base::Time(),
current_time,
false,
- false);
+ false,
+ PRIORITY_DEFAULT);
EXPECT_EQ(url.GetOrigin().spec(), cookie.Source());
EXPECT_EQ("A", cookie2.Name());
EXPECT_EQ("2", cookie2.Value());
@@ -120,7 +122,7 @@ TEST(CanonicalCookieTest, Create) {
// string.
cookie.reset(CanonicalCookie::Create(
url, "A", "2", "www.example.com", "/test", creation_time, base::Time(),
- false, false));
+ false, false, PRIORITY_DEFAULT));
EXPECT_EQ(url.GetOrigin().spec(), cookie->Source());
EXPECT_EQ("A", cookie->Name());
EXPECT_EQ("2", cookie->Value());
@@ -130,7 +132,7 @@ TEST(CanonicalCookieTest, Create) {
cookie.reset(CanonicalCookie::Create(
url, "A", "2", ".www.example.com", "/test", creation_time, base::Time(),
- false, false));
+ false, false, PRIORITY_DEFAULT));
EXPECT_EQ(url.GetOrigin().spec(), cookie->Source());
EXPECT_EQ("A", cookie->Name());
EXPECT_EQ("2", cookie->Value());
@@ -188,14 +190,14 @@ TEST(CanonicalCookieTest, IsEquivalent) {
scoped_ptr<CanonicalCookie> cookie(
new CanonicalCookie(url, cookie_name, cookie_value, cookie_domain,
cookie_path, creation_time, expiration_time,
- last_access_time, secure, httponly));
+ last_access_time, secure, httponly, PRIORITY_MEDIUM));
EXPECT_TRUE(cookie->IsEquivalent(*cookie));
// Test that two identical cookies are equivalent.
scoped_ptr<CanonicalCookie> other_cookie(
new CanonicalCookie(url, cookie_name, cookie_value, cookie_domain,
cookie_path, creation_time, expiration_time,
- last_access_time, secure, httponly));
+ last_access_time, secure, httponly, PRIORITY_MEDIUM));
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
// Tests that use different variations of attribute values that
@@ -203,7 +205,7 @@ TEST(CanonicalCookieTest, IsEquivalent) {
other_cookie.reset(new CanonicalCookie(url, cookie_name, "2", cookie_domain,
cookie_path, creation_time,
expiration_time, last_access_time,
- secure, httponly));
+ secure, httponly, PRIORITY_HIGH));
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
base::Time other_creation_time =
@@ -211,13 +213,14 @@ TEST(CanonicalCookieTest, IsEquivalent) {
other_cookie.reset(new CanonicalCookie(url, cookie_name, "2", cookie_domain,
cookie_path, other_creation_time,
expiration_time, last_access_time,
- secure, httponly));
+ secure, httponly, PRIORITY_MEDIUM));
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
other_cookie.reset(new CanonicalCookie(url, cookie_name, cookie_name,
cookie_domain, cookie_path,
creation_time, expiration_time,
- last_access_time, true, httponly));
+ last_access_time, true, httponly,
+ PRIORITY_LOW));
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
// Tests that use different variations of attribute values that
@@ -225,13 +228,14 @@ TEST(CanonicalCookieTest, IsEquivalent) {
other_cookie.reset(new CanonicalCookie(url, "B", cookie_value, cookie_domain,
cookie_path, creation_time,
expiration_time, last_access_time,
- secure, httponly));
+ secure, httponly, PRIORITY_MEDIUM));
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
other_cookie.reset(new CanonicalCookie(url, cookie_name, cookie_value,
"www.example.com", cookie_path,
creation_time, expiration_time,
- last_access_time, secure, httponly));
+ last_access_time, secure, httponly,
+ PRIORITY_MEDIUM));
EXPECT_TRUE(cookie->IsDomainCookie());
EXPECT_FALSE(other_cookie->IsDomainCookie());
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
@@ -239,13 +243,15 @@ TEST(CanonicalCookieTest, IsEquivalent) {
other_cookie.reset(new CanonicalCookie(url, cookie_name, cookie_value,
".example.com", cookie_path,
creation_time, expiration_time,
- last_access_time, secure, httponly));
+ last_access_time, secure, httponly,
+ PRIORITY_MEDIUM));
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
other_cookie.reset(new CanonicalCookie(url, cookie_name, cookie_value,
cookie_domain, "/test/0",
creation_time, expiration_time,
- last_access_time, secure, httponly));
+ last_access_time, secure, httponly,
+ PRIORITY_MEDIUM));
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
}

Powered by Google App Engine
This is Rietveld 408576698