blob: 356ffa1df68babc117c67b17c44cfea2d6e4a5e7 [file] [edit]
<!-- webkit-test-runner [ SiteIsolationEnabled=true ] -->
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="/media-resources/utilities.js"></script>
</head>
<body>
<script>
description("Under site isolation, two pages in different processes each activate their own audio session; one page being active must not deny the other activation.");
jsTestIsAsync = true;
let context;
onload = async () => {
if (!window.internals) {
testFailed("This test requires the Internals API");
finishJSTest();
return;
}
try {
context = await startNearSilentAudioContext();
await waitForAudioSessionActiveState(true);
testPassed("the audio session is active in this page");
} catch (e) {
testFailed(e.message);
finishJSTest();
return;
}
window.addEventListener("message", (event) => {
messageType = event.data.type;
openedPageAudioSessionActive = event.data.active;
shouldBeEqualToString("messageType", "audioSessionActive");
shouldBeTrue("openedPageAudioSessionActive");
openedWindow.close();
finishJSTest();
}, { once: true });
// localhost and 127.0.0.1 are different sites, so the opened page runs in a different process.
openedWindow = window.open("http://localhost:8000/site-isolation/resources/report-audio-session-active.html");
};
</script>
</body>
</html>