Commit 52a72af8 authored by Lily Chen's avatar Lily Chen Committed by Commit Bot

Make CookiePolicyBrowserTests work with SameSite changes

This change updates CookiePolicyBrowserTest to work under
SameSiteByDefaultCookies and CookiesWithoutSameSiteMustBeSecure.
This adds "SameSite=None;Secure" to some cookies which are accessed in
a third party context in tests.

Bug: 1006816
Change-Id: I7c4dc3d96f8cb718f9178fff93a000ce16c1d7f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1830288Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Lily Chen <chlily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708630}
parent c6bdd518
......@@ -9,8 +9,13 @@
domAutomationController.send(false);
}
function isHttps_() {
return location.protocol === 'https:';
}
function setCookie() {
document.cookie = 'foo=bar; Max-Age=1000';
const samesite_none_secure = '; SameSite=None; Secure';
document.cookie = 'foo=bar; Max-Age=1000' + (isHttps_() ? samesite_none_secure : '');
success_();
}
......@@ -19,7 +24,8 @@
}
function setSessionCookie() {
document.cookie = 'bar=session';
const samesite_none_secure = '; SameSite=None; Secure';
document.cookie = 'bar=session' + (isHttps_() ? samesite_none_secure : '');
success_();
}
......@@ -155,4 +161,4 @@
and BrowsingDataRemoverBrowserTest::SetDataForType.
</body>
</html>
\ No newline at end of file
</html>
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