blob: ebfec5fd183e06655866b1afc5a43a56470237ca [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ CaptureAudioInGPUProcessEnabled=true CaptureVideoInGPUProcessEnabled=true MuteCameraOnMicrophoneInterruptionEnabled=true ] -->
<html>
<head>
<meta charset="utf-8">
<title>Video capture source interruption based on audio interruption</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(async (test) => {
const stream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
const track = stream.getVideoTracks()[0];
if (!window.testRunner)
return;
let promise = new Promise((resolve, reject) => { track.onmute = resolve; setTimeout(() => reject("no mute"), 5000) });
testRunner.setMockCaptureDevicesInterrupted(false, true);
await promise;
assert_true(track.muted, "track is muted");
promise = new Promise((resolve, reject) => { track.onunmute = resolve; setTimeout(() => reject("no unmute"), 5000) });
testRunner.setMockCaptureDevicesInterrupted(false, false);
await promise;
assert_false(track.muted, "track is not muted");
track.stop();
}, "Mute/unmute video track if audio gets interrupted");
</script>
</body>
</html>