summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_getUserMedia_basicTabshare.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_getUserMedia_basicTabshare.html')
-rw-r--r--dom/media/webrtc/tests/mochitests/test_getUserMedia_basicTabshare.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_getUserMedia_basicTabshare.html b/dom/media/webrtc/tests/mochitests/test_getUserMedia_basicTabshare.html
new file mode 100644
index 0000000000..635cf387d4
--- /dev/null
+++ b/dom/media/webrtc/tests/mochitests/test_getUserMedia_basicTabshare.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="application/javascript" src="mediaStreamPlayback.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+ createHTML({
+ title: "getUserMedia Basic Tabshare Test",
+ bug: "1193075"
+ });
+ /**
+ * Run a test to verify that we can complete a start and stop media playback
+ * cycle for a tabshare MediaStream on a video HTMLMediaElement.
+ *
+ * Additionally, exercise applyConstraints code for tabshare viewport offset.
+ */
+ runTest(function () {
+ var testVideo = createMediaElement('video', 'testVideo');
+
+ return Promise.resolve()
+ .then(() => pushPrefs(["media.getusermedia.browser.enabled", true]))
+ .then(() => {
+ SpecialPowers.wrap(document).notifyUserGestureActivation();
+ return getUserMedia({
+ video: { mediaSource: "browser",
+ scrollWithPage: true },
+ });
+ })
+ .then(stream => {
+ var playback = new MediaStreamPlayback(testVideo, stream);
+ return playback.playMedia(false);
+ })
+ .then(() => getUserMedia({
+ video: {
+ mediaSource: "browser",
+ viewportOffsetX: 0,
+ viewportOffsetY: 0,
+ viewportWidth: 100,
+ viewportHeight: 100
+ },
+ }))
+ .then(stream => {
+ var playback = new MediaStreamPlayback(testVideo, stream);
+ playback.startMedia(false);
+ return playback.verifyPlaying()
+ .then(() => Promise.all([
+ () => testVideo.srcObject.getVideoTracks()[0].applyConstraints({
+ mediaSource: "browser",
+ viewportOffsetX: 10,
+ viewportOffsetY: 50,
+ viewportWidth: 90,
+ viewportHeight: 50
+ }),
+ () => listenUntil(testVideo, "resize", () => true)
+ ]))
+ .then(() => playback.verifyPlaying()) // still playing
+ .then(() => playback.stopTracksForStreamInMediaPlayback())
+ .then(() => playback.detachFromMediaElement());
+ });
+ });
+
+</script>
+</pre>
+</body>
+</html>