Commit 11cb9122 authored by Nina Satragno's avatar Nina Satragno Committed by Commit Bot

[webauthn] Clean up virtual authenticators on layout tests

When multiple virtual authenticators are in scope and a MakeCredential
request is received, a credential is created on every authenticator due
to the way we dispatch requests. Since this reflects the real behaviour
(although in reality it's a very unlikely scenario), I don't think it's
a bug.

This created a non-deterministic failure where the ID of a created
credential would not match the expected value on layout tests since the
credential returned on an empty allowCredentials request would be the
one created on a second authenticator. Fix this by cleaning up virtual
authenticators created on individual tests so they do not interfere with
each other.

Bug: 1010863
Change-Id: Ibe2a987a3bb7a094008ab0c426f09065fc9bb59f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847852
Commit-Queue: Nina Satragno <nsatragno@chromium.org>
Auto-Submit: Nina Satragno <nsatragno@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703817}
parent 05f936ac
......@@ -6181,4 +6181,3 @@ crbug.com/1011723 virtual/disable-deferred-rendering/fast/canvas/OffscreenCanvas
# Sheriff 2019-10-04
crbug.com/1011191 [ Mac ] paint/invalidation/svg/use-clipped-hit.svg [ Pass Failure ]
crbug.com/1011188 [ Mac ] paint/invalidation/svg/svg-background-partial-redraw.html [ Pass Failure ]
crbug.com/1010863 http/tests/credentialmanager/credentialscontainer-get-with-virtual-authenticator.html [ Skip ]
......@@ -103,6 +103,10 @@ promise_test(t => {
promise_test(async t => {
let testAuthenticator = await navigator.credentials.test.createAuthenticator();
t.add_cleanup(async () => {
let id = await testAuthenticator.id();
return navigator.credentials.test.removeAuthenticator(id);
});
assert_true(await testAuthenticator.generateAndRegisterKey(ACCEPTABLE_CREDENTIAL_ID, "subdomain.example.test"));
let keys = await testAuthenticator.registeredKeys();
assert_equals(keys.length, 1);
......
......@@ -26,6 +26,10 @@ promise_test(async _ => {
promise_test(async t => {
let testAuthenticator = await navigator.credentials.test.createAuthenticator();
t.add_cleanup(async () => {
let id = await testAuthenticator.id();
return navigator.credentials.test.removeAuthenticator(id);
});
assert_true(await testAuthenticator.generateAndRegisterKey(ACCEPTABLE_CREDENTIAL_ID, "subdomain.example.test"));
let keys = await testAuthenticator.registeredKeys();
assert_equals(keys.length, 1);
......@@ -93,6 +97,10 @@ promise_test(async t => {
let bleTestAuthenticator = await navigator.credentials.test.createAuthenticator({
transport: blink.mojom.AuthenticatorTransport.BLE,
});
t.add_cleanup(async () => {
let id = await bleTestAuthenticator.id();
return navigator.credentials.test.removeAuthenticator(id);
});
let bleCredential = deepCopy(ACCEPTABLE_CREDENTIAL);
bleCredential.id = new TextEncoder().encode("bleCredential");
bleCredential.transports = ["ble"]
......
......@@ -16,7 +16,7 @@ promise_test(async _ => {
assert_false(!!window.mockAuthenticator);
}, "The WebAuthn Testing API should be active, and the mocked out API should not.");
promise_test(async _ => {
promise_test(async t => {
let authenticators = await navigator.credentials.test.authenticators();
assert_equals(authenticators.length, 0);
......@@ -24,6 +24,7 @@ promise_test(async _ => {
let testAuthenticator2 = await navigator.credentials.test.createAuthenticator();
let id1 = await testAuthenticator1.id();
let id2 = await testAuthenticator2.id();
t.add_cleanup(() => navigator.credentials.test.clearAuthenticators());
authenticators = await navigator.credentials.test.authenticators();
assert_equals(authenticators.length, 2);
......@@ -41,8 +42,9 @@ promise_test(async _ => {
assert_equals(authenticators.length, 0);
}, "Methods of VirtualAuthenticatorManager work.");
promise_test(async _ => {
promise_test(async t => {
let testAuthenticator = await navigator.credentials.test.createAuthenticator();
t.add_cleanup(() => navigator.credentials.test.clearAuthenticators());
let id = await testAuthenticator.id();
assert_equals(await testAuthenticator.uniqueId(), id);
......@@ -79,6 +81,4 @@ promise_test(async _ => {
assert_equals(keys.length, 0);
}, "Methods of VirtualAuthenticator work.");
promise_test(_ => navigator.credentials.test.clearAuthenticators(), "Clean up testing environment.");
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment