Files
sousa-gecko/testing/web-platform/tests/device-bound-session-credentials/requests-have-query-params.https.html
T
thefrog b3c4b8128e Bug 1992468 [wpt PR 55235] - Add WPT for query params for registration + refresh endpoints, a=testonly
Automatic update from web-platform-tests
Add WPT for query params for registration + refresh endpoints

This also fixes start_session.py to convert response.headers (type:
ResponseHeaders) into a list before concatenating with another list.

Change-Id: Ie759e2f24869ead60aa872e6989182ed98cc665c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7003076
Reviewed-by: Daniel Rubery <drubery@chromium.org>
Commit-Queue: thefrog <thefrog@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1524818}

--

wpt-commits: 965e56dfd37b4c7956a149c8ce27fe3744224383
wpt-pr: 55235
2025-10-14 16:11:47 +00:00

44 lines
2.0 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="helper.js" type="module"></script>
<script type="module">
import { configureServer, expireCookie, documentHasCookie, waitForCookie, addCookieAndSessionCleanup, setupShardedServerState, postJson } from "./helper.js";
promise_test(async t => {
await setupShardedServerState();
const expectedCookieAndValue = "auth_cookie=abcdef0123";
const expectedCookieAndAttributes = `${expectedCookieAndValue};Domain=${location.hostname};Path=/device-bound-session-credentials`;
addCookieAndSessionCleanup(t);
// Configure server to:
// 1. Check that registration has the query param specified below.
// 2. Set a refresh endpoint query param in the session instructions and
// verify that refresh has that query param.
await configureServer({ hasCustomQueryParam: true });
// Prompt starting a session, and wait until registration completes. Pass
// through the query param to registration.
const registrationUrl = `start_session.py?registrationQueryParam=123`;
const loginResponse = await postJson('login.py', { registrationUrl });
assert_equals(loginResponse.status, 200);
await waitForCookie(expectedCookieAndValue, /*expectCookie=*/true);
// Confirm that a request has the cookie set.
const authResponse = await fetch('verify_authenticated.py');
assert_equals(authResponse.status, 200);
// Trigger refresh by expiring the cookie.
expireCookie(expectedCookieAndAttributes);
assert_false(documentHasCookie(expectedCookieAndValue));
// The server refresh will fail if the refresh endpoint query param is not
// present during refresh.
const authResponseAfterExpiry = await fetch('verify_authenticated.py');
assert_equals(authResponseAfterExpiry.status, 200);
assert_true(documentHasCookie(expectedCookieAndValue));
}, "Registration and refresh endpoints can contain query params");
</script>