Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move getDisplayMedia to MediaDevices #13784

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 4 additions & 13 deletions screen-capture/getdisplaymedia.https.html
@@ -1,13 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<title>RTCDTMFSender.prototype.insertDTMF</title>
<title>getDisplayMedia</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
test(() => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
}, "getDisplayMedia in navigator.mediaDevices");

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({video: true});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
Expand All @@ -22,7 +24,6 @@
// Note that this results in some non-intuitive cases returning a video track,
// i.e. {video: false}.
promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia();
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
Expand All @@ -32,7 +33,6 @@
}, 'getDisplayMedia() with no constraints');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({video: false});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
Expand All @@ -42,7 +42,6 @@
}, 'getDisplayMedia() with video false');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({audio: false});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
Expand All @@ -52,7 +51,6 @@
}, 'getDisplayMedia() with audio false');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({audio: true});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
Expand All @@ -62,7 +60,6 @@
}, 'getDisplayMedia() with audio true');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {advanced: [{zoom: 1}]}});
Expand All @@ -74,7 +71,6 @@
}, 'getDisplayMedia() with advanced constraint');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {min: 360}}});
Expand All @@ -86,7 +82,6 @@
}, 'getDisplayMedia() with min constraint');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {exact: 360}}});
Expand All @@ -98,7 +93,6 @@
}, 'getDisplayMedia() with exact constraint');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const maxWidth = 360;
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {max: maxWidth}}});
Expand All @@ -111,7 +105,6 @@
}, 'getDisplayMedia() with max constraint');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const maxWidth = 360;
const maxFrameRate = 4;
const stream = await navigator.mediaDevices.getDisplayMedia(
Expand All @@ -126,7 +119,6 @@
}, 'getDisplayMedia() with constraints applied');

promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {max: 0}}});
Expand All @@ -139,7 +131,6 @@

// Content shell picks a fake desktop device by default.
promise_test(async t => {
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({video: true});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
Expand Down
10 changes: 10 additions & 0 deletions screen-capture/historical.https.html
@@ -0,0 +1,10 @@
<!doctype html>
<meta charset=utf-8>
<title>getDisplayMedia historical tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_false('getDisplayMedia' in navigator);
}, 'navigator.getDisplayMedia should not exist');
</script>