Skip to content

Commit

Permalink
Revert "[FedCM] Make revoke test do actual network requests"
Browse files Browse the repository at this point in the history
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
Olivia Yingst authored and chromium-wpt-export-bot committed Jun 7, 2022
1 parent 5bebbfb commit 8c575ca
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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.");
Expand Down
1 change: 1 addition & 0 deletions credential-management/fedcm-revoke.https.html.headers
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.

6 changes: 0 additions & 6 deletions credential-management/support/revoke.py

This file was deleted.

0 comments on commit 8c575ca

Please sign in to comment.