diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/media/webrtc/tests/mochitests/test_peerConnection_audioSynchronizationSourcesUnidirectional.html | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_peerConnection_audioSynchronizationSourcesUnidirectional.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_peerConnection_audioSynchronizationSourcesUnidirectional.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_audioSynchronizationSourcesUnidirectional.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_audioSynchronizationSourcesUnidirectional.html new file mode 100644 index 0000000000..6d66614e91 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_audioSynchronizationSourcesUnidirectional.html @@ -0,0 +1,54 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> +</head> +<body> +<pre id="test"> +<script type="application/javascript"> + createHTML({ + bug: "1439001", + title: "Test audio unidirectional getSynchronizationSources" + }); + + var waitForSyncSources = async (test) => { + let receiver = test.pcRemote.getReceivers()[0]; + ok(receiver, "Remote has a receiver"); + // Wait for remote sync source + while (!receiver.getSynchronizationSources().length) { + await wait(250); + } + is(receiver.getSynchronizationSources().length, 1, + "Remote receiver has a synchronization source"); + // Make sure local has no sync source + is(test.pcLocal.getReceivers()[0].getSynchronizationSources().length, 0, + "Local receiver has no synchronization source"); + }; + /* + * Test to make sure that in unidirectional calls, the receiving end has + * synchronization sources with audio levels, and the sending end has none. + */ + var testGetSynchronizationSourcesUnidirectional = async (test) => { + await waitForSyncSources(test); + let receiver = test.pcRemote.getReceivers()[0]; + let syncSources = receiver.getSynchronizationSources(); + ok(syncSources.length, + "Receiver has Synchronization sources " + JSON.stringify(syncSources)); + is(syncSources.length, 1, "Receiver has only a single sync source"); + let syncSource = syncSources[0]; + ok(syncSource.audioLevel !== undefined, "SynchronizationSource has audioLevel"); + }; + + var test; + runNetworkTest(function(options) { + test = new PeerConnectionTest(options); + test.chain.insertAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW", + [testGetSynchronizationSourcesUnidirectional]); + test.setMediaConstraints([{audio: true}], []); + test.pcLocal.audioElementsOnly = true; + return test.run(); + }); +</script> +</pre> +</body> +</html> |