Prerender: Run WPT for audio with target hint
Bug: 1501674
Change-Id: I7ea703c725e3b2152a8b406695bf3cd398e4826d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5039752
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1226691}
diff --git a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/resources/audio-setSinkId.https.html b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/resources/audio-setSinkId.https.html
index f53e2f9..31df3c5c 100644
--- a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/resources/audio-setSinkId.https.html
+++ b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/resources/audio-setSinkId.https.html
@@ -7,6 +7,8 @@
<script>
const params = new URLSearchParams(location.search);
+const target_hint = params.get('target_hint');
+const rule_extras = {target_hint};
// The main test page (restriction-audio-setSinkId.https.html) loads the
// initiator page, then the initiator page will prerender itself with the
@@ -14,7 +16,7 @@
const isPrerendering = params.has('prerendering');
if (!isPrerendering) {
- loadInitiatorPage();
+ loadInitiatorPage(rule_extras);
} else {
const prerenderEventCollector = new PrerenderEventCollector();
diff --git a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html
index 136c2c1c..adb41ca7 100644
--- a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html
+++ b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html
@@ -2,6 +2,8 @@
<title>
Access to the setSinkId of the Audio API with an invalid value is deferred
</title>
+<meta name="variant" content="?target_hint=_self">
+<meta name="variant" content="?target_hint=_blank">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@@ -13,6 +15,9 @@
<script>
setup(() => assertSpeculationRulesIsSupported());
+const params = new URLSearchParams(window.location.search);
+const target_hint = params.get('target_hint');
+
promise_test(async t => {
const uid = token();
const bc = new PrerenderChannel('test-channel', uid);
@@ -26,7 +31,7 @@
});
});
- const url = `resources/audio-setSinkId.https.html?sinkId=invalid&uid=${uid}`;
+ const url = `resources/audio-setSinkId.https.html?sinkId=invalid&uid=${uid}&target_hint=${target_hint}`;
window.open(url, '_blank', 'noopener');
const result = await gotMessage;
diff --git a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html
index ba5c0e8..ec486f8 100644
--- a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html
+++ b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html
@@ -1,5 +1,7 @@
<!DOCTYPE html>
<title>Access to the setSinkId of the Audio API is deferred</title>
+<meta name="variant" content="?target_hint=_self">
+<meta name="variant" content="?target_hint=_blank">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@@ -11,6 +13,9 @@
<script>
setup(() => assertSpeculationRulesIsSupported());
+const params = new URLSearchParams(window.location.search);
+const target_hint = params.get('target_hint');
+
promise_test(async t => {
const uid = token();
const bc = new PrerenderChannel('test-channel', uid);
@@ -24,7 +29,7 @@
});
});
- const url = `resources/audio-setSinkId.https.html?sinkId=default&uid=${uid}`;
+ const url = `resources/audio-setSinkId.https.html?sinkId=default&uid=${uid}&target_hint=${target_hint}`;
window.open(url, '_blank', 'noopener');
const result = await gotMessage;