refresh-with-continue-false.https.html (1650B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="helper.js" type="module"></script> 6 7 <script type="module"> 8 import { expireCookie, documentHasCookie, waitForCookie, addCookieAndSessionCleanup, configureServer, setupShardedServerState } from "./helper.js"; 9 10 promise_test(async t => { 11 await setupShardedServerState(); 12 const expectedCookieAndValue = "auth_cookie=abcdef0123"; 13 const expectedCookieAndAttributes = `${expectedCookieAndValue};Domain=${location.hostname};Path=/device-bound-session-credentials`; 14 addCookieAndSessionCleanup(t); 15 16 // Configure server to end the session upon refresh. 17 await configureServer({ shouldRefreshEndSession: true }); 18 19 // Prompt starting a session, and wait until registration completes. 20 const loginResponse = await fetch('login.py'); 21 assert_equals(loginResponse.status, 200); 22 await waitForCookie(expectedCookieAndValue, /*expectCookie=*/true); 23 24 // Confirm that a request has the cookie set. 25 const authResponse = await fetch('verify_authenticated.py'); 26 assert_equals(authResponse.status, 200); 27 28 // Expire the cookie. The server will end the session on attempted refresh. 29 expireCookie(expectedCookieAndAttributes); 30 assert_false(documentHasCookie(expectedCookieAndValue)); 31 const authResponseAfterExpiry = await fetch('verify_authenticated.py'); 32 assert_equals(authResponseAfterExpiry.status, 403); 33 assert_false(documentHasCookie(expectedCookieAndValue)); 34 }, "A session ended with continue:false does not refresh cookies"); 35 </script>