зеркало из https://github.com/mozilla/gecko-dev.git
33785a170e
Automatic update from web-platform-tests Reland "[FedCM] Enable CORS in ID assertion endpoint" This reverts commit 4b1c288aef71451a32e057cac8413c26a665ee32. Reason for revert: IDPs are now ready for this change Original change's description: > Revert "[FedCM] Enable CORS in ID assertion endpoint" > > This reverts commit b2cb1b55ae3c4f7b88a74a0ceb697646fde03a5b. > > Reason for revert: Causing issues to a real IDP > > Original change's description: > > [FedCM] Enable CORS in ID assertion endpoint > > > > I2S: https://groups.google.com/a/chromium.org/g/blink-dev/c/gYoQJsaiD9E > > > > Bug: 40284123 > > Change-Id: I61989f1e7a7578c2f59d87815e3ec2b51b7fc5be > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5370086 > > Reviewed-by: Nasko Oskov <nasko@chromium.org> > > Reviewed-by: Christian Dullweber <dullweber@chromium.org> > > Reviewed-by: Mathias Bynens <mathias@chromium.org> > > Commit-Queue: Nicolás Peña <npm@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#1274203} > > Bug: 40284123 > Change-Id: I4a518b55396d5aba676f0a15c9a515451dc11e86 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5381316 > Reviewed-by: Christian Biesinger <cbiesinger@chromium.org> > Reviewed-by: Mathias Bynens <mathias@chromium.org> > Commit-Queue: Nicolás Peña <npm@chromium.org> > Reviewed-by: Nasko Oskov <nasko@chromium.org> > Reviewed-by: Christian Dullweber <dullweber@chromium.org> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Cr-Commit-Position: refs/heads/main@{#1276213} Bug: 40284123 Change-Id: I64c8ceb82b3f49bc41e7b592d890699db67a2c6c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5440132 Reviewed-by: Mathias Bynens <mathias@chromium.org> Reviewed-by: Christian Dullweber <dullweber@chromium.org> Reviewed-by: Christian Biesinger <cbiesinger@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nasko Oskov <nasko@chromium.org> Cr-Commit-Position: refs/heads/main@{#1284723} -- wpt-commits: b1eacf12d9e205919a9363a179f14d6e8bc3bd71 wpt-pr: 45628 |
||
---|---|---|
.. | ||
fedcm | ||
README.md | ||
digital-identity-helper.js | ||
digital-identity-iframe.html | ||
echoing-nester.html | ||
fedcm-helper.sub.js | ||
fedcm-iframe-level2.html | ||
fedcm-iframe.html | ||
fedcm-mock.js | ||
fedcm-mojojs-helper.js | ||
federatedcredential-get.html | ||
fencedframe-mark-signedin.html | ||
iframe-mark-signedin.html | ||
mark_signedin | ||
mark_signedin.sub.headers | ||
mark_signedout | ||
mark_signedout.sub.headers | ||
otpcredential-helper.js | ||
otpcredential-iframe.html | ||
passwordcredential-get.html | ||
set_cookie | ||
set_cookie.headers |
README.md
CredentialManagement Testing
OTPCredential Testing
In this test suite otpcredential-helper.js
is a testing framework that enables
engines to test OTPCredential by intercepting the connection between the browser
and the underlying operating system and mock its behavior.
Usage:
- Include the following in your test:
<script src="/resources/test-only-api.js"></script>
<script src="support/otpcredential-helper.js"></script>
- Set expectations
await expect(receive).andReturn(() => {
// mock behavior
})
- Call
navigator.credentials.get({otp: {transport: ["sms"]}})
- Verify results
The mocking API is browser agnostic and is designed such that other engines could implement it too.
Here are the symbols that are exposed to tests that need to be implemented per engine:
- function receive(): the main/only function that can be mocked
- function expect(): the main/only function that enables us to mock it
- enum State {kSuccess, kTimeout}: allows you to mock success/failures
FedCM Testing
fedcm-mojojs-helper.js
exposes fedcm_mojo_mock_test
which is a specialized
promise_test
which comes pre-setup with the appropriate mocking infrastructure
to emulate platform federated auth backend. The mock is passed to the test
function as the second parameter.
Example usage:
<script type="module">
import {fedcm_mojo_mock_test} from './support/fedcm-mojojs-helper.js';
fedcm_mojo_mock_test(async (t, mock) => {
mock.returnToken("https://idp.test/fedcm.json", "a_token");
assert_equals("a_token", await navigator.credentials.get(options));
}, "Successfully obtaining a token using mock.");
</script>
The chromium implementation uses the MojoJS shim.