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

Get google_apis:google_apis_unittests 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.

Bug: 1102874
Change-Id: I548be72deb5985faa27d7a0dd5119f3fa8e185f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2590056Reviewed-by: default avatarAlex Ilin <alexilin@chromium.org>
Reviewed-by: default avatarLily Chen <chlily@chromium.org>
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Cr-Commit-Position: refs/heads/master@{#836711}
parent 340ff5b3
...@@ -84,21 +84,23 @@ TEST(OAuthMultiloginResultTest, TryParseCookiesFromValue) { ...@@ -84,21 +84,23 @@ TEST(OAuthMultiloginResultTest, TryParseCookiesFromValue) {
double now = time_now.ToDoubleT(); double now = time_now.ToDoubleT();
double expiration = expiration_time.ToDoubleT(); double expiration = expiration_time.ToDoubleT();
const std::vector<CanonicalCookie> cookies = { const std::vector<CanonicalCookie> cookies = {
CanonicalCookie("SID", "vAlUe1", ".google.ru", "/", time_now, time_now, *CanonicalCookie::CreateUnsafeCookieForTesting(
expiration_time, /*is_secure=*/true, "SID", "vAlUe1", ".google.ru", "/", time_now, time_now,
/*is_http_only=*/false, net::CookieSameSite::UNSPECIFIED, expiration_time, /*secure=*/true,
net::CookiePriority::COOKIE_PRIORITY_HIGH, /*httponly=*/false, net::CookieSameSite::UNSPECIFIED,
/*is_same_party=*/false), net::CookiePriority::COOKIE_PRIORITY_HIGH,
CanonicalCookie("SAPISID", "vAlUe2", "google.com", "/", time_now, /*same_party=*/false),
time_now, expiration_time, /*is_secure=*/false, *CanonicalCookie::CreateUnsafeCookieForTesting(
/*is_http_only=*/true, net::CookieSameSite::LAX_MODE, "SAPISID", "vAlUe2", "google.com", "/", time_now, time_now,
net::CookiePriority::COOKIE_PRIORITY_HIGH, expiration_time, /*secure=*/false,
/*is_same_party=*/false), /*httponly=*/true, net::CookieSameSite::LAX_MODE,
CanonicalCookie("HSID", "vAlUe4", "", "/", time_now, time_now, time_now, net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*is_secure=*/true, /*is_http_only=*/true, /*same_party=*/false),
net::CookieSameSite::STRICT_MODE, *CanonicalCookie::CreateUnsafeCookieForTesting(
net::CookiePriority::COOKIE_PRIORITY_HIGH, "HSID", "vAlUe4", "", "/", time_now, time_now, time_now,
/*is_same_party=*/false)}; /*secure=*/true, /*httponly=*/true, net::CookieSameSite::STRICT_MODE,
net::CookiePriority::COOKIE_PRIORITY_HIGH,
/*same_party=*/false)};
EXPECT_EQ((int)result.cookies().size(), 3); EXPECT_EQ((int)result.cookies().size(), 3);
......
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