Commit f4948d5d authored by Dylan Cutler's avatar Dylan Cutler Committed by Chromium LUCI CQ

Get ChromeOS browser tests to build when CanonicalCookie's constructor is private.

This is part of a larger effort to make CanonicalCookie's generic
constructor private.

This CL replaces uses of the constructor with the factory
CreateUnsafeCookieForTesting. This factory is meant for test-only code
and should not be used in production.

Make CanonicalCookie's constructor private.

Bug: 1102874
Change-Id: I124942d0aea21cc26a9ee36f35032bde3cb6fba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595450Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Cr-Commit-Position: refs/heads/master@{#839660}
parent aef988a3
...@@ -135,14 +135,15 @@ void InjectCookie(content::StoragePartition* storage_partition) { ...@@ -135,14 +135,15 @@ void InjectCookie(content::StoragePartition* storage_partition) {
storage_partition->GetNetworkContext()->GetCookieManager( storage_partition->GetNetworkContext()->GetCookieManager(
cookie_manager.BindNewPipeAndPassReceiver()); cookie_manager.BindNewPipeAndPassReceiver());
net::CanonicalCookie cookie( std::unique_ptr<net::CanonicalCookie> cookie =
kTestCookieName, kTestCookieValue, kTestCookieHost, "/", base::Time(), net::CanonicalCookie::CreateUnsafeCookieForTesting(
base::Time(), base::Time(), true /* secure */, false /* httponly*/, kTestCookieName, kTestCookieValue, kTestCookieHost, "/", base::Time(),
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM, base::Time(), base::Time(), true /* secure */, false /* httponly*/,
false /* same_party */); net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM,
false /* same_party */);
base::RunLoop run_loop; base::RunLoop run_loop;
cookie_manager->SetCanonicalCookie( cookie_manager->SetCanonicalCookie(
cookie, net::cookie_util::SimulatedCookieSource(cookie, "https"), *cookie, net::cookie_util::SimulatedCookieSource(*cookie, "https"),
net::CookieOptions(), net::CookieOptions(),
base::BindOnce(&InjectCookieDoneCallback, run_loop.QuitClosure())); base::BindOnce(&InjectCookieDoneCallback, run_loop.QuitClosure()));
run_loop.Run(); run_loop.Run();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment