summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_getUserMedia_peerIdentity.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_getUserMedia_peerIdentity.html')
-rw-r--r--dom/media/webrtc/tests/mochitests/test_getUserMedia_peerIdentity.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_getUserMedia_peerIdentity.html b/dom/media/webrtc/tests/mochitests/test_getUserMedia_peerIdentity.html
new file mode 100644
index 0000000000..c4dfb9acb8
--- /dev/null
+++ b/dom/media/webrtc/tests/mochitests/test_getUserMedia_peerIdentity.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="application/javascript" src="mediaStreamPlayback.js"></script>
+ <script type="application/javascript" src="blacksilence.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+createHTML({
+ title: "Test getUserMedia peerIdentity Constraint",
+ bug: "942367"
+});
+async function theTest() {
+ async function testPeerIdentityConstraint(withConstraint) {
+ const config = { audio: true, video: true };
+ if (withConstraint) {
+ config.peerIdentity = 'user@example.com';
+ }
+ info('getting media with constraints: ' + JSON.stringify(config));
+ const stream = await getUserMedia(config);
+ for (const track of stream.getTracks()) {
+ const recorder = new MediaRecorder(new MediaStream([track]));
+ try {
+ recorder.start();
+ ok(!withConstraint,
+ `gUM ${track.kind} track without peerIdentity must not throw`);
+ recorder.stop();
+ } catch(e) {
+ ok(withConstraint,
+ `gUM ${track.kind} track with peerIdentity must throw`);
+ }
+ }
+ await Promise.all([
+ audioIsSilence(withConstraint, stream),
+ videoIsBlack(withConstraint, stream),
+ ]);
+ stream.getTracks().forEach(t => t.stop());
+ };
+
+ // both without and with the constraint
+ await testPeerIdentityConstraint(false);
+ await testPeerIdentityConstraint(true);
+}
+
+runTest(theTest);
+
+</script>
+</pre>
+</body>
+</html>