Commit 1332e25f authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Remove promise_rejects in media/

Replaced with promise_rejects_js and promise_rejects_dom.

Bug: 1051932
Change-Id: I5452a5237b476255a8f24e7b9ccddd41f5b30798
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2116562Reviewed-by: default avatarLuke Z <lpz@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752793}
parent ff78c470
......@@ -50,13 +50,13 @@
// Note: 'unauthorized' is the name of an unauthorized device in the test runner.
promise_test(function() {
var audio = document.createElement('audio');
return promise_rejects(this, 'SecurityError', audio.setSinkId('unauthorized'));
return promise_rejects_dom(this, 'SecurityError', audio.setSinkId('unauthorized'));
}, 'setSinkId("unauthorized")' );
// Test that setting the sink to a nonexistent device fails
promise_test(function() {
var audio = document.createElement('audio');
return promise_rejects(this, 'NotFoundError', audio.setSinkId('nonexistent'));
return promise_rejects_dom(this, 'NotFoundError', audio.setSinkId('nonexistent'));
}, 'setSinkId("nonexistent")');
// Tests that changing the sink twice succeeds
......
......@@ -49,11 +49,9 @@
}, "Test that play() on a muted video succeeds without gesture.");
promise_test(function (t) {
return promise_rejects(
return promise_rejects_dom(
t,
new DOMException(
'play() can only be initiated by a user gesture.',
'NotAllowedError'),
'NotAllowedError',
createMutedAudioElement().play());
}, "Test that play() on a muted audio without gesture will reject.");
......
......@@ -44,11 +44,9 @@ async_test(function(t) {
}, "Test that a video with an autoplay attribute doesn't autoplay when not whitelisted.");
promise_test(function(t) {
return promise_rejects(
return promise_rejects_dom(
t,
new DOMException(
'play() can only be initiated by a user gesture.',
'NotAllowedError'),
'NotAllowedError',
createVideoElement().play());
}, "Test that play() on a video fails without gesture when not whitelisted.");
......@@ -66,11 +64,9 @@ async_test(function(t) {
}, "Test that an audio with an autoplay attribute doesn't autoplay when not whitelisted.");
promise_test(function(t) {
return promise_rejects(
return promise_rejects_dom(
t,
new DOMException(
'play() can only be initiated by a user gesture.',
'NotAllowedError'),
'NotAllowedError',
createAudioElement().play());
}, "Test that play() on an audio fails without gesture when not whitelisted.");
......
......@@ -15,7 +15,7 @@ promise_test(t => {
var video = document.createElement('video');
video.src = '../content/test.ogv';
return promise_rejects(t, 'NotAllowedError', video.play());
return promise_rejects_dom(t, 'NotAllowedError', video.play());
}, 'Not allowed to autoplay without some sort of user gesture');
promise_test(t => {
......
......@@ -61,6 +61,6 @@ promise_test(t => {
video.src = '../content/test.ogv';
document.querySelector('div').appendChild(video);
return promise_rejects(t, "NotAllowedError", video.play());
return promise_rejects_dom(t, "NotAllowedError", video.play());
}, "'autoplay muted'.play() doesn't work with video auto-fullscreen");
</script>
......@@ -17,7 +17,7 @@ promise_test(async t => {
const video = await loadVideo(frame.contentDocument, '../content/test.ogv');
document.body.removeChild(frame);
return promise_rejects(t, 'InvalidStateError',
return promise_rejects_dom(t, 'InvalidStateError',
requestPictureInPictureWithTrustedClick(video));
}, 'request Picture-in-Picture rejects when frame is detached');
</script>
......@@ -14,7 +14,7 @@ promise_test(async t => {
assert_false(document.pictureInPictureEnabled);
const video = await loadVideo(document, '../content/test.ogv');
return promise_rejects(t, 'NotSupportedError',
return promise_rejects_dom(t, 'NotSupportedError',
requestPictureInPictureWithTrustedClick(video));
});
</script>
......@@ -31,7 +31,7 @@ promise_test(async t => {
new PictureInPictureServiceMock();
const video = await loadVideo(document, '../content/test.ogv');
return promise_rejects(t, 'NotSupportedError',
return promise_rejects_dom(t, 'NotSupportedError',
requestPictureInPictureWithTrustedClick(video));
});
</script>
......@@ -19,7 +19,7 @@ promise_test(async t => {
const element = frame.contentDocument.createElement('div');
document.body.removeChild(frame);
return promise_rejects(t, 'InvalidStateError',
return promise_rejects_dom(t, 'InvalidStateError',
requestPictureInPictureWithTrustedClick(element, { height: 1, width: 1 }));
}, 'request Picture-in-Picture rejects when frame is detached');
</script>
......@@ -17,7 +17,7 @@ promise_test(async t => {
const element2 = document.createElement('div');
await test_driver.bless('request Picture-in-Picture');
const promise = element1.requestPictureInPicture(options);
await promise_rejects(t, 'NotAllowedError', element2.requestPictureInPicture(options));
await promise_rejects_dom(t, 'NotAllowedError', element2.requestPictureInPicture(options));
return promise;
}, 'request Picture-in-Picture consumes user gesture');
......
......@@ -12,7 +12,7 @@ promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, 'NotAllowedError', element.requestPictureInPicture({ aspectRatio: 1 }));
return promise_rejects_dom(t, 'NotAllowedError', element.requestPictureInPicture({ aspectRatio: 1 }));
}, 'request Picture-in-Picture requires a user gesture');
promise_test(async t => {
......@@ -54,56 +54,56 @@ promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ height: 1 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ height: 1 }));
}, 'request Picture-in-Picture requires width option if height present');
promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ width: 1 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ width: 1 }));
}, 'request Picture-in-Picture requires height option if width present');
promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ width: -10, height: -10 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ width: -10, height: -10 }));
}, 'request Picture-in-Picture requires width/height to be positive (both negative)');
promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ width: 10, height: -10 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ width: 10, height: -10 }));
}, 'request Picture-in-Picture requires width/height to be positive (negative width)');
promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ width: -10, height: 10 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ width: -10, height: 10 }));
}, 'request Picture-in-Picture requires width/height to be positive (negative height)');
promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ width: 0, height: 0 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ width: 0, height: 0 }));
}, 'request Picture-in-Picture requires width/height to not be zero (both zero)');
promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ width: 10, height: 0 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ width: 10, height: 0 }));
}, 'request Picture-in-Picture requires width/height to not be zero (width zero)');
promise_test(async t => {
enablePictureInPictureV2ForTest(t);
const element = document.getElementById('example');
return promise_rejects(t, new TypeError(), element.requestPictureInPicture({ width: 0, height: 10 }));
return promise_rejects_js(t, TypeError, element.requestPictureInPicture({ width: 0, height: 10 }));
}, 'request Picture-in-Picture requires width/height to not be zero (height zero)');
promise_test(async t => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment