0

[RWS] Remove unused same_party ctor parameter

CanonicalCookie no longer uses the same_party parameter at all, so we
can remove it from the ctor and factory methods.

This CL doesn't change any behavior.

Bug: 1348588
Change-Id: I0d74451fd1129ed50d16c129a3bc690f976198b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5030081
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Chong Gu <chonggu@google.com>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1226175}
This commit is contained in:
Chris Fredrickson
2023-11-17 17:07:57 +00:00
committed by Chromium LUCI CQ
parent e384c3c967
commit 23703ad3a8
62 changed files with 568 additions and 971 deletions
chrome/browser
components/signin
content/browser
fuchsia_web/webengine/browser
google_apis/gaia
ios
net
services/network
third_party/blink/renderer/modules/cookie_store

@ -126,7 +126,7 @@ static void JNI_CookiesFetcher_RestoreCookies(
base::Time::FromDeltaSinceWindowsEpoch(
base::Microseconds(last_update)),
secure, httponly, static_cast<net::CookieSameSite>(same_site),
static_cast<net::CookiePriority>(priority), same_party, pk,
static_cast<net::CookiePriority>(priority), pk,
static_cast<net::CookieSourceScheme>(source_scheme), source_port);
// FromStorage() uses a less strict version of IsCanonical(), we need to check
// the stricter version as well here. This is safe because this function is

@ -116,7 +116,7 @@ void AndroidSmsAppSetupControllerImpl::SetUpApp(const GURL& app_url,
base::Time::Now() /* last_access_time */,
!net::IsLocalhost(app_url) /* secure */, false /* http_only */,
net::CookieSameSite::STRICT_MODE, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */, absl::nullopt /* partition_key */);
absl::nullopt /* partition_key */);
// TODO(crbug.com/1069974): The cookie source url must be faked here because
// otherwise, this would fail to set a secure cookie if |app_url| is insecure.
// Consider instead to use url::Replacements to force the scheme to be https.
@ -328,7 +328,7 @@ void AndroidSmsAppSetupControllerImpl::SetMigrationCookie(
base::Time::Now() /* last_access_time */,
!net::IsLocalhost(app_url) /* secure */, false /* http_only */,
net::CookieSameSite::STRICT_MODE, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */, absl::nullopt /* partition_key */);
absl::nullopt /* partition_key */);
// TODO(crbug.com/1069974): The cookie source url must be faked here because
// otherwise, this would fail to set a secure cookie if |app_url| is insecure.
// Consider instead to use url::Replacements to force the scheme to be https.

@ -233,7 +233,7 @@ void ProfileAuthDataTest::PopulateBrowserContext(
kSAMLIdPCookieDomainWithWildcard, std::string(), base::Time(),
base::Time(), base::Time(), true, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false, absl::nullopt),
absl::nullopt),
GURL(kSAMLIdPCookieURL), options, base::DoNothing());
cookies->SetCanonicalCookie(
@ -241,7 +241,7 @@ void ProfileAuthDataTest::PopulateBrowserContext(
GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, std::string(),
std::string(), base::Time(), base::Time(), base::Time(), true, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false, absl::nullopt),
absl::nullopt),
GURL(kSAMLIdPCookieURL), options, base::DoNothing());
cookies->SetCanonicalCookie(
@ -249,7 +249,7 @@ void ProfileAuthDataTest::PopulateBrowserContext(
GURL(kGAIACookieURL), kCookieName, cookie_value, std::string(),
std::string(), base::Time(), base::Time(), base::Time(), true, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false, absl::nullopt),
absl::nullopt),
GURL(kGAIACookieURL), options, base::DoNothing());
}

@ -1036,7 +1036,7 @@ class SAMLCookieTransferTest : public LockscreenWebUiTest {
/*expiration_time=*/base::Time(),
/*last_access_time=*/base::Time(), /*secure=*/true,
/*http_only=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
/*partition_key=*/absl::nullopt),
fake_saml_idp()->GetSamlPageUrl(), options, base::DoNothing());
ExpectCookieInUserProfile(kRandomCookieName, kRandomCookieValue);

@ -183,8 +183,7 @@ void InjectCookie(content::StoragePartition* storage_partition) {
kTestCookieName, kTestCookieValue, kTestCookieHost, "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_MEDIUM,
/*same_party=*/false);
net::COOKIE_PRIORITY_MEDIUM);
base::RunLoop run_loop;
cookie_manager->SetCanonicalCookie(
*cookie, net::cookie_util::SimulatedCookieSource(*cookie, "https"),

@ -424,8 +424,7 @@ bool BrowsingDataRemoverBrowserTestBase::SetGaiaCookieForProfile(
"SAPISID", std::string(), "." + google_url.host(), "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
net::COOKIE_PRIORITY_DEFAULT);
bool success = false;
base::RunLoop loop;
base::OnceCallback<void(net::CookieAccessResult)> callback =

@ -58,7 +58,7 @@ class SiteDataCountingHelperTest : public testing::Test {
url, "name", "A=1", url.host(), url.path(), creation_time,
base::Time(), creation_time, url.SchemeIsCryptographic(), false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false, absl::nullopt);
absl::nullopt);
net::CookieOptions options;
options.set_include_httponly();
cookie_manager->SetCanonicalCookie(

@ -75,7 +75,7 @@ bool SetGaiaCookieForProfile(Profile* profile) {
"SAPISID", std::string(), "." + google_url.host(), "/", base::Time(),
base::Time(), base::Time(), base::Time(),
/*secure=*/true, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, false);
net::COOKIE_PRIORITY_DEFAULT);
base::test::TestFuture<net::CookieAccessResult> set_cookie_future;
network::mojom::CookieManager* cookie_manager =

@ -486,7 +486,6 @@ ExtensionFunction::ResponseAction CookiesSetFunction::Run() {
break;
}
// TODO(crbug.com/1144181): Add support for SameParty attribute.
std::unique_ptr<net::CanonicalCookie> cc(
net::CanonicalCookie::CreateSanitizedCookie(
url_, //
@ -501,7 +500,6 @@ ExtensionFunction::ResponseAction CookiesSetFunction::Run() {
parsed_args_->details.http_only.value_or(false), //
same_site, //
net::COOKIE_PRIORITY_DEFAULT, //
/*same_party=*/false, //
partition_key));
if (!cc) {
// Return error through callbacks so that the proper error message

@ -25,7 +25,7 @@ TEST(CookiesHelperUnittest, CookieConversionWithInfiniteExpirationDate) {
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"cookiename", "cookievalue", "example.com", "/", base::Time::Now(),
kExpirationDate, base::Time(), base::Time(), false, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT, false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
// Serialize the cookie to JSON. We need to gracefully handle the infinite
// expiration date, which should be converted to the maximum value.

@ -94,8 +94,7 @@ TEST_F(ExtensionCookiesTest, ExtensionTypeCreation) {
net::CanonicalCookie::CreateUnsafeCookieForTesting(
"ABC", "DEF", "www.example.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), false, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
ASSERT_NE(nullptr, canonical_cookie1.get());
Cookie cookie1 =
cookies_helpers::CreateCookie(*canonical_cookie1, "some cookie store");
@ -116,7 +115,7 @@ TEST_F(ExtensionCookiesTest, ExtensionTypeCreation) {
"ABC", "DEF", ".example.com", "/", base::Time(),
base::Time::FromSecondsSinceUnixEpoch(10000), base::Time(),
base::Time(), false, false, net::CookieSameSite::STRICT_MODE,
net::COOKIE_PRIORITY_DEFAULT, false);
net::COOKIE_PRIORITY_DEFAULT);
ASSERT_NE(nullptr, canonical_cookie2.get());
Cookie cookie2 =
cookies_helpers::CreateCookie(*canonical_cookie2, "some cookie store");
@ -140,8 +139,7 @@ TEST_F(ExtensionCookiesTest, GetURLFromCanonicalCookie) {
net::CanonicalCookie::CreateUnsafeCookieForTesting(
"ABC", "DEF", ".example.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), false, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
ASSERT_NE(nullptr, cookie1.get());
EXPECT_EQ("http://example.com/",
cookies_helpers::GetURLFromCanonicalCookie(*cookie1).spec());
@ -150,8 +148,7 @@ TEST_F(ExtensionCookiesTest, GetURLFromCanonicalCookie) {
net::CanonicalCookie::CreateUnsafeCookieForTesting(
"ABC", "DEF", ".helloworld.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), true, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
ASSERT_NE(nullptr, cookie2.get());
EXPECT_EQ("https://helloworld.com/",
cookies_helpers::GetURLFromCanonicalCookie(*cookie2).spec());
@ -186,8 +183,7 @@ TEST_F(ExtensionCookiesTest, DomainMatching) {
net::CanonicalCookie::CreateUnsafeCookieForTesting(
"name", std::string(), tests[i].domain, "/", base::Time(),
base::Time(), base::Time(), base::Time(), false, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
ASSERT_NE(nullptr, cookie.get());
EXPECT_EQ(tests[i].matches, filter.MatchesCookie(*cookie)) << " test " << i;
}
@ -224,7 +220,7 @@ TEST_F(ExtensionCookiesTest, PartitionKeySerialization) {
"__Host-A", "B", "x.y", "/", base::Time(), base::Time(), base::Time(),
base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::UNSPECIFIED,
net::COOKIE_PRIORITY_LOW, /*same_party=*/false,
net::COOKIE_PRIORITY_LOW,
net::CookiePartitionKey::FromURLForTesting(GURL(top_level_site)));
EXPECT_TRUE(cookie->IsPartitioned());
EXPECT_FALSE(net::CookiePartitionKey::HasNonce(cookie->PartitionKey()));
@ -235,7 +231,7 @@ TEST_F(ExtensionCookiesTest, PartitionKeySerialization) {
"__Host-A", "B", "x.y", "/", base::Time(), base::Time(), base::Time(),
base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::UNSPECIFIED,
net::COOKIE_PRIORITY_LOW, /*same_party=*/false,
net::COOKIE_PRIORITY_LOW,
net::CookiePartitionKey::FromURLForTesting(GURL()));
EXPECT_TRUE(opaque_cookie->IsPartitioned());
@ -246,7 +242,7 @@ TEST_F(ExtensionCookiesTest, PartitionKeySerialization) {
"__Host-A", "B", "x.y", "/", base::Time(), base::Time(), base::Time(),
base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::UNSPECIFIED,
net::COOKIE_PRIORITY_LOW, /*same_party=*/false,
net::COOKIE_PRIORITY_LOW,
net::CookiePartitionKey::FromURLForTesting(
GURL("https://toplevelsite.com"), base::UnguessableToken::Create()));

@ -62,8 +62,7 @@ void SetCookie(network::mojom::CookieManager* cookie_manager) {
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
kCookieName, kCookieValue, "www.test.com", "/", t, t + base::Days(1),
base::Time(), base::Time(), /*secure=*/true, /*http-only=*/false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
base::RunLoop run_loop;
cookie_manager->SetCanonicalCookie(
*cookie, net::cookie_util::SimulatedCookieSource(*cookie, "https"),

@ -105,8 +105,7 @@ void RemoveCookieTester::AddCookie(const std::string& host,
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
name, value, host, "/", base::Time(), base::Time(), base::Time(),
base::Time(), /*secure=*/true, /*httponly=*/false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM,
/*same_party=*/false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM);
cookie_manager_->SetCanonicalCookie(
*cookie, net::cookie_util::SimulatedCookieSource(*cookie, "https"),
options,

@ -24,7 +24,7 @@ net::CanonicalCookie BoundSessionTestCookieManager::CreateCookie(
/*last_access_time=*/base::Time::Now(), /*secure=*/true,
/*http_only=*/true, net::CookieSameSite::UNSPECIFIED,
net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*same_party=*/true, /*partition_key=*/absl::nullopt);
/*partition_key=*/absl::nullopt);
}
void BoundSessionTestCookieManager::SetCanonicalCookie(

@ -134,7 +134,7 @@ FakeBoundSessionRefreshCookieFetcher::CreateFakeCookie(
/*last_access_time=*/now, /*secure=*/true,
/*http_only=*/true, net::CookieSameSite::UNSPECIFIED,
net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*same_party=*/true, /*partition_key=*/absl::nullopt);
/*partition_key=*/absl::nullopt);
DCHECK(new_cookie);
return new_cookie;

@ -68,7 +68,7 @@ void CreateCookies(
url.path(), base::Time::Now(), base::Time::Max(), base::Time::Now(),
url.SchemeIsCryptographic(), false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false, absl::nullopt);
absl::nullopt);
cookie_manager->SetCanonicalCookie(
*cookie, url, net::CookieOptions::MakeAllInclusive(),
base::BindLambdaForTesting(

@ -48,7 +48,7 @@ void CreateCookies(
url, name, "A=" + name, url.host(), url.path(), base::Time::Now(),
base::Time::Max(), base::Time::Now(), url.SchemeIsCryptographic(),
false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, false, absl::nullopt);
net::COOKIE_PRIORITY_DEFAULT, absl::nullopt);
cookie_manager->SetCanonicalCookie(
*cookie, url, net::CookieOptions::MakeAllInclusive(),
base::BindLambdaForTesting(

@ -34,8 +34,7 @@ void AddSigninCookie(Profile* profile) {
/*last_update=*/base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
net::COOKIE_PRIORITY_DEFAULT);
network::mojom::CookieManager* cookie_manager =
profile->GetDefaultStoragePartition()

@ -115,7 +115,7 @@ ConsistencyCookieManager::CreateConsistencyCookie(const std::string& value) {
/*path=*/"/", /*creation=*/now, /*expiration=*/expiry,
/*last_access=*/now, /*secure=*/true, /*httponly=*/false,
net::CookieSameSite::STRICT_MODE, net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false, /*partition_key=*/absl::nullopt);
/*partition_key=*/absl::nullopt);
}
// static

@ -558,7 +558,7 @@ void GaiaCookieManagerService::ForceOnCookieChangeProcessing() {
"." + google_url.host(), "/", base::Time(), base::Time(),
base::Time(), true /* secure */, false /* httponly */,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */, absl::nullopt /* cookie_partition_key */);
absl::nullopt /* cookie_partition_key */);
OnCookieChange(
net::CookieChangeInfo(*cookie, net::CookieAccessResult(),
net::CookieChangeCause::UNKNOWN_DELETION));

@ -110,7 +110,7 @@ net::CanonicalCookie GetTestCookie(const GURL& url, const std::string& name) {
/*expiration_time=*/base::Time(), /*last_access_time=*/base::Time(),
/*secure=*/true, /*http_only=*/false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false, /*partition_key=*/absl::nullopt);
/*partition_key=*/absl::nullopt);
return *cookie;
}

@ -490,7 +490,7 @@ void AccountConsistencyService::SetChromeConnectedCookieWithUrl(
/*last_access_time=*/base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
/*partition_key=*/absl::nullopt);
net::CookieOptions options;
options.set_include_httponly();

@ -2083,7 +2083,7 @@ TEST_F(IdentityManagerTest, CallbackSentOnAccountsCookieDeletedByUserAction) {
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"SAPISID", std::string(), ".google.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), /*secure=*/true, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT, false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
SimulateCookieDeletedByUser(identity_manager()->GetGaiaCookieManagerService(),
*cookie);
run_loop.Run();
@ -2115,7 +2115,7 @@ TEST_F(IdentityManagerTest, OnNetworkInitialized) {
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"SAPISID", std::string(), ".google.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), /*secure=*/true, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT, false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
test_cookie_manager_ptr->DispatchCookieChange(net::CookieChangeInfo(
*cookie, net::CookieAccessResult(), net::CookieChangeCause::EXPLICIT));
run_loop.Run();

@ -56,7 +56,6 @@ class AttributionCookieCheckerImplTest : public testing::Test {
/*httponly=*/params.httponly,
/*same_site=*/params.same_site,
/*priority=*/net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false,
/*partition_key=*/params.partition_key);
CHECK(cookie);

@ -138,8 +138,7 @@ net::CanonicalCookie CreateCookieWithHost(const url::Origin& origin) {
net::CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "1", origin.host(), "/", base::Time::Now(), base::Time::Now(),
base::Time(), base::Time(), false, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM,
false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM);
EXPECT_TRUE(cookie);
return *cookie;
}

@ -40,7 +40,7 @@ void CreateCookieForTest(
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
cookie_name, "1", cookie_domain, "/", base::Time(), base::Time(),
base::Time(), base::Time(), is_cookie_secure, false, same_site,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
GetCookieManager(browser_context)
->SetCanonicalCookie(
*cookie, net::cookie_util::SimulatedCookieSource(*cookie, "https"),

@ -332,7 +332,7 @@ class CookieStoreManagerTest
base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false));
net::COOKIE_PRIORITY_DEFAULT));
}
bool DeleteCookie(const char* name, const char* domain, const char* path) {
@ -343,8 +343,7 @@ class CookieStoreManagerTest
/*last_access=*/base::Time(),
/*last_update=*/base::Time(),
/*secure=*/true, /*httponly=*/false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false));
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT));
}
// Designates a closure for preparing the cookie store for the current test.
@ -1614,7 +1613,7 @@ TEST_P(CookieStoreManagerTest, HttpOnlyCookieChange) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false)));
net::COOKIE_PRIORITY_DEFAULT)));
task_environment_.RunUntilIdle();
EXPECT_EQ(0u, worker_test_helper_->changes().size());
@ -1625,7 +1624,7 @@ TEST_P(CookieStoreManagerTest, HttpOnlyCookieChange) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false)));
net::COOKIE_PRIORITY_DEFAULT)));
task_environment_.RunUntilIdle();
ASSERT_EQ(1u, worker_test_helper_->changes().size());
@ -1671,7 +1670,7 @@ TEST_P(CookieStoreManagerTest, HttpOnlyCookieChangeLegacy) {
base::Time(), base::Time(), base::Time(),
/*secure=*/false,
/*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false)));
net::COOKIE_PRIORITY_DEFAULT)));
task_environment_.RunUntilIdle();
EXPECT_EQ(0u, worker_test_helper_->changes().size());
@ -1682,7 +1681,7 @@ TEST_P(CookieStoreManagerTest, HttpOnlyCookieChangeLegacy) {
base::Time(), base::Time(), base::Time(),
/*secure=*/false,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false)));
net::COOKIE_PRIORITY_DEFAULT)));
task_environment_.RunUntilIdle();
ASSERT_EQ(1u, worker_test_helper_->changes().size());
@ -1862,7 +1861,7 @@ TEST_F(CookieStoreManagerTest, PartitionedWorker_FirstPartyPartition) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
net::CookiePartitionKey::FromURLForTesting(GURL(kExampleScope)))));
task_environment_.RunUntilIdle();
@ -1877,7 +1876,7 @@ TEST_F(CookieStoreManagerTest, PartitionedWorker_FirstPartyPartition) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
net::CookiePartitionKey::FromURLForTesting(
GURL(kThirdPartyTopLevelSite)))));
task_environment_.RunUntilIdle();
@ -1930,7 +1929,7 @@ TEST_F(CookieStoreManagerTest, PartitionedWorker_ThirdPartyPartition) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false)));
net::COOKIE_PRIORITY_DEFAULT)));
task_environment_.RunUntilIdle();
ASSERT_EQ(0u, worker_test_helper_->changes().size());
@ -1942,7 +1941,7 @@ TEST_F(CookieStoreManagerTest, PartitionedWorker_ThirdPartyPartition) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
net::CookiePartitionKey::FromURLForTesting(
GURL(kThirdPartyTopLevelSite)))));
task_environment_.RunUntilIdle();
@ -1958,7 +1957,7 @@ TEST_F(CookieStoreManagerTest, PartitionedWorker_ThirdPartyPartition) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
net::CookiePartitionKey::FromURLForTesting(GURL(kExampleScope)))));
task_environment_.RunUntilIdle();
@ -2003,7 +2002,7 @@ TEST_F(CookieStoreManagerTest, PartitionedWorker_NoncedPartition) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
net::CookiePartitionKey::FromURLForTesting(GURL(kExampleScope),
kStorageKeyNonce))));
task_environment_.RunUntilIdle();
@ -2019,7 +2018,7 @@ TEST_F(CookieStoreManagerTest, PartitionedWorker_NoncedPartition) {
base::Time(), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
net::COOKIE_PRIORITY_DEFAULT,
net::CookiePartitionKey::FromURLForTesting(GURL(kExampleScope)))));
task_environment_.RunUntilIdle();

@ -348,7 +348,6 @@ MakeCookieFromProtocolValues(const std::string& name,
const std::string& same_site,
double expires,
const std::string& priority,
bool same_party,
const Maybe<std::string>& source_scheme,
const Maybe<int>& source_port,
const Maybe<std::string>& partition_key) {
@ -423,7 +422,7 @@ MakeCookieFromProtocolValues(const std::string& name,
std::unique_ptr<net::CanonicalCookie> cookie =
net::CanonicalCookie::CreateSanitizedCookie(
url, name, value, normalized_domain, path, base::Time(),
expiration_date, base::Time(), secure, http_only, css, cp, same_party,
expiration_date, base::Time(), secure, http_only, css, cp,
deserialized_partition_key);
if (!cookie)
@ -1560,8 +1559,8 @@ void NetworkHandler::SetCookie(const std::string& name,
auto cookie_or_error = MakeCookieFromProtocolValues(
name, value, url.value_or(""), domain.value_or(""), path.value_or(""),
secure.value_or(false), http_only.value_or(false), same_site.value_or(""),
expires.value_or(-1), priority.value_or(""), same_party.value_or(false),
source_scheme, source_port, partition_key);
expires.value_or(-1), priority.value_or(""), source_scheme, source_port,
partition_key);
if (absl::holds_alternative<Response>(cookie_or_error)) {
callback->sendFailure(absl::get<Response>(std::move(cookie_or_error)));
@ -1609,8 +1608,8 @@ void NetworkHandler::SetCookies(
cookie->GetName(), cookie->GetValue(), cookie->GetUrl(""),
cookie->GetDomain(""), cookie->GetPath(""), cookie->GetSecure(false),
cookie->GetHttpOnly(false), cookie->GetSameSite(""),
cookie->GetExpires(-1), cookie->GetPriority(""),
cookie->GetSameParty(false), source_scheme, source_port, partition_key);
cookie->GetExpires(-1), cookie->GetPriority(""), source_scheme,
source_port, partition_key);
if (absl::holds_alternative<Response>(net_cookie_or_error)) {
// TODO: Investiage whether we can report the error as a protocol error
// (this might be a breaking CDP change).

@ -785,8 +785,7 @@ void SetCookie(
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
kCookieName, kCookieValue, "example.test", "/", t, t + base::Days(1),
base::Time(), base::Time(), /*secure=*/true, /*http-only=*/false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
/*=same_party=*/false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
base::RunLoop run_loop;
cookie_manager->SetCanonicalCookie(
*cookie, net::cookie_util::SimulatedCookieSource(*cookie, "https"),

@ -61,7 +61,7 @@ class PrefetchCookieListenerTest : public RenderViewHostTestHarness {
base::Time::Now() + base::Hours(1), base::Time::Now(),
/*secure=*/true, /*http_only=*/false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false, /*partition_key=*/absl::nullopt, &status));
/*partition_key=*/absl::nullopt, &status));
EXPECT_TRUE(cookie.get());
EXPECT_TRUE(cookie->IsDomainCookie());
EXPECT_TRUE(status.IsInclude());

@ -44,7 +44,7 @@ std::unique_ptr<net::CanonicalCookie> CreateCookie(base::StringPiece name,
/*expiration_time=*/base::Time(), /*last_access_time=*/base::Time(),
/*secure=*/true,
/*httponly*/ false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_MEDIUM, /*same_party=*/false,
net::COOKIE_PRIORITY_MEDIUM,
/*partition_key=*/std::nullopt);
}

@ -473,7 +473,7 @@ bool OAuth2MintTokenFlow::ParseRemoteConsentResponse(
is_secure ? *is_secure : false,
is_http_only ? *is_http_only : false,
net::StringToCookieSameSite(same_site ? *same_site : ""),
net::COOKIE_PRIORITY_DEFAULT, /* same_party */ false,
net::COOKIE_PRIORITY_DEFAULT,
/* partition_key */ std::nullopt);
cookies.push_back(*cookie);
}

@ -118,13 +118,13 @@ static RemoteConsentResolutionData CreateRemoteConsentResolutionData() {
*net::CanonicalCookie::CreateSanitizedCookie(
resolution_data.url, "test_name", "test_value", "test.com", "/",
base::Time(), base::Time(), base::Time(), false, true,
net::CookieSameSite::LAX_MODE, net::COOKIE_PRIORITY_DEFAULT, false,
net::CookieSameSite::LAX_MODE, net::COOKIE_PRIORITY_DEFAULT,
std::nullopt));
resolution_data.cookies.push_back(
*net::CanonicalCookie::CreateSanitizedCookie(
resolution_data.url, "test_name2", "test_value2", "test.com", "/",
base::Time(), base::Time(), base::Time(), false, false,
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT, false,
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT,
std::nullopt));
return resolution_data;
}

@ -104,7 +104,6 @@ void OAuthMultiloginResult::TryParseCookiesFromValue(
const std::string* priority = cookie_dict.FindString("priority");
std::optional<double> expiration_delta = cookie_dict.FindDouble("maxAge");
const std::string* same_site = cookie_dict.FindString("sameSite");
const std::string* same_party = cookie_dict.FindString("sameParty");
base::Time now = base::Time::Now();
// TODO(crbug.com/1264458) If CreateSanitizedCookie were used below, this
@ -129,7 +128,6 @@ void OAuthMultiloginResult::TryParseCookiesFromValue(
samesite_mode = net::StringToCookieSameSite(*same_site, &samesite_string);
}
net::RecordCookieSameSiteAttributeValueHistogram(samesite_string);
bool same_party_bool = same_party && (*same_party == "1");
// TODO(crbug.com/1155648) Consider using CreateSanitizedCookie instead.
std::unique_ptr<net::CanonicalCookie> new_cookie =
net::CanonicalCookie::FromStorage(
@ -138,8 +136,8 @@ void OAuthMultiloginResult::TryParseCookiesFromValue(
/*last_access=*/now, /*last_update=*/now, is_secure.value_or(true),
is_http_only.value_or(true), samesite_mode,
net::StringToCookiePriority(priority ? *priority : "medium"),
same_party_bool, /*partition_key=*/std::nullopt,
net::CookieSourceScheme::kUnset, url::PORT_UNSPECIFIED);
/*partition_key=*/std::nullopt, net::CookieSourceScheme::kUnset,
url::PORT_UNSPECIFIED);
// If the unique_ptr is null, it means the cookie was not canonical.
// FromStorage() also uses a less strict version of IsCanonical(), we need
// to check the stricter version as well here.

@ -97,25 +97,21 @@ TEST(OAuthMultiloginResultTest, TryParseCookiesFromValue) {
"SID", "vAlUe1", ".google.ru", "/", time_now, time_now,
expiration_time, time_now, /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::UNSPECIFIED,
net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*same_party=*/false),
net::CookiePriority::COOKIE_PRIORITY_HIGH),
*CanonicalCookie::CreateUnsafeCookieForTesting(
"SAPISID", "vAlUe2", "google.com", "/", time_now, time_now,
expiration_time, time_now, /*secure=*/false,
/*httponly=*/true, net::CookieSameSite::LAX_MODE,
net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*same_party=*/false),
net::CookiePriority::COOKIE_PRIORITY_HIGH),
*CanonicalCookie::CreateUnsafeCookieForTesting(
"HSID", "vAlUe4", "", "/", time_now, time_now, time_now, time_now,
/*secure=*/true, /*httponly=*/true, net::CookieSameSite::STRICT_MODE,
net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*same_party=*/false),
net::CookiePriority::COOKIE_PRIORITY_HIGH),
*CanonicalCookie::CreateUnsafeCookieForTesting(
"__Secure-1PSID", "vAlUe4", ".google.fr", "/", time_now, time_now,
expiration_time, time_now, /*secure=*/true, /*httponly=*/true,
net::CookieSameSite::UNSPECIFIED,
net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*same_party=*/true)};
net::CookiePriority::COOKIE_PRIORITY_HIGH)};
EXPECT_EQ((int)result.cookies().size(), 4);

@ -21,7 +21,7 @@ CanonicalCookie MakeCookie(const GURL& url,
return *CanonicalCookie::CreateUnsafeCookieForTesting(
name, value, url.host(), url.path(), base::Time(), base::Time(),
base::Time(), base::Time(), false, false,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT, false);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
}
} // namespace

@ -48,8 +48,7 @@ void TestPersistentCookieStore::RunLoadedCallback() {
base::Time(), // last updated
false, // secure
false, // httponly
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
cookies.push_back(std::move(bad_canonical_cookie));
std::move(loaded_callback_).Run(std::move(cookies));
}

@ -57,9 +57,8 @@ std::unique_ptr<net::CanonicalCookie> CanonicalCookieFromSystemCookie(
same_site,
// When iOS begins to support 'Priority' and 'SameParty' attributes, pass
// them through here.
net::COOKIE_PRIORITY_DEFAULT, false /* SameParty */,
std::nullopt /* partition_key */, net::CookieSourceScheme::kUnset,
url::PORT_UNSPECIFIED);
net::COOKIE_PRIORITY_DEFAULT, std::nullopt /* partition_key */,
net::CookieSourceScheme::kUnset, url::PORT_UNSPECIFIED);
}
// Converts net::CanonicalCookie to NSHTTPCookie.

@ -39,8 +39,7 @@ void CheckSystemCookie(const base::Time& expires, bool secure, bool httponly) {
expires,
base::Time(), // last_access
base::Time(), // last_update
secure, httponly, same_site, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */);
secure, httponly, same_site, net::COOKIE_PRIORITY_DEFAULT);
// Convert it to system cookie.
NSHTTPCookie* system_cookie =
SystemCookieFromCanonicalCookie(*canonical_cookie);
@ -156,8 +155,7 @@ TEST_F(CookieUtil, SystemCookieFromBadCanonicalCookie) {
base::Time(), // last_update
false, // secure
false, // httponly
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */);
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
// Convert it to system cookie.
NSHTTPCookie* system_cookie =
SystemCookieFromCanonicalCookie(*bad_canonical_cookie);
@ -175,8 +173,7 @@ TEST_F(CookieUtil, SystemCookiesFromCanonicalCookieList) {
base::Time(), // last_update
false, // secure
false, // httponly
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */),
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT),
*net::CanonicalCookie::CreateUnsafeCookieForTesting(
"name2", "value2", "domain2", "path2/",
base::Time(), // creation
@ -185,8 +182,7 @@ TEST_F(CookieUtil, SystemCookiesFromCanonicalCookieList) {
base::Time(), // last_update
false, // secure
false, // httponly
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */),
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT),
};
NSArray<NSHTTPCookie*>* system_cookies =

@ -407,7 +407,7 @@ TEST_F(DownloadSessionTaskImplTest, Cookie) {
/*last_update=*/now,
/*secure=*/false,
/*httponly=*/false, net::CookieSameSite::UNSPECIFIED,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false);
net::COOKIE_PRIORITY_DEFAULT);
ASSERT_TRUE(expected_cookie);
cookie_store()->SetAllCookies({*expected_cookie});

@ -26,7 +26,7 @@ CanonicalCookie MakeCookie(const std::string& name) {
/*expiration=*/base::Time(), /*last_access=*/base::Time(),
/*last_update=*/base::Time(),
/*secure=*/true, /*httponly=*/false, CookieSameSite::UNSPECIFIED,
CookiePriority::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
}
CookieAccessResult Include() {

@ -369,7 +369,6 @@ CanonicalCookie::CanonicalCookie(
bool httponly,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key,
CookieSourceScheme source_scheme,
int source_port)
@ -683,7 +682,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
cookie_expires, creation_time,
/*last_update=*/base::Time::Now(), parsed_cookie.IsSecure(),
parsed_cookie.IsHttpOnly(), samesite, parsed_cookie.Priority(),
/*same_party=*/false, cookie_partition_key, source_scheme, source_port);
cookie_partition_key, source_scheme, source_port);
// TODO(chlily): Log metrics.
if (!cc->IsCanonical()) {
@ -730,7 +729,6 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::CreateSanitizedCookie(
bool http_only,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key,
CookieInclusionStatus* status) {
// Put a pointer on the stack so the rest of the function can assign to it if
@ -899,7 +897,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::CreateSanitizedCookie(
base::PassKey<CanonicalCookie>(), name, value, cookie_domain,
encoded_cookie_path, creation_time, expiration_time, last_access_time,
/*last_update=*/base::Time::Now(), secure, http_only, same_site, priority,
same_party, partition_key, source_scheme, source_port);
partition_key, source_scheme, source_port);
DCHECK(cc->IsCanonical());
return cc;
@ -919,7 +917,6 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::FromStorage(
bool httponly,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key,
CookieSourceScheme source_scheme,
int source_port) {
@ -934,8 +931,8 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::FromStorage(
auto cc = std::make_unique<CanonicalCookie>(
base::PassKey<CanonicalCookie>(), std::move(name), std::move(value),
std::move(domain), std::move(path), creation, expiration, last_access,
last_update, secure, httponly, same_site, priority, same_party,
partition_key, source_scheme, validated_port);
last_update, secure, httponly, same_site, priority, partition_key,
source_scheme, validated_port);
if (cc->IsCanonicalForFromStorage()) {
// This will help capture the number of times a cookie is canonical but does
@ -964,14 +961,13 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::CreateUnsafeCookieForTesting(
bool httponly,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key,
CookieSourceScheme source_scheme,
int source_port) {
return std::make_unique<CanonicalCookie>(
base::PassKey<CanonicalCookie>(), name, value, domain, path, creation,
expiration, last_access, last_update, secure, httponly, same_site,
priority, same_party, partition_key, source_scheme, source_port);
priority, partition_key, source_scheme, source_port);
}
bool CanonicalCookie::IsFirstPartyPartitioned() const {

@ -86,7 +86,6 @@ class NET_EXPORT CanonicalCookie {
bool httponly,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key,
CookieSourceScheme scheme_secure = CookieSourceScheme::kUnset,
int source_port = url::PORT_UNSPECIFIED);
@ -147,7 +146,6 @@ class NET_EXPORT CanonicalCookie {
bool http_only,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key,
CookieInclusionStatus* status = nullptr);
@ -171,7 +169,6 @@ class NET_EXPORT CanonicalCookie {
bool httponly,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key,
CookieSourceScheme source_scheme,
int source_port);
@ -191,7 +188,6 @@ class NET_EXPORT CanonicalCookie {
bool httponly,
CookieSameSite same_site,
CookiePriority priority,
bool same_party,
absl::optional<CookiePartitionKey> partition_key = absl::nullopt,
CookieSourceScheme scheme_secure = CookieSourceScheme::kUnset,
int source_port = url::PORT_UNSPECIFIED);

@ -66,7 +66,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
url, name, value, domain, path, creation, expiration, last_access,
data_provider.ConsumeBool() /* secure */,
data_provider.ConsumeBool() /* httponly */, same_site, priority,
data_provider.ConsumeBool() /* same_party */, partition_key);
partition_key);
if (sanitized_cookie) {
CHECK(sanitized_cookie->IsCanonical());

File diff suppressed because it is too large Load Diff

@ -106,8 +106,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchSessionControl) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
auto session_cookie = CanonicalCookie::CreateUnsafeCookieForTesting(
"session-cookie", "session-value", "session-domain", "session-path",
@ -117,8 +116,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchSessionControl) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
CookieDeletionInfo delete_info;
EXPECT_TRUE(delete_info.Matches(
@ -163,8 +161,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchHost) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
auto host_cookie = CanonicalCookie::CreateUnsafeCookieForTesting(
"host-cookie", "host-cookie-value",
@ -175,8 +172,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchHost) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
EXPECT_TRUE(domain_cookie->IsDomainCookie());
EXPECT_TRUE(host_cookie->IsHostCookie());
@ -232,8 +228,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchName) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
auto cookie2 = CanonicalCookie::CreateUnsafeCookieForTesting(
"cookie2-name", "cookie2-value",
/*domain=*/".example.com", "/path",
@ -243,8 +238,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchName) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
CookieDeletionInfo delete_info;
delete_info.name = "cookie1-name";
@ -268,8 +262,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchValue) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
auto cookie2 = CanonicalCookie::CreateUnsafeCookieForTesting(
"cookie2-name", "cookie2-value",
/*domain=*/".example.com", "/path",
@ -279,8 +272,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchValue) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
CookieDeletionInfo delete_info;
delete_info.value_for_testing = "cookie2-value";
@ -304,8 +296,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchUrl) {
/*last_update=*/base::Time::Now(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
CookiePriority::COOKIE_PRIORITY_DEFAULT);
CookieDeletionInfo delete_info;
delete_info.url = GURL("https://www.example.com/path");
@ -358,8 +349,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoDomainMatchesDomain) {
/*secure=*/true,
/*httponly=*/false,
/*same_site=*/CookieSameSite::NO_RESTRICTION,
/*priority=*/CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
/*priority=*/CookiePriority::COOKIE_PRIORITY_DEFAULT);
};
// by default empty domain list and default match action will match.
@ -419,8 +409,7 @@ TEST(CookieDeletionInfoTest, CookieDeletionInfoMatchesDomainList) {
/*secure=*/false,
/*httponly=*/false,
/*same_site=*/CookieSameSite::NO_RESTRICTION,
/*priority=*/CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false);
/*priority=*/CookiePriority::COOKIE_PRIORITY_DEFAULT);
};
// With two empty lists (default) should match any domain.

@ -120,7 +120,7 @@ std::unique_ptr<CanonicalCookie> BuildCanonicalCookie(
return CanonicalCookie::CreateUnsafeCookieForTesting(
pc.Name(), pc.Value(), "." + url.host(), cookie_path, creation_time,
cookie_expires, base::Time(), base::Time(), pc.IsSecure(),
pc.IsHttpOnly(), pc.SameSite(), pc.Priority(), /*same_party=*/false);
pc.IsHttpOnly(), pc.SameSite(), pc.Priority());
}
void AddCookieToList(const GURL& url,
@ -232,8 +232,7 @@ std::unique_ptr<CookieMonster> CreateMonsterFromStoreForGC(
CanonicalCookie::CreateUnsafeCookieForTesting(
"a", "1", base::StringPrintf("h%05d.izzle", i), "/path",
creation_time, expiration_time, base::Time(), base::Time(), secure,
false, CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
false);
false, CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT);
cc->SetLastAccessDate(last_access_time);
store->AddCookie(*cc);
}

@ -273,89 +273,88 @@ class CookieMonsterTestBase : public CookieStoreTest<T> {
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"dom_1", "A", ".harvard.edu", "/", now, base::Time(), base::Time(),
base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"dom_2", "B", ".math.harvard.edu", "/", now, base::Time(), base::Time(),
base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"dom_3", "C", ".bourbaki.math.harvard.edu", "/", now, base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Host cookies
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"host_1", "A", url_top_level_domain_plus_1, "/", now, base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"host_2", "B", url_top_level_domain_plus_2, "/", now, base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"host_3", "C", url_top_level_domain_plus_3, "/", now, base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// http_only cookie
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"httpo_check", "A", url_top_level_domain_plus_2, "/", now, base::Time(),
base::Time(), base::Time(), false, true, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// same-site cookie
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"same_site_check", "A", url_top_level_domain_plus_2, "/", now,
base::Time(), base::Time(), base::Time(), false, false,
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT));
// same-party cookie
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"same_party_check", "A", url_top_level_domain_plus_2, "/", now,
base::Time(), base::Time(), base::Time(), true /* secure */, false,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT,
true /* same_party */));
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT));
// Secure cookies
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"sec_dom", "A", ".math.harvard.edu", "/", now, base::Time(),
base::Time(), base::Time(), true, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"sec_host", "B", url_top_level_domain_plus_2, "/", now, base::Time(),
base::Time(), base::Time(), true, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Domain path cookies
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"dom_path_1", "A", ".math.harvard.edu", "/dir1", now, base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"dom_path_2", "B", ".math.harvard.edu", "/dir1/dir2", now, base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Host path cookies
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"host_path_1", "A", url_top_level_domain_plus_2, "/dir1", now,
base::Time(), base::Time(), base::Time(), false, false,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"host_path_2", "B", url_top_level_domain_plus_2, "/dir1/dir2", now,
base::Time(), base::Time(), base::Time(), false, false,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT));
// Partitioned cookies
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"__Host-pc_1", "A", url_top_level_domain_secure, "/", now, base::Time(),
base::Time(), base::Time(), true, false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT, false,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
CookiePartitionKey::FromURLForTesting(GURL(kTopLevelDomainPlus1))));
cookies.push_back(CanonicalCookie::CreateUnsafeCookieForTesting(
"__Host-pc_2", "B", url_top_level_domain_secure, "/", now, base::Time(),
base::Time(), base::Time(), true, false, CookieSameSite::NO_RESTRICTION,
CookiePriority::COOKIE_PRIORITY_DEFAULT, false,
CookiePriority::COOKIE_PRIORITY_DEFAULT,
CookiePartitionKey::FromURLForTesting(GURL(kTopLevelDomainPlus1))));
for (auto& cookie : cookies) {
@ -917,7 +916,7 @@ class CookieMonsterTestBase : public CookieStoreTest<T> {
/*last_access=*/creation_time, /*last_update=*/creation_time,
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false /* same_party */));
COOKIE_PRIORITY_DEFAULT));
GURL source_url = cookie_util::SimulatedCookieSource(*cc, "https");
cm->SetCanonicalCookieAsync(std::move(cc), source_url,
CookieOptions::MakeAllInclusive(),
@ -959,7 +958,6 @@ struct CookiesInputInfo {
bool http_only;
CookieSameSite same_site;
CookiePriority priority;
bool same_party;
};
} // namespace
@ -1097,11 +1095,11 @@ TEST_F(DeferredCookieTaskTest, DeferredSetAllCookies) {
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "." + http_www_foo_.domain(), "/", base::Time::Now(),
base::Time(), base::Time(), base::Time(), false, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "D", "." + http_www_foo_.domain(), "/", base::Time::Now(),
base::Time(), base::Time(), base::Time(), false, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
ResultSavingCookieCallback<CookieAccessResult> call1;
cookie_monster_->SetAllCookiesAsync(list, call1.MakeCallback());
@ -2694,13 +2692,13 @@ TEST_F(CookieMonsterTest, BackingStoreCommunication) {
const CookiesInputInfo input_info[] = {
{GURL("https://a.b.foo.com"), "a", "1", "a.b.foo.com", "/path/to/cookie",
expires, true /* secure */, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false},
COOKIE_PRIORITY_DEFAULT},
{GURL("https://www.foo.com"), "b", "2", ".foo.com", "/path/from/cookie",
expires + base::Seconds(10), true, true, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, true},
COOKIE_PRIORITY_DEFAULT},
{GURL("https://foo.com"), "c", "3", "foo.com", "/another/path/to/cookie",
base::Time::Now() + base::Seconds(100), false, false,
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT, false}};
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT}};
const int INPUT_DELETE = 1;
// Create new cookies and flush them to the store.
@ -2714,7 +2712,7 @@ TEST_F(CookieMonsterTest, BackingStoreCommunication) {
cookie.name, cookie.value, cookie.domain, cookie.path,
base::Time(), cookie.expiration_time, base::Time(), base::Time(),
cookie.secure, cookie.http_only, cookie.same_site,
cookie.priority, cookie.same_party),
cookie.priority),
cookie.url, true /*modify_httponly*/));
}
@ -3173,28 +3171,26 @@ TEST_F(CookieMonsterTest, SetAllCookies) {
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "." + http_www_foo_.url().host(), "/", base::Time::Now(),
base::Time(), base::Time(), base::Time(), false, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "D", "." + http_www_foo_.url().host(), "/bar", base::Time::Now(),
base::Time(), base::Time(), base::Time(), false, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"W", "X", "." + http_www_foo_.url().host(), "/", base::Time::Now(),
base::Time(), base::Time(), base::Time(), false, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"__Host-Y", "Z", https_www_foo_.url().host(), "/", base::Time::Now(),
base::Time(), base::Time(), base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, CookiePriority::COOKIE_PRIORITY_DEFAULT,
false,
CookiePartitionKey::FromURLForTesting(GURL("https://toplevelsite.com"))));
// Expired cookie, should not be stored.
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"expired", "foobar", https_www_foo_.url().host(), "/",
base::Time::Now() - base::Days(1), base::Time::Now() - base::Days(2),
base::Time(), base::Time(), /*secure=*/true, /*httponly=*/false,
CookieSameSite::NO_RESTRICTION, CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false));
CookieSameSite::NO_RESTRICTION, CookiePriority::COOKIE_PRIORITY_DEFAULT));
// SetAllCookies must not flush.
ASSERT_EQ(0, store->flush_count());
@ -3283,7 +3279,7 @@ TEST_F(CookieMonsterTest, HistogramCheck) {
base::Time::Now() + base::Minutes(59), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, /*same_party=*/false);
COOKIE_PRIORITY_DEFAULT);
GURL source_url = cookie_util::SimulatedCookieSource(*cookie, "https");
ASSERT_TRUE(SetCanonicalCookie(cm.get(), std::move(cookie), source_url,
/*modify_httponly=*/true));
@ -3415,8 +3411,7 @@ TEST_F(CookieMonsterTest, ControlCharacterPurge) {
"boo",
"." + domain, path, now2, later, base::Time(), base::Time(),
true /* secure */, false /* httponly */,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
false /* sameparty */);
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT);
initial_cookies.push_back(std::move(cc));
std::unique_ptr<CanonicalCookie> cc2 =
@ -3426,8 +3421,7 @@ TEST_F(CookieMonsterTest, ControlCharacterPurge) {
"boo",
"." + domain, path, now3, later, base::Time(), base::Time(),
true /* secure */, false /* httponly */,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
false /* sameparty */);
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT);
initial_cookies.push_back(std::move(cc2));
// Partitioned cookies with control characters should not be loaded.
@ -3441,7 +3435,7 @@ TEST_F(CookieMonsterTest, ControlCharacterPurge) {
domain, "/", now3, later, base::Time(), base::Time(),
true /* secure */, false /* httponly */,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
false /* sameparty */, cookie_partition_key);
cookie_partition_key);
initial_cookies.push_back(std::move(cc3));
AddCookieToList(url, "hello=world; path=" + path, now4, &initial_cookies);
@ -3635,7 +3629,7 @@ TEST_F(CookieMonsterTest, CookieCount2Histogram) {
base::Time::Now() + base::Minutes(59), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, /*same_party=*/false);
COOKIE_PRIORITY_DEFAULT);
GURL source_url = cookie_util::SimulatedCookieSource(*cookie, "https");
ASSERT_TRUE(SetCanonicalCookie(cm.get(), std::move(cookie), source_url,
/*modify_httponly=*/true));
@ -3674,7 +3668,7 @@ TEST_F(CookieMonsterTest, CookieJarSizeHistograms) {
base::Time(),
/*secure=*/true,
/*httponly=*/false, same_site, COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false, partition_key);
partition_key);
GURL source_url = cookie_util::SimulatedCookieSource(*cc, "https");
ASSERT_TRUE(SetCanonicalCookie(cm.get(), std::move(cc), source_url,
/*can_modify_httponly=*/true));
@ -3770,7 +3764,7 @@ TEST_F(CookieMonsterTest, PartitionedCookieHistograms) {
base::Time::Now() + base::Minutes(59), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, /*same_party=*/false);
COOKIE_PRIORITY_DEFAULT);
GURL source_url = cookie_util::SimulatedCookieSource(*cookie, "https");
ASSERT_TRUE(SetCanonicalCookie(cm.get(), std::move(cookie), source_url,
/*modify_httponly=*/true));
@ -3809,7 +3803,7 @@ TEST_F(CookieMonsterTest, PartitionedCookieHistograms) {
base::Time::Now() + base::Minutes(59), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
COOKIE_PRIORITY_DEFAULT,
CookiePartitionKey::FromURLForTesting(GURL("https://example.com")));
GURL source_url = cookie_util::SimulatedCookieSource(*cookie, "https");
ASSERT_TRUE(SetCanonicalCookie(cm.get(), std::move(cookie), source_url,
@ -3849,7 +3843,7 @@ TEST_F(CookieMonsterTest, PartitionedCookieHistograms) {
base::Time::Now() + base::Minutes(59), base::Time(), base::Time(),
/*secure=*/true,
/*httponly=*/false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
COOKIE_PRIORITY_DEFAULT,
CookiePartitionKey::FromURLForTesting(
GURL("https://example.com"), base::UnguessableToken::Create()));
GURL source_url = cookie_util::SimulatedCookieSource(*cookie, "https");
@ -6553,7 +6547,7 @@ TEST_F(CookieMonsterTest, FromStorageCookieCreated300DaysAgoThenUpdatedNow) {
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "." + https_www_foo_.url().host(), "/", original_creation,
original_expiry, base::Time(), base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
EXPECT_TRUE(SetAllCookies(cookie_monster.get(), list));
// Verify the cookie exists and was not clamped, even if clamping is on.
@ -6569,7 +6563,7 @@ TEST_F(CookieMonsterTest, FromStorageCookieCreated300DaysAgoThenUpdatedNow) {
CanonicalCookie::CreateSanitizedCookie(
https_www_foo_.url(), "A", "B", https_www_foo_.url().host(), "/",
new_creation, new_expiry, base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
absl::nullopt),
https_www_foo_.url(), false));
EXPECT_THAT(
@ -6596,7 +6590,7 @@ TEST_F(CookieMonsterTest, FromStorageCookieCreated500DaysAgoThenUpdatedNow) {
list.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "." + https_www_foo_.url().host(), "/", original_creation,
original_expiry, base::Time(), base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
EXPECT_TRUE(SetAllCookies(cookie_monster.get(), list));
// Verify the cookie exists and was not clamped, even if clamping is on.
@ -6612,7 +6606,7 @@ TEST_F(CookieMonsterTest, FromStorageCookieCreated500DaysAgoThenUpdatedNow) {
CanonicalCookie::CreateSanitizedCookie(
https_www_foo_.url(), "A", "B", https_www_foo_.url().host(), "/",
new_creation, new_expiry, base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
absl::nullopt),
https_www_foo_.url(), false));
EXPECT_THAT(
@ -6640,7 +6634,7 @@ TEST_F(CookieMonsterTest, SanitizedCookieCreated300DaysAgoThenUpdatedNow) {
CanonicalCookie::CreateSanitizedCookie(
https_www_foo_.url(), "A", "B", https_www_foo_.url().host(), "/",
original_creation, original_expiry, base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
absl::nullopt),
https_www_foo_.url(), false));
EXPECT_THAT(
@ -6656,7 +6650,7 @@ TEST_F(CookieMonsterTest, SanitizedCookieCreated300DaysAgoThenUpdatedNow) {
CanonicalCookie::CreateSanitizedCookie(
https_www_foo_.url(), "A", "B", https_www_foo_.url().host(), "/",
new_creation, new_expiry, base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
absl::nullopt),
https_www_foo_.url(), false));
EXPECT_THAT(
@ -6684,7 +6678,7 @@ TEST_F(CookieMonsterTest, SanitizedCookieCreated500DaysAgoThenUpdatedNow) {
CanonicalCookie::CreateSanitizedCookie(
https_www_foo_.url(), "A", "B", https_www_foo_.url().host(), "/",
original_creation, original_expiry, base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
absl::nullopt),
https_www_foo_.url(), false));
EXPECT_TRUE(GetAllCookies(cookie_monster.get()).empty());
@ -6697,7 +6691,7 @@ TEST_F(CookieMonsterTest, SanitizedCookieCreated500DaysAgoThenUpdatedNow) {
CanonicalCookie::CreateSanitizedCookie(
https_www_foo_.url(), "A", "B", https_www_foo_.url().host(), "/",
new_creation, new_expiry, base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, true,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
absl::nullopt),
https_www_foo_.url(), false));
EXPECT_THAT(GetAllCookies(cookie_monster.get()),

@ -473,8 +473,7 @@ TYPED_TEST_P(CookieStoreTest, FilterTest) {
std::unique_ptr<CanonicalCookie> cc(CanonicalCookie::CreateSanitizedCookie(
this->www_foo_foo_.url(), "A", "B", std::string(), "/foo", one_hour_ago,
one_hour_from_now, base::Time(), false, false,
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT, false,
absl::nullopt));
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT, absl::nullopt));
ASSERT_TRUE(cc);
EXPECT_TRUE(this->SetCanonicalCookie(
cs, std::move(cc), this->www_foo_foo_.url(), true /*modify_httponly*/));
@ -484,8 +483,7 @@ TYPED_TEST_P(CookieStoreTest, FilterTest) {
cc = CanonicalCookie::CreateSanitizedCookie(
this->www_foo_bar_.url(), "C", "D", this->www_foo_bar_.domain(), "/bar",
two_hours_ago, base::Time(), one_hour_ago, false, true,
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT, false,
absl::nullopt);
CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT, absl::nullopt);
ASSERT_TRUE(cc);
EXPECT_TRUE(this->SetCanonicalCookie(
cs, std::move(cc), this->www_foo_bar_.url(), true /*modify_httponly*/));
@ -497,8 +495,7 @@ TYPED_TEST_P(CookieStoreTest, FilterTest) {
cc = CanonicalCookie::CreateSanitizedCookie(
this->http_www_foo_.url(), "E", "F", std::string(), std::string(),
base::Time(), base::Time(), base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false,
absl::nullopt);
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, absl::nullopt);
ASSERT_TRUE(cc);
EXPECT_FALSE(this->SetCanonicalCookie(
cs, std::move(cc), this->http_www_foo_.url(), true /*modify_httponly*/));
@ -506,8 +503,7 @@ TYPED_TEST_P(CookieStoreTest, FilterTest) {
cc = CanonicalCookie::CreateSanitizedCookie(
this->https_www_foo_.url(), "E", "F", std::string(), std::string(),
base::Time(), base::Time(), base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false,
absl::nullopt);
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, absl::nullopt);
ASSERT_TRUE(cc);
EXPECT_TRUE(this->SetCanonicalCookie(
cs, std::move(cc), this->https_www_foo_.url(), true /*modify_httponly*/));
@ -606,27 +602,27 @@ TYPED_TEST_P(CookieStoreTest, SetCanonicalCookieTest) {
CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", foo_foo_host, "/foo", one_hour_ago, one_hour_from_now,
base::Time(), base::Time(), false /* secure */, false /* httponly */,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT, false),
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT),
this->www_foo_foo_.url(), true));
EXPECT_TRUE(this->SetCanonicalCookie(
cs,
CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "D", "." + foo_bar_domain, "/bar", two_hours_ago, base::Time(),
one_hour_ago, one_hour_ago, false, true, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false),
COOKIE_PRIORITY_DEFAULT),
this->www_foo_bar_.url(), true));
// A secure source is required for setting secure cookies.
EXPECT_TRUE(this->SetCanonicalCookieReturnAccessResult(
cs,
CanonicalCookie::CreateUnsafeCookieForTesting(
"E", "F", http_foo_host, "/", base::Time(),
base::Time(), base::Time(), base::Time(), true, false,
CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false),
this->http_www_foo_.url(), true)
.status.HasExclusionReason(
CookieInclusionStatus::EXCLUDE_SECURE_ONLY));
EXPECT_TRUE(
this->SetCanonicalCookieReturnAccessResult(
cs,
CanonicalCookie::CreateUnsafeCookieForTesting(
"E", "F", http_foo_host, "/", base::Time(), base::Time(),
base::Time(), base::Time(), true, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT),
this->http_www_foo_.url(), true)
.status.HasExclusionReason(
CookieInclusionStatus::EXCLUDE_SECURE_ONLY));
// A Secure cookie can be created from an insecure URL, but is rejected upon
// setting.
@ -649,8 +645,7 @@ TYPED_TEST_P(CookieStoreTest, SetCanonicalCookieTest) {
CanonicalCookie::CreateUnsafeCookieForTesting(
"E", "F", https_foo_host, "/", base::Time(), base::Time(),
base::Time(), base::Time(), true /* secure */, false /* httponly */,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT,
false /* same_party */),
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT),
this->https_www_foo_.url(), true /* modify_http_only */));
EXPECT_TRUE(
@ -660,7 +655,7 @@ TYPED_TEST_P(CookieStoreTest, SetCanonicalCookieTest) {
"E", "F", http_foo_host, "/", base::Time(), base::Time(),
base::Time(), base::Time(), true /* secure */,
false /* httponly */, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false /* same_party */),
COOKIE_PRIORITY_DEFAULT),
this->http_www_foo_.url(), true /* modify_http_only */)
.status.HasExclusionReason(
CookieInclusionStatus::EXCLUDE_SECURE_ONLY));
@ -674,8 +669,7 @@ TYPED_TEST_P(CookieStoreTest, SetCanonicalCookieTest) {
"G", "H", http_foo_host, "/unique", base::Time(),
base::Time(), base::Time(), base::Time(),
false /* secure */, true /* httponly */,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT,
false /* same_party */),
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT),
this->http_www_foo_.url(), false /* modify_http_only */)
.status.HasExclusionReason(
CookieInclusionStatus::EXCLUDE_HTTP_ONLY));
@ -703,8 +697,7 @@ TYPED_TEST_P(CookieStoreTest, SetCanonicalCookieTest) {
CanonicalCookie::CreateUnsafeCookieForTesting(
"G", "H", http_foo_host, "/unique", base::Time(), base::Time(),
base::Time(), base::Time(), false /* secure */, true /* httponly */,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT,
false /* same_party */),
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT),
this->http_www_foo_.url(), true /* modify_http_only */));
EXPECT_TRUE(this->SetCanonicalCookieReturnAccessResult(
@ -713,8 +706,7 @@ TYPED_TEST_P(CookieStoreTest, SetCanonicalCookieTest) {
"G", "H", http_foo_host, "/unique", base::Time(),
base::Time(), base::Time(), base::Time(),
false /* secure */, true /* httponly */,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT,
false /* same_party */),
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT),
this->http_www_foo_.url(), false /* modify_http_only */)
.status.HasExclusionReason(
CookieInclusionStatus::EXCLUDE_HTTP_ONLY));
@ -725,8 +717,7 @@ TYPED_TEST_P(CookieStoreTest, SetCanonicalCookieTest) {
CanonicalCookie::CreateUnsafeCookieForTesting(
"G", "H", http_foo_host, "/unique", base::Time(), base::Time(),
base::Time(), base::Time(), false /* secure */, true /* httponly */,
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT,
false /* same_party */),
CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT),
this->http_www_foo_.url(), true /* modify_http_only */));
}
@ -804,28 +795,28 @@ TYPED_TEST_P(CookieStoreTest, SecureEnforcement) {
CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", http_domain, "/", base::Time::Now(), base::Time(),
base::Time(), base::Time(), true, false, CookieSameSite::STRICT_MODE,
COOKIE_PRIORITY_DEFAULT, false /* same_party */),
COOKIE_PRIORITY_DEFAULT),
http_url, true /*modify_httponly*/));
EXPECT_TRUE(this->SetCanonicalCookie(
cs,
CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", http_domain, "/", base::Time::Now(), base::Time(),
base::Time(), base::Time(), true, false, CookieSameSite::STRICT_MODE,
COOKIE_PRIORITY_DEFAULT, false /* same_party */),
COOKIE_PRIORITY_DEFAULT),
https_url, true /*modify_httponly*/));
EXPECT_TRUE(this->SetCanonicalCookie(
cs,
CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", http_domain, "/", base::Time::Now(), base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::STRICT_MODE,
COOKIE_PRIORITY_DEFAULT, false /* same_party */),
COOKIE_PRIORITY_DEFAULT),
https_url, true /*modify_httponly*/));
EXPECT_TRUE(this->SetCanonicalCookie(
cs,
CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", http_domain, "/", base::Time::Now(), base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::STRICT_MODE,
COOKIE_PRIORITY_DEFAULT, false /* same_party */),
COOKIE_PRIORITY_DEFAULT),
http_url, true /*modify_httponly*/));
}

@ -926,7 +926,6 @@ bool SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement(
statement.ColumnInt(14))), // samesite
DBCookiePriorityToCookiePriority(static_cast<DBCookiePriority>(
statement.ColumnInt(12))), // priority
statement.ColumnBool(17), // is_same_party
std::move(cookie_partition_key), // top_frame_site_key
DBToCookieSourceScheme(statement.ColumnInt(15)), // source_scheme
statement.ColumnInt(16)); // source_port

@ -89,7 +89,7 @@ class SQLitePersistentCookieStorePerfTest : public testing::Test {
return *CanonicalCookie::CreateUnsafeCookieForTesting(
base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name, "/", t,
t, t, t, false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false);
COOKIE_PRIORITY_DEFAULT);
}
void SetUp() override {

@ -223,7 +223,7 @@ class SQLitePersistentCookieStoreTest : public TestWithTaskEnvironment {
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
name, value, domain, path, creation, creation, base::Time(),
base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
}
void AddCookieWithExpiration(const std::string& name,
@ -235,7 +235,7 @@ class SQLitePersistentCookieStoreTest : public TestWithTaskEnvironment {
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
name, value, domain, path, creation, expiration, base::Time(),
base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
}
std::string ReadRawDBContents() {
@ -631,7 +631,7 @@ TEST_F(SQLitePersistentCookieStoreTest, TestLoadOldSessionCookies) {
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "D", "sessioncookie.com", "/", base::Time::Now(), base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Force the store to write its data to the disk.
DestroyStore();
@ -658,7 +658,7 @@ TEST_F(SQLitePersistentCookieStoreTest, TestDontLoadOldSessionCookies) {
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "D", "sessioncookie.com", "/", base::Time::Now(), base::Time(),
base::Time(), base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Force the store to write its data to the disk.
DestroyStore();
@ -770,13 +770,13 @@ TEST_F(SQLitePersistentCookieStoreTest, PersistIsPersistent) {
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
kSessionName, "val", "sessioncookie.com", "/", base::Time::Now(),
base::Time(), base::Time(), base::Time(), false, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT, false));
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT));
// Add a persistent cookie.
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
kPersistentName, "val", "sessioncookie.com", "/",
base::Time::Now() - base::Days(1), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Force the store to write its data to the disk.
DestroyStore();
@ -817,21 +817,21 @@ TEST_F(SQLitePersistentCookieStoreTest, PriorityIsPersistent) {
kLowName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(1), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_LOW, false));
COOKIE_PRIORITY_LOW));
// Add a medium-priority persistent cookie.
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
kMediumName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(2), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_MEDIUM, false));
COOKIE_PRIORITY_MEDIUM));
// Add a high-priority persistent cookie.
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
kHighName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(3), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_HIGH, false));
COOKIE_PRIORITY_HIGH));
// Force the store to write its data to the disk.
DestroyStore();
@ -878,21 +878,21 @@ TEST_F(SQLitePersistentCookieStoreTest, SameSiteIsPersistent) {
kNoneName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(1), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Add a lax-samesite persistent cookie.
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
kLaxName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(2), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Add a strict-samesite persistent cookie.
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
kStrictName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(3), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::STRICT_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Force the store to write its data to the disk.
DestroyStore();
@ -934,7 +934,7 @@ TEST_F(SQLitePersistentCookieStoreTest, SameSiteExtendedTreatedAsUnspecified) {
kExtendedName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(1), base::Time::Now() + base::Days(1),
base::Time(), base::Time(), false, false, CookieSameSite::STRICT_MODE,
COOKIE_PRIORITY_DEFAULT, false));
COOKIE_PRIORITY_DEFAULT));
// Force the store to write its data to the disk.
DestroyStore();
@ -974,16 +974,16 @@ TEST_F(SQLitePersistentCookieStoreTest, SamePartyIsPersistent) {
kNonSamePartyCookieName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(1), base::Time::Now() + base::Days(1),
base::Time(), base::Time(),
/*secure=*/true, false, CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false));
/*secure=*/true, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT));
// Add a SameParty persistent cookie.
store_->AddCookie(*CanonicalCookie::CreateUnsafeCookieForTesting(
kSamePartyCookieName, kCookieValue, kDomain, kCookiePath,
base::Time::Now() - base::Minutes(1), base::Time::Now() + base::Days(1),
base::Time(), base::Time(),
/*secure=*/true, false, CookieSameSite::LAX_MODE, COOKIE_PRIORITY_DEFAULT,
/*same_party=*/true));
/*secure=*/true, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT));
// Force the store to write its data to the disk.
DestroyStore();
@ -1034,7 +1034,6 @@ TEST_F(SQLitePersistentCookieStoreTest, SourcePortIsPersistent) {
base::Time(), base::Time(),
/*secure=*/true, false, CookieSameSite::LAX_MODE,
COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false,
/*partition_key=*/absl::nullopt,
CookieSourceScheme::kUnset /* Doesn't matter for this test. */,
input.port));
@ -1697,27 +1696,27 @@ std::vector<CanonicalCookie> CookiesForMigrationTest() {
cookies.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "example.com", "/", now, now, now, now, true /* secure */,
false /* httponly */, CookieSameSite::UNSPECIFIED,
COOKIE_PRIORITY_DEFAULT, false /* same_party */));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "B", "example.com", "/", now, now, now, now, true /* secure */,
false /* httponly */, CookieSameSite::UNSPECIFIED,
COOKIE_PRIORITY_DEFAULT, true /* same_party */));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "example2.com", "/", now, now, now, now, true /* secure */,
false /* httponly */, CookieSameSite::UNSPECIFIED,
COOKIE_PRIORITY_DEFAULT, true /* same_party */));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "B", "example2.com", "/", now, now + base::Days(399), now, now,
false /* secure */, false /* httponly */, CookieSameSite::UNSPECIFIED,
COOKIE_PRIORITY_DEFAULT, false /* same_party */));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "example.com", "/path", now, now + base::Days(400), now, now,
false /* secure */, false /* httponly */, CookieSameSite::UNSPECIFIED,
COOKIE_PRIORITY_DEFAULT, false /* same_party */));
COOKIE_PRIORITY_DEFAULT));
cookies.push_back(*CanonicalCookie::CreateUnsafeCookieForTesting(
"C", "B", "example.com", "/path", now, now + base::Days(401), now, now,
false /* secure */, false /* httponly */, CookieSameSite::UNSPECIFIED,
COOKIE_PRIORITY_DEFAULT, false /* same_party */));
COOKIE_PRIORITY_DEFAULT));
return cookies;
}
@ -2037,7 +2036,6 @@ TEST_P(PartitionedCookiesSQLitePersistentCookieStoreTest,
base::Time::Now(), base::Time::Now() + base::Days(1), base::Time::Now(),
base::Time::Now(), true /* secure */, false /* httponly */,
CookieSameSite::UNSPECIFIED, COOKIE_PRIORITY_DEFAULT,
false /* sameparty */,
CookiePartitionKey::FromURLForTesting(GURL("https://toplevelsite.com"))));
Flush();

@ -140,8 +140,8 @@ void CookieManager::SetCanonicalCookie(const net::CanonicalCookie& cookie,
cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(),
cookie.CreationDate(), adjusted_expiry_date, cookie.LastAccessDate(),
cookie.LastUpdateDate(), cookie.IsSecure(), cookie.IsHttpOnly(),
cookie.SameSite(), cookie.Priority(), cookie.IsSameParty(),
cookie_partition_key, cookie.SourceScheme(), cookie.SourcePort());
cookie.SameSite(), cookie.Priority(), cookie_partition_key,
cookie.SourceScheme(), cookie.SourcePort());
if (!cookie_ptr) {
std::move(callback).Run(
net::CookieAccessResult(net::CookieInclusionStatus(

File diff suppressed because it is too large Load Diff

@ -68,8 +68,7 @@ std::unique_ptr<net::CanonicalCookie> MakeCanonicalCookie(
/*expiration=*/base::Time(), /*last_access=*/base::Time(),
/*last_update=*/base::Time(),
/*secure=*/true, /*httponly=*/false, net::CookieSameSite::UNSPECIFIED,
net::CookiePriority::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false,
cookie_partition_key);
net::CookiePriority::COOKIE_PRIORITY_DEFAULT, cookie_partition_key);
}
struct TestCase {

@ -2861,7 +2861,7 @@ bool SetCookieHelper(NetworkContext* network_context,
*net::CanonicalCookie::CreateUnsafeCookieForTesting(
key, value, url.host(), "/", base::Time(), base::Time(), base::Time(),
base::Time(), true, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false),
net::COOKIE_PRIORITY_LOW),
url, net::CookieOptions::MakeAllInclusive(),
base::BindOnce(&SetCookieCallback, &run_loop, &result));
run_loop.Run();
@ -2882,7 +2882,7 @@ TEST_F(NetworkContextTest, CookieManager) {
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"TestCookie", "1", "www.test.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), false, false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
cookie_manager_remote->SetCanonicalCookie(
*cookie, net::cookie_util::SimulatedCookieSource(*cookie, "https"),
net::CookieOptions::MakeAllInclusive(),
@ -4579,7 +4579,7 @@ TEST_F(NetworkContextTest, CanSetCookieFalseIfCookiesBlocked) {
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"TestCookie", "1", "www.test.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), false, false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
EXPECT_TRUE(
network_context->url_request_context()->network_delegate()->CanSetCookie(
*request, *cookie, /* options */ nullptr,
@ -4606,7 +4606,7 @@ TEST_F(NetworkContextTest, CanSetCookieTrueIfCookiesAllowed) {
auto cookie = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"TestCookie", "1", "www.test.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), false, false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
SetDefaultContentSetting(CONTENT_SETTING_ALLOW, network_context.get());
net::CookieInclusionStatus status;

@ -692,8 +692,8 @@ bool StructTraits<
std::move(name), std::move(value), std::move(domain), std::move(path),
std::move(creation_time), std::move(expiry_time),
std::move(last_access_time), std::move(last_update_time), cookie.secure(),
cookie.httponly(), site_restrictions, priority, /*same_party=*/false,
partition_key, source_scheme, cookie.source_port());
cookie.httponly(), site_restrictions, priority, partition_key,
source_scheme, cookie.source_port());
if (!cc)
return false;
*out = *cc;

@ -24,8 +24,8 @@ TEST(CookieManagerTraitsTest, Roundtrips_CanonicalCookie) {
auto original = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "x.y", "/path", base::Time(), base::Time(), base::Time(),
base::Time(), false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false, absl::nullopt,
net::CookieSourceScheme::kSecure, 8433);
net::COOKIE_PRIORITY_LOW, absl::nullopt, net::CookieSourceScheme::kSecure,
8433);
net::CanonicalCookie copied;
@ -54,7 +54,7 @@ TEST(CookieManagerTraitsTest, Roundtrips_CanonicalCookie) {
net::CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "x.y", "/path", base::Time(), base::Time(), base::Time(),
base::Time(), false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false, absl::nullopt,
net::COOKIE_PRIORITY_LOW, absl::nullopt,
net::CookieSourceScheme::kSecure, url::PORT_UNSPECIFIED);
net::CanonicalCookie copied_unspecified;
@ -68,8 +68,8 @@ TEST(CookieManagerTraitsTest, Roundtrips_CanonicalCookie) {
auto original_invalid = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"A", "B", "x.y", "/path", base::Time(), base::Time(), base::Time(),
base::Time(), false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false, absl::nullopt,
net::CookieSourceScheme::kSecure, url::PORT_INVALID);
net::COOKIE_PRIORITY_LOW, absl::nullopt, net::CookieSourceScheme::kSecure,
url::PORT_INVALID);
net::CanonicalCookie copied_invalid;
EXPECT_TRUE(mojo::test::SerializeAndDeserialize<mojom::CanonicalCookie>(
@ -83,7 +83,7 @@ TEST(CookieManagerTraitsTest, Roundtrips_CanonicalCookie) {
original = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"A\n", "B", "x.y", "/path", base::Time(), base::Time(), base::Time(),
base::Time(), false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
EXPECT_FALSE(mojo::test::SerializeAndDeserialize<mojom::CanonicalCookie>(
*original, copied));
@ -120,7 +120,7 @@ TEST(CookieManagerTraitsTest, Rountrips_CookieWithAccessResult) {
"A", "B", "x.y", "/path", base::Time(), base::Time(), base::Time(),
base::Time(),
/*secure=*/true, /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
net::CookieWithAccessResult original = {*original_cookie,
net::CookieAccessResult()};
@ -153,7 +153,7 @@ TEST(CookieManagerTraitsTest, Roundtrips_CookieAndLineWithAccessResult) {
"A", "B", "x.y", "/path", base::Time(), base::Time(), base::Time(),
base::Time(),
/*secure=*/true, /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
net::CookieAndLineWithAccessResult original(*original_cookie, "cookie-string",
net::CookieAccessResult());
@ -374,7 +374,7 @@ TEST(CookieManagerTraitsTest, Roundtrips_PartitionKey) {
auto original = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"__Host-A", "B", "x.y", "/", base::Time(), base::Time(), base::Time(),
base::Time(), true, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false,
net::COOKIE_PRIORITY_LOW,
net::CookiePartitionKey::FromURLForTesting(
GURL("https://toplevelsite.com")),
net::CookieSourceScheme::kSecure, 8433);
@ -389,7 +389,7 @@ TEST(CookieManagerTraitsTest, Roundtrips_PartitionKey) {
original = net::CanonicalCookie::CreateUnsafeCookieForTesting(
"__Host-A", "B", "x.y", "/", base::Time(), base::Time(), base::Time(),
base::Time(), true, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_LOW, false, net::CookiePartitionKey::FromScript(),
net::COOKIE_PRIORITY_LOW, net::CookiePartitionKey::FromScript(),
net::CookieSourceScheme::kSecure, 8433);
EXPECT_TRUE(mojo::test::SerializeAndDeserialize<mojom::CanonicalCookie>(
*original, copied));
@ -487,7 +487,7 @@ TEST(CookieManagerTraitsTest, Roundtrips_CookieChangeInfo) {
"A", "B", "x.y", "/path", base::Time(), base::Time(), base::Time(),
base::Time(),
/*secure=*/false, /*httponly =*/false, net::CookieSameSite::UNSPECIFIED,
net::COOKIE_PRIORITY_LOW, false);
net::COOKIE_PRIORITY_LOW);
net::CookieChangeInfo original(
*original_cookie,

@ -829,8 +829,8 @@ void RestrictedCookieManager::SetCanonicalCookie(
net::CanonicalCookie::FromStorage(
cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(), now,
cookie.ExpiryDate(), now, now, cookie.IsSecure(), cookie.IsHttpOnly(),
cookie.SameSite(), cookie.Priority(), cookie.IsSameParty(),
cookie_partition_key, source_scheme, origin_.port());
cookie.SameSite(), cookie.Priority(), cookie_partition_key,
source_scheme, origin_.port());
DCHECK(sanitized_cookie);
// FromStorage() uses a less strict version of IsCanonical(), we need to check
// the stricter version as well here.

@ -389,7 +389,7 @@ class RestrictedCookieManagerTest
base::Time(),
/*secure=*/secure,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
"https", /*can_modify_httponly=*/true));
}
@ -404,28 +404,10 @@ class RestrictedCookieManagerTest
base::Time(),
/*secure=*/true,
/*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
"https", /*can_modify_httponly=*/true));
}
// Set a canonical cookie directly into the store, has both SameSite=lax and
// SameParty.
void SetSamePartyCookie(const char* name,
const char* value,
const char* domain,
const char* path,
bool secure = true) {
CHECK(SetCanonicalCookie(
*net::CanonicalCookie::CreateUnsafeCookieForTesting(
name, value, domain, path, base::Time(), base::Time(), base::Time(),
base::Time(),
/*secure=*/secure,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/true),
"https", /*can_modify_httponly=*/true,
net::CookieOptions::SameSiteCookieContext::ContextType::SAME_SITE_LAX));
}
std::unique_ptr<TestCookieChangeListener> CreateCookieChangeListener(
const GURL& url,
const net::SiteForCookies& site_for_cookies,
@ -1068,75 +1050,13 @@ TEST_P(RestrictedCookieManagerTest, GetAllForUrlPolicyWarnActual) {
EXCLUDE_SAMESITE_NONE_INSECURE}))));
}
TEST_P(RestrictedCookieManagerTest, GetAllForUrlSameParty) {
SetSamePartyCookie("cookie-name", "cookie-value", "example.com", "/");
// Same Party
{
auto options = mojom::CookieManagerGetOptions::New();
options->name = "cookie-name";
options->match_type = mojom::CookieMatchType::STARTS_WITH;
EXPECT_THAT(sync_service_->GetAllForUrl(
kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false, std::move(options)),
ElementsAre(net::MatchesCookieNameValue("cookie-name",
"cookie-value")));
WaitForCallback();
}
service_->OverrideIsolationInfoForTesting(net::IsolationInfo::Create(
net::IsolationInfo::RequestType::kOther, kDefaultOrigin, kDefaultOrigin,
net::SiteForCookies()));
{
auto options = mojom::CookieManagerGetOptions::New();
options->name = "cookie-name";
options->match_type = mojom::CookieMatchType::STARTS_WITH;
EXPECT_THAT(sync_service_->GetAllForUrl(
kDefaultUrlWithPath, net::SiteForCookies(), kDefaultOrigin,
/*has_storage_access=*/false, std::move(options)),
ElementsAre(net::MatchesCookieNameValue("cookie-name",
"cookie-value")));
WaitForCallback();
}
// Should still be blocked when third-party cookie blocking is enabled.
cookie_settings_.set_block_third_party_cookies(true);
auto options = mojom::CookieManagerGetOptions::New();
options->name = "cookie-name";
options->match_type = mojom::CookieMatchType::STARTS_WITH;
service_->OverrideIsolationInfoForTesting(net::IsolationInfo::Create(
net::IsolationInfo::RequestType::kOther, kDefaultOrigin, kDefaultOrigin,
net::SiteForCookies()));
EXPECT_THAT(sync_service_->GetAllForUrl(
kDefaultUrlWithPath, net::SiteForCookies(), kDefaultOrigin,
/*has_storage_access=*/false, std::move(options)),
testing::ElementsAreArray<CanonicalCookieMatcher>({}));
WaitForCallback();
EXPECT_THAT(
recorded_activity(),
ElementsAre(
testing::_, testing::_,
MatchesCookieOp(
mojom::CookieAccessDetails::Type::kRead, kDefaultUrlWithPath,
net::SiteForCookies(),
CookieOrLine("cookie-name=cookie-value",
mojom::CookieOrLine::Tag::kCookie),
net::CookieInclusionStatus::MakeFromReasonsForTesting(
{net::CookieInclusionStatus::EXCLUDE_USER_PREFERENCES},
{}))));
}
TEST_P(RestrictedCookieManagerTest, SetCanonicalCookie) {
EXPECT_TRUE(sync_service_->SetCanonicalCookie(
*net::CanonicalCookie::CreateUnsafeCookieForTesting(
"new-name", "new-value", "example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false));
@ -1168,7 +1088,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookie_WithStorageAccess) {
"new-name", "new-value", "example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, net::SiteForCookies(), kOtherOrigin,
/*has_storage_access=*/false));
@ -1178,7 +1098,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookie_WithStorageAccess) {
"new-name", "new-value", "example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, net::SiteForCookies(), kOtherOrigin,
/*has_storage_access=*/true));
}
@ -1191,7 +1111,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookieHttpOnly) {
"new-name", "new-value", "example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false));
@ -1232,7 +1152,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookieFromWrongOrigin) {
"new-name", "new-value", "not-example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kOtherUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false));
ASSERT_TRUE(received_bad_message());
@ -1249,7 +1169,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookieFromOpaqueOrigin) {
"new-name", "new-value", "not-example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false));
ASSERT_TRUE(received_bad_message());
@ -1262,7 +1182,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookieWithMismatchingDomain) {
"new-name", "new-value", "not-example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false));
ASSERT_TRUE(received_bad_message());
@ -1378,7 +1298,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookieWithInclusionStatus) {
"new-name", "new-value", "example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false, status_exclude));
ASSERT_TRUE(received_bad_message());
@ -1392,7 +1312,7 @@ TEST_P(RestrictedCookieManagerTest, SetCanonicalCookieWithInclusionStatus) {
"new-name", "new-value", "example.com", "/", base::Time(),
base::Time(), base::Time(), base::Time(), /*secure=*/true,
/*httponly=*/false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin,
/*has_storage_access=*/false, status_warning));
@ -1487,7 +1407,7 @@ TEST_P(RestrictedCookieManagerTest, SameSiteCookiesSpecialScheme) {
"strict-cookie", "1", "example.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), /*secure=*/false,
/*httponly=*/false, net::CookieSameSite::STRICT_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
https_url, chrome_site_for_cookies, chrome_origin,
/*has_storage_access=*/false));
EXPECT_TRUE(sync_service_->SetCanonicalCookie(
@ -1495,7 +1415,7 @@ TEST_P(RestrictedCookieManagerTest, SameSiteCookiesSpecialScheme) {
"lax-cookie", "1", "example.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), /*secure=*/false,
/*httponly=*/false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
https_url, chrome_site_for_cookies, chrome_origin,
/*has_storage_access=*/false));
@ -1518,7 +1438,7 @@ TEST_P(RestrictedCookieManagerTest, SameSiteCookiesSpecialScheme) {
"strict-cookie", "2", "example.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), /*secure=*/false,
/*httponly=*/false, net::CookieSameSite::STRICT_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
http_url, chrome_site_for_cookies, chrome_origin,
/*has_storage_access=*/false));
EXPECT_FALSE(sync_service_->SetCanonicalCookie(
@ -1526,7 +1446,7 @@ TEST_P(RestrictedCookieManagerTest, SameSiteCookiesSpecialScheme) {
"lax-cookie", "2", "example.com", "/", base::Time(), base::Time(),
base::Time(), base::Time(), /*secure=*/false,
/*httponly=*/false, net::CookieSameSite::LAX_MODE,
net::COOKIE_PRIORITY_DEFAULT, /*same_party=*/false),
net::COOKIE_PRIORITY_DEFAULT),
http_url, chrome_site_for_cookies, chrome_origin,
/*has_storage_access=*/false));

@ -71,7 +71,7 @@ class SessionCleanupCookieStoreTest : public testing::Test {
store_->AddCookie(*net::CanonicalCookie::CreateUnsafeCookieForTesting(
name, value, domain, path, creation, creation, base::Time(),
base::Time(), false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, false));
net::COOKIE_PRIORITY_DEFAULT));
}
void DestroyStore() {

@ -167,7 +167,7 @@ std::unique_ptr<net::CanonicalCookie> ToCanonicalCookie(
path.Utf8(), base::Time() /*creation*/, expires,
base::Time() /*last_access*/, true /*secure*/, false /*http_only*/,
same_site, net::CookiePriority::COOKIE_PRIORITY_DEFAULT,
/*same_party=*/false, cookie_partition_key, &status_out);
cookie_partition_key, &status_out);
// TODO(crbug.com/1310444): Improve serialization validation comments and
// associate them with ExceptionState codes.