Skip to content

Commit 7733057

Browse files
uysaleremoz-wptsync-bot
authored andcommitted
Bug 1504132 [wpt PR 13855] - Move getDisplayMedia to MediaDevices, a=testonly
Automatic update from web-platform-testsMove getDisplayMedia to MediaDevices Following w3c/mediacapture-screen-share#86 Bug: 326740 Change-Id: Ifb65a33a7f998563640d9f508d26d91ecb16c32f -- wpt-commits: 032cd9cc630759609a901e37e158575fd265d353 wpt-pr: 13855
1 parent a2a2127 commit 7733057

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

testing/web-platform/tests/screen-capture/getdisplaymedia.https.html

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
'use strict';
88

99
promise_test(async t => {
10-
assert_idl_attribute(navigator, 'getDisplayMedia');
11-
const stream = await navigator.getDisplayMedia({video: true});
10+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
11+
const stream = await navigator.mediaDevices.getDisplayMedia({video: true});
1212
const [track] = stream.getTracks();
1313
t.add_cleanup(() => track.stop());
1414
assert_equals(stream.getTracks().length, 1);
@@ -22,8 +22,8 @@
2222
// Note that this results in some non-intuitive cases returning a video track,
2323
// i.e. {video: false}.
2424
promise_test(async t => {
25-
assert_idl_attribute(navigator, 'getDisplayMedia');
26-
const stream = await navigator.getDisplayMedia();
25+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
26+
const stream = await navigator.mediaDevices.getDisplayMedia();
2727
const [track] = stream.getTracks();
2828
t.add_cleanup(() => track.stop());
2929
assert_equals(stream.getTracks().length, 1);
@@ -32,8 +32,8 @@
3232
}, 'getDisplayMedia() with no constraints');
3333

3434
promise_test(async t => {
35-
assert_idl_attribute(navigator, 'getDisplayMedia');
36-
const stream = await navigator.getDisplayMedia({video: false});
35+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
36+
const stream = await navigator.mediaDevices.getDisplayMedia({video: false});
3737
const [track] = stream.getTracks();
3838
t.add_cleanup(() => track.stop());
3939
assert_equals(stream.getTracks().length, 1);
@@ -42,8 +42,8 @@
4242
}, 'getDisplayMedia() with video false');
4343

4444
promise_test(async t => {
45-
assert_idl_attribute(navigator, 'getDisplayMedia');
46-
const stream = await navigator.getDisplayMedia({audio: false});
45+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
46+
const stream = await navigator.mediaDevices.getDisplayMedia({audio: false});
4747
const [track] = stream.getTracks();
4848
t.add_cleanup(() => track.stop());
4949
assert_equals(stream.getTracks().length, 1);
@@ -52,8 +52,8 @@
5252
}, 'getDisplayMedia() with audio false');
5353

5454
promise_test(async t => {
55-
assert_idl_attribute(navigator, 'getDisplayMedia');
56-
const stream = await navigator.getDisplayMedia({audio: true});
55+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
56+
const stream = await navigator.mediaDevices.getDisplayMedia({audio: true});
5757
const [track] = stream.getTracks();
5858
t.add_cleanup(() => track.stop());
5959
assert_equals(stream.getTracks().length, 1);
@@ -62,10 +62,10 @@
6262
}, 'getDisplayMedia() with audio true');
6363

6464
promise_test(async t => {
65-
assert_idl_attribute(navigator, 'getDisplayMedia');
65+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
6666
try {
67-
const stream =
68-
await navigator.getDisplayMedia({video: {advanced: [{zoom: 1}]}});
67+
const stream = await navigator.mediaDevices.getDisplayMedia(
68+
{video: {advanced: [{zoom: 1}]}});
6969
} catch (err) {
7070
assert_equals(err.name, 'TypeError');
7171
return;
@@ -74,10 +74,10 @@
7474
}, 'getDisplayMedia() with advanced constraint');
7575

7676
promise_test(async t => {
77-
assert_idl_attribute(navigator, 'getDisplayMedia');
77+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
7878
try {
79-
const stream =
80-
await navigator.getDisplayMedia({video: {width: {min: 360}}});
79+
const stream = await navigator.mediaDevices.getDisplayMedia(
80+
{video: {width: {min: 360}}});
8181
} catch (err) {
8282
assert_equals(err.name, 'TypeError');
8383
return;
@@ -86,10 +86,10 @@
8686
}, 'getDisplayMedia() with min constraint');
8787

8888
promise_test(async t => {
89-
assert_idl_attribute(navigator, 'getDisplayMedia');
89+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
9090
try {
91-
const stream =
92-
await navigator.getDisplayMedia({video: {width: {exact: 360}}});
91+
const stream = await navigator.mediaDevices.getDisplayMedia(
92+
{video: {width: {exact: 360}}});
9393
} catch (err) {
9494
assert_equals(err.name, 'TypeError');
9595
return;
@@ -98,10 +98,10 @@
9898
}, 'getDisplayMedia() with exact constraint');
9999

100100
promise_test(async t => {
101-
assert_idl_attribute(navigator, 'getDisplayMedia');
101+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
102102
const maxWidth = 360;
103-
const stream =
104-
await navigator.getDisplayMedia({video: {width: {max: maxWidth}}});
103+
const stream = await navigator.mediaDevices.getDisplayMedia(
104+
{video: {width: {max: maxWidth}}});
105105
const [track] = stream.getTracks();
106106
t.add_cleanup(() => track.stop());
107107
assert_equals(stream.getVideoTracks().length, 1);
@@ -111,10 +111,10 @@
111111
}, 'getDisplayMedia() with max constraint');
112112

113113
promise_test(async t => {
114-
assert_idl_attribute(navigator, 'getDisplayMedia');
114+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
115115
const maxWidth = 360;
116116
const maxFrameRate = 4;
117-
const stream = await navigator.getDisplayMedia(
117+
const stream = await navigator.mediaDevices.getDisplayMedia(
118118
{video: {width: {max: maxWidth}, frameRate: {max: maxFrameRate}}});
119119
const [track] = stream.getTracks();
120120
t.add_cleanup(() => track.stop());
@@ -126,9 +126,10 @@
126126
}, 'getDisplayMedia() with constraints applied');
127127

128128
promise_test(async t => {
129-
assert_idl_attribute(navigator, 'getDisplayMedia');
129+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
130130
try {
131-
const stream = await navigator.getDisplayMedia({video: {width: {max: 0}}});
131+
const stream = await navigator.mediaDevices.getDisplayMedia(
132+
{video: {width: {max: 0}}});
132133
} catch (err) {
133134
assert_equals(err.name, 'OverconstrainedError');
134135
return;
@@ -138,8 +139,8 @@
138139

139140
// Content shell picks a fake desktop device by default.
140141
promise_test(async t => {
141-
assert_idl_attribute(navigator, 'getDisplayMedia');
142-
const stream = await navigator.getDisplayMedia({video: true});
142+
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
143+
const stream = await navigator.mediaDevices.getDisplayMedia({video: true});
143144
const [track] = stream.getTracks();
144145
t.add_cleanup(() => track.stop());
145146
assert_equals(stream.getVideoTracks().length, 1);

testing/web-platform/tests/screen-capture/idlharness.window.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
idl_test(
99
['screen-capture'],
10-
['mediacapture-streams', 'html'],
10+
['mediacapture-streams', 'html', 'dom'],
1111
idl_array => {
1212
idl_array.add_objects({
13-
Navigator: ['navigator'],
13+
MediaDevices: ['navigator.mediaDevices'],
1414
});
1515
}
1616
);

0 commit comments

Comments
 (0)