mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
140
testing/web-platform/tests/media-source/mediasource-closed.html
Normal file
140
testing/web-platform/tests/media-source/mediasource-closed.html
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
|
||||
<html>
|
||||
<head>
|
||||
<title>MediaSource.readyState equals "closed" test cases.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="mediasource-util.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function ()
|
||||
{
|
||||
var mediaSource = new MediaSource();
|
||||
assert_equals(mediaSource.sourceBuffers.length, 0, "sourceBuffers is empty");
|
||||
assert_equals(mediaSource.activeSourceBuffers.length, 0, "activeSourceBuffers is empty");
|
||||
assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'");
|
||||
assert_true(isNaN(mediaSource.duration), "duration is NaN");
|
||||
}, "Test attribute values on a closed MediaSource object.");
|
||||
|
||||
test(function ()
|
||||
{
|
||||
var mediaSource = new MediaSource();
|
||||
assert_throws("InvalidStateError",
|
||||
function() { mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE); },
|
||||
"addSourceBuffer() throws an exception when closed.");
|
||||
}, "Test addSourceBuffer() while closed.");
|
||||
|
||||
mediasource_test(function(test, mediaElement, mediaSource)
|
||||
{
|
||||
var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
|
||||
|
||||
// Setup a handler to run when the MediaSource closes.
|
||||
mediaSource.addEventListener('sourceclose', test.step_func(function (event)
|
||||
{
|
||||
assert_equals(mediaSource.sourceBuffers.length, 0, "sourceBuffers is empty");
|
||||
assert_equals(mediaSource.activeSourceBuffers.length, 0, "activeSourceBuffers is empty");
|
||||
assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'");
|
||||
assert_throws("NotFoundError",
|
||||
function() { mediaSource.removeSourceBuffer(sourceBuffer); },
|
||||
"removeSourceBuffer() throws an exception when closed.");
|
||||
test.done();
|
||||
}));
|
||||
|
||||
// Trigger the MediaSource to close.
|
||||
mediaElement.src = "";
|
||||
}, "Test removeSourceBuffer() while closed.");
|
||||
|
||||
test(function ()
|
||||
{
|
||||
var mediaSource = new MediaSource();
|
||||
assert_throws("InvalidStateError",
|
||||
function() { mediaSource.endOfStream(); },
|
||||
"endOfStream() throws an exception when closed.");
|
||||
}, "Test endOfStream() while closed.");
|
||||
|
||||
test(function ()
|
||||
{
|
||||
var mediaSource = new MediaSource();
|
||||
assert_throws("InvalidStateError",
|
||||
function() { mediaSource.endOfStream("decode"); },
|
||||
"endOfStream(decode) throws an exception when closed.");
|
||||
}, "Test endOfStream(decode) while closed.");
|
||||
|
||||
test(function ()
|
||||
{
|
||||
var mediaSource = new MediaSource();
|
||||
assert_throws("InvalidStateError",
|
||||
function() { mediaSource.endOfStream("network"); },
|
||||
"endOfStream(network) throws an exception when closed.");
|
||||
}, "Test endOfStream(network) while closed.");
|
||||
|
||||
test(function ()
|
||||
{
|
||||
var mediaSource = new MediaSource();
|
||||
assert_throws("InvalidStateError",
|
||||
function() { mediaSource.duration = 10; },
|
||||
"Setting duration throws an exception when closed.");
|
||||
}, "Test setting duration while closed.");
|
||||
|
||||
mediasource_test(function(test, mediaElement, mediaSource)
|
||||
{
|
||||
var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
|
||||
|
||||
assert_equals(mediaSource.readyState, "open", "readyState is 'open'");
|
||||
// Setup a handler to run when the MediaSource closes.
|
||||
mediaSource.addEventListener("sourceclose", test.step_func(function (event)
|
||||
{
|
||||
assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'");
|
||||
assert_throws("InvalidStateError",
|
||||
function() { mediaSource.duration = 10; },
|
||||
"Setting duration when closed throws an exception");
|
||||
test.done();
|
||||
}));
|
||||
|
||||
// Trigger the MediaSource to close.
|
||||
mediaElement.src = "";
|
||||
}, "Test setting duration while open->closed.");
|
||||
|
||||
mediasource_test(function(test, mediaElement, mediaSource)
|
||||
{
|
||||
var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
|
||||
|
||||
assert_equals(mediaSource.readyState, "open", "readyState is 'open'");
|
||||
// Setup a handler to run when the MediaSource closes.
|
||||
mediaSource.addEventListener("sourceclose", test.step_func(function (event)
|
||||
{
|
||||
assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'");
|
||||
assert_true(isNaN(mediaSource.duration), "duration is NaN");
|
||||
test.done();
|
||||
}));
|
||||
|
||||
// Trigger the MediaSource to close.
|
||||
mediaElement.src = "";
|
||||
}, "Test getting duration while open->closed.");
|
||||
|
||||
mediasource_test(function(test, mediaElement, mediaSource)
|
||||
{
|
||||
var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
|
||||
|
||||
assert_equals(mediaSource.readyState, "open", "readyState is open");
|
||||
|
||||
// Setup a handler to run when the MediaSource closes.
|
||||
mediaSource.addEventListener("sourceclose", test.step_func(function (event)
|
||||
{
|
||||
assert_equals(mediaSource.readyState, "closed", "readyState is closed");
|
||||
assert_throws("InvalidStateError",
|
||||
function() { sourceBuffer.abort(); },
|
||||
"sourceBuffer.abort() throws INVALID_STATE_ERROR");
|
||||
test.done();
|
||||
}));
|
||||
|
||||
// Trigger the MediaSource to close.
|
||||
mediaElement.src = "";
|
||||
}, "Test sourcebuffer.abort when closed.");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue