-
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.
Revert "[FedCM] Make revoke test do actual network requests"
This reverts commit 6a575ea5afec3e47b3975f082cde49acf1c89063. Reason for revert: This CL might cause test external/wpt/credential-management/fedcm-revoke.sub.https.html to be flaky. Original change's description: > [FedCM] Make revoke test do actual network requests > > Instead of using a mojo mock. This tests a lot more of our code. > > Bug: 1309251 > Change-Id: I079cbbf962ed8b95870bd51fdff35f6f37ca3974 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3680732 > Commit-Queue: Christian Biesinger <[email protected]> > Reviewed-by: Yi Gu <[email protected]> > Cr-Commit-Position: refs/heads/main@{#1011646} Bug: 1309251 Change-Id: Iaf7e209ac4bdc0592478a330e54ec987b17b829f No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3693029 Commit-Queue: Olivia Yingst <[email protected]> Bot-Commit: Rubber Stamper <[email protected]> Cr-Commit-Position: refs/heads/main@{#1011704}
- Loading branch information
1 parent
5bebbfb
commit 8c575ca
Showing
4 changed files
with
13 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,16 @@ | |
<meta charset="utf-8"> | ||
<title>FederatedCredential.revoke() promise resolution</title> | ||
<link rel="author" title="Christian Biesinger" href="mailto:[email protected]"> | ||
<link rel="help" href="https://fedidcg.github.io/FedCM/#browser-api-revocation"> | ||
<link rel="help" href="https://wicg.github.io/FedCM/#browser-api-revocation"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<script type="module"> | ||
import {set_fedcm_cookie} from './support/fedcm-helper.js'; | ||
const url_prefix = 'https://{{host}}:{{ports[https][0]}}/credential-management/support/'; | ||
import {fedcm_test} from './support/fedcm-helper.js'; | ||
|
||
async function getCredential(provider_url) { | ||
const provider = { | ||
url: provider_url || url_prefix, | ||
url: provider_url || "https://idp.example/", | ||
clientId: "1234", | ||
}; | ||
return await navigator.credentials.get({ | ||
|
@@ -22,34 +21,24 @@ | |
}); | ||
} | ||
|
||
promise_test(async t => { | ||
await set_fedcm_cookie(); | ||
await (await getCredential()).login({nonce: '1'}); | ||
await (await getCredential()).revoke("1234"); | ||
|
||
// Second revoke should now fail since the first revoke should revoke | ||
// the permission. | ||
const result = (await getCredential()).revoke("1234"); | ||
return promise_rejects_dom(t, "NetworkError", result); | ||
fedcm_test(async (t, mock) => { | ||
mock.revokeReturn("kSuccess"); | ||
await (await getCredential()).revoke("[email protected]"); | ||
}, "Successfully revoking a token should resolve the promise."); | ||
|
||
promise_test(async t => { | ||
// Have to first login or the request will be rejected before it reaches | ||
// the server. | ||
await set_fedcm_cookie(); | ||
await (await getCredential()).login({nonce: '1'}); | ||
await (await getCredential()).revoke("1234"); | ||
|
||
const result = (await getCredential()).revoke("fail"); | ||
fedcm_test(async (t, mock) => { | ||
mock.revokeReturn("kError"); | ||
const result = (await getCredential()).revoke("[email protected]"); | ||
return promise_rejects_dom(t, "NetworkError", result); | ||
}, "Error should reject the promise."); | ||
|
||
promise_test(async t => { | ||
fedcm_test(async (t, mock) => { | ||
mock.revokeReturn("kError"); | ||
const result = (await getCredential()).revoke(""); | ||
return promise_rejects_dom(t, "InvalidStateError", result); | ||
}, "Empty hint should reject the promise."); | ||
|
||
promise_test(async t => { | ||
fedcm_test(async (t, mock) => { | ||
const result = getCredential("https://other-idp.example/").then((c) => c.revoke("[email protected]")); | ||
return promise_rejects_dom(t, "NetworkError", result); | ||
}, "Provider URL should honor Content-Security-Policy."); | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; connect-src https://idp.example |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.