-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate cookie-test.js's httpRedirectCookieTest to test_driver.delete…
…_all_cookies Now that we have a JS function within testdriver to delete all cookies we should use it instead of the one-off helpers. Bug: 1233305 Change-Id: Ib0ee77a51a3b1bea9d48549a309fdba8116461bb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3116120 Reviewed-by: Steven Bingler <bingler@chromium.org> Auto-Submit: Ari Chivukula <arichiv@chromium.org> Commit-Queue: Ari Chivukula <arichiv@chromium.org> Cr-Commit-Position: refs/heads/main@{#951023}
- Loading branch information
Showing
13 changed files
with
52 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
function expireCookie(cookie) { | ||
const cookies = Array.isArray(cookie) ? cookie : [cookie]; | ||
for (let c of cookies) { | ||
document.cookie = c += "; max-age=0"; | ||
} | ||
} | ||
|
||
function getCookies() { | ||
return document.cookie; | ||
} | ||
|
||
// Note: this function has a dependency on testdriver.js. Any test files calling | ||
// it should include testdriver.js and testdriver-vendor.js | ||
window.addEventListener("message", (e) => { | ||
if (e.data == "getCookies") { | ||
const cookies = getCookies(); | ||
e.source.postMessage({"cookies": cookies}, '*'); | ||
let test_window = window.top; | ||
while (test_window.opener && !test_window.opener.closed) { | ||
test_window = test_window.opener.top; | ||
} | ||
|
||
if (typeof e.data == "object" && 'expireCookie' in e.data) { | ||
expireCookie(e.data.expireCookie); | ||
e.source.postMessage("expired", '*'); | ||
test_driver.set_test_context(test_window); | ||
if (e.data == "getAndExpireCookiesForRedirectTest") { | ||
const cookies = document.cookie; | ||
test_driver.delete_all_cookies().then(() => { | ||
e.source.postMessage({"cookies": cookies}, '*'); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters