-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1923529 [wpt PR 48532] - [webauthn] Move nested frame tests to WP…
…Ts, a=testonly Automatic update from web-platform-tests [webauthn] Move nested frame tests to WPTs Split an internal web test that verifies that WebAuthn works in a variety of same-origin frames into two web-platform-tests, updating them to work with webdriver. Bug: 372169469 Change-Id: I121a35047033a02fc34bfb2b2b79791bccf42c00 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5917271 Commit-Queue: Ken Buchanan <kenrbchromium.org> Auto-Submit: Nina Satragno <nsatragnochromium.org> Reviewed-by: Ken Buchanan <kenrbchromium.org> Cr-Commit-Position: refs/heads/main{#1365850} -- wpt-commits: 9eab5122732d1b0178b6741d69b84616350cfb92 wpt-pr: 48532 UltraBlame original commit: cd33c6b0a29d27c4aba02de34cfa5719fe98c6f5
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...ing/web-platform/tests/credential-management/credentialscontainer-frame-basics.https.html
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,22 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>navigator.credentials frame tests</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<body></body> | ||
<script> | ||
promise_test(async t => { | ||
let PROBE_CREDENTIALS = "<script>window.parent.postMessage(String(navigator.credentials), '*');<\/script>"; | ||
|
||
let frame = document.createElement("iframe"); | ||
const loadPromise = new EventWatcher(t, frame, "load").wait_for("load"); | ||
frame.src = "data:text/html," + PROBE_CREDENTIALS; | ||
document.body.append(frame); | ||
await loadPromise; | ||
|
||
let eventWatcher = new EventWatcher(t, window, "message"); | ||
const { data } = await eventWatcher.wait_for("message"); | ||
assert_equals(data, "undefined"); | ||
}, "navigator.credentials should be undefined in documents generated from `data:` URLs."); | ||
</script> |
73 changes: 73 additions & 0 deletions
73
testing/web-platform/tests/webauthn/createcredential-nested-frame.https.html
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,73 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>WebAuthn credential.create() in a nested frame</title> | ||
<link rel="help" href="https://w3c.github.io/webauthn/#publickey-credentials-create-feature"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/common-inputs.js"></script> | ||
<script src=helpers.js></script> | ||
|
||
<body></body> | ||
<script> | ||
|
||
standardSetup(function () { | ||
"use strict"; | ||
|
||
const CREATE_CREDENTIALS = ` | ||
navigator.credentials.create({ | ||
publicKey: { | ||
challenge: Uint8Array.from([]), | ||
rp: { name: "rp" }, | ||
user: { id: Uint8Array.from([]), name: "marisa", displayName: "Marisa" }, | ||
pubKeyCredParams: [{type: "public-key", alg: -7}], | ||
} | ||
}).then(c => window.parent.postMessage("OK", "*")) | ||
.catch(e => window.parent.postMessage("Error: " + e.toString(), "*")); | ||
`; | ||
|
||
promise_test(async t => { | ||
const frame = document.createElement("iframe"); | ||
const loadPromise = new EventWatcher(t, frame, "load").wait_for("load"); | ||
document.body.append(frame); | ||
await loadPromise; | ||
frame.contentWindow.location = "javascript:" + CREATE_CREDENTIALS; | ||
|
||
const messageWatcher = new EventWatcher(t, window, "message"); | ||
const { data } = await messageWatcher.wait_for("message"); | ||
assert_equals(data, "OK"); | ||
}, "navigator.credentials.create({publicKey}) in a javascript url should should succeed."); | ||
|
||
promise_test(async t => { | ||
let frame = document.createElement("iframe"); | ||
const loadPromise = new EventWatcher(t, frame, "load").wait_for("load"); | ||
frame.srcdoc = ""; | ||
document.body.append(frame); | ||
await loadPromise; | ||
frame.contentWindow.eval(CREATE_CREDENTIALS); | ||
|
||
let eventWatcher = new EventWatcher(t, window, "message"); | ||
const { data } = await eventWatcher.wait_for("message"); | ||
assert_equals(data, "OK"); | ||
}, "navigator.credentials.create({publicKey}) in srcdoc should succeed."); | ||
|
||
promise_test(async t => { | ||
let frame = document.createElement("iframe"); | ||
const loadPromise = new EventWatcher(t, frame, "load").wait_for("load"); | ||
frame.src = "about:blank"; | ||
document.body.append(frame); | ||
await loadPromise; | ||
frame.contentDocument.write("<script>" + CREATE_CREDENTIALS + "<\/script>"); | ||
|
||
let eventWatcher = new EventWatcher(t, window, "message"); | ||
const { data } = await eventWatcher.wait_for("message"); | ||
assert_equals(data, "OK"); | ||
}, "navigator.credentials.create({publicKey}) in about:blank embedded in a secure context should succeed."); | ||
}, { | ||
protocol: "ctap2_1", | ||
hasUserVerification: true, | ||
isUserVerified: true, | ||
}); | ||
|
||
</script> |