gecko-dev/testing/web-platform/tests/media-source/mediasource-sourcebuffer-mode.html
James Graham cf6ec8d839 Bug 1309931 - Update web-platform-tests to revision 1d8e28e2c762b51c06670a373b23af6bd7a8aed7, a=testonly
MozReview-Commit-ID: 17dwWFxkprQ


--HG--
rename : testing/web-platform/tests/conformance-checkers/html-svg/animate-dom-01-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/animate-dom-01-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/animate-dom-02-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/animate-dom-02-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/animate-elem-40-t-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/animate-elem-40-t-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/animate-script-elem-01-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/animate-script-elem-01-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/animate-struct-dom-01-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/animate-struct-dom-01-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/conform-viewers-02-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/conform-viewers-02-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/coords-dom-03-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/coords-dom-03-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-events-02-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-events-02-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-01-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-01-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-03-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-03-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-05-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-05-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-07-t-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-07-t-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-08-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-08-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-09-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pevents-09-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pointer-01-t-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pointer-01-t-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/interact-pointer-03-t-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/interact-pointer-03-t-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/masking-path-09-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/masking-path-09-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/paths-dom-01-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/paths-dom-01-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/paths-dom-02-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/paths-dom-02-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-cond-02-t-isvalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-cond-02-t-haswarn.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-07-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-07-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-08-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-08-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-11-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-11-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-13-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-13-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-14-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-14-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-15-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-15-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-20-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-dom-20-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/struct-use-13-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/struct-use-13-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/text-dom-02-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/text-dom-02-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/text-dom-05-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/text-dom-05-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/text-tselect-02-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/text-tselect-02-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/text-tselect-03-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/text-tselect-03-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/types-dom-02-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/types-dom-02-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/types-dom-03-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/types-dom-03-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/types-dom-05-b-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/types-dom-05-b-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/types-dom-07-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/types-dom-07-f-isvalid.html
rename : testing/web-platform/tests/conformance-checkers/html-svg/types-dom-08-f-novalid.html => testing/web-platform/tests/conformance-checkers/html-svg/types-dom-08-f-isvalid.html
rename : testing/web-platform/tests/encrypted-media/Google/encrypted-media-utils.js => testing/web-platform/tests/encrypted-media/Google/migrated_to_root_disabled/encrypted-media-utils.js
rename : testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1.html => testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-manual.html
rename : testing/web-platform/tests/html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-scrollamount-effect.html => testing/web-platform/tests/html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-scrollamount-effect-manual.html
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_000.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_000-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_001.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_001-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_002.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_002-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_003.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_003-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_004.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_004-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_005.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_005-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_006.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_006-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_007.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_007-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_008.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_008-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_009.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_009-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_010.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_010-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_011.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_011-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_012.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_012-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_013.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_013-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_014.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_014-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_015.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_015-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_016.htm => testing/web-platform/tests/old-tests/submission/Microsoft/dragdrop/dragdrop_016-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_003.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_003-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_004.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_004-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_006.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_006-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_007.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_007-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_008.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_008-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_009.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_009-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_010.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_010-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_020.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_020-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_021.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_021-manual.htm
rename : testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_022.htm => testing/web-platform/tests/old-tests/submission/Microsoft/sandbox/sandbox_022-manual.htm
rename : testing/web-platform/tests/pointerevents/pointerevent_pointermove-on-chorded-mouse-button.html => testing/web-platform/tests/pointerevents/pointerevent_pointermove_on_chorded_mouse_button-manual.html
rename : testing/web-platform/tests/pointerevents/pointerevent_suppress_compat_events_on_click.html => testing/web-platform/tests/pointerevents/pointerevent_suppress_compat_events_on_click-manual.html
rename : testing/web-platform/tests/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse.html => testing/web-platform/tests/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse-manual.html
2016-10-25 18:10:30 +01:00

142 lines
7.4 KiB
HTML

<!DOCTYPE html>
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
<html>
<head>
<meta charset="utf-8">
<title>SourceBuffer.mode 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>
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
assert_equals(sourceBuffer.mode, 'segments', 'default append mode should be \'segments\'');
test.done();
}, 'Test initial value of SourceBuffer.mode is "segments"');
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
sourceBuffer.mode = 'sequence';
assert_equals(sourceBuffer.mode, 'sequence', 'mode after setting it to \'sequence\'');
// Setting a mode that is not in AppendMode IDL enum should be ignored and not cause exception.
sourceBuffer.mode = 'invalidmode';
sourceBuffer.mode = null;
sourceBuffer.mode = '';
sourceBuffer.mode = 'Segments';
assert_equals(sourceBuffer.mode, 'sequence', 'mode unchanged by attempts to set invalid modes');
sourceBuffer.mode = 'segments';
assert_equals(sourceBuffer.mode, 'segments', 'mode after setting it to \'segments\'');
test.done();
}, 'Test setting SourceBuffer.mode');
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
mediaSource.removeSourceBuffer(sourceBuffer);
assert_throws('InvalidStateError',
function() { sourceBuffer.mode = 'segments'; },
'Setting valid sourceBuffer.mode on removed SourceBuffer should throw InvalidStateError.');
test.done();
}, 'Test setting a removed SourceBuffer\'s mode');
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
sourceBuffer.appendBuffer(mediaData);
assert_true(sourceBuffer.updating, 'updating attribute is true');
assert_throws('InvalidStateError',
function() { sourceBuffer.mode = 'segments'; },
'Setting valid sourceBuffer.mode on updating SourceBuffer threw InvalidStateError.');
test.done();
}, 'Test setting SourceBuffer.mode while still updating');
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
sourceBuffer.appendBuffer(mediaData);
test.waitForExpectedEvents(function()
{
assert_false(sourceBuffer.updating, 'updating attribute is false');
test.expectEvent(mediaSource, 'sourceended', 'MediaSource sourceended event');
mediaSource.endOfStream();
assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is \'ended\'');
});
test.waitForExpectedEvents(function()
{
assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is \'ended\'');
test.expectEvent(mediaSource, 'sourceopen', 'MediaSource sourceopen event');
sourceBuffer.mode = 'segments';
assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is \'open\'');
});
test.waitForExpectedEvents(function()
{
assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is \'open\'');
test.done();
});
}, 'Test setting SourceBuffer.mode triggers parent MediaSource \'ended\' to \'open\' transition.');
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
var fullMediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
var truncateAt = Math.floor(segmentInfo.media[0].size * 0.5); // Pick first 50% of segment bytes.
var partialMediaSegment = fullMediaSegment.subarray(0, truncateAt);
var mediaSegmentRemainder = fullMediaSegment.subarray(truncateAt);
// Append init segment.
test.expectEvent(sourceBuffer, 'updateend', 'Init segment append ended.');
sourceBuffer.appendBuffer(initSegment);
test.waitForExpectedEvents(function()
{
assert_false(sourceBuffer.updating, 'updating attribute is false');
assert_equals(sourceBuffer.mode, 'segments');
sourceBuffer.mode = 'segments'; // No exception should occur.
assert_equals(sourceBuffer.timestampOffset, 0.0);
sourceBuffer.timestampOffset = 10.123456789; // No exception should occur.
assert_equals(sourceBuffer.timestampOffset, 10.123456789); // Super-precise offsets should round-trip.
// Append first part of media segment.
test.expectEvent(sourceBuffer, 'updateend', 'Partial media segment append ended.');
sourceBuffer.appendBuffer(partialMediaSegment);
});
test.waitForExpectedEvents(function()
{
assert_false(sourceBuffer.updating, 'updating attribute is false');
assert_equals(sourceBuffer.mode, 'segments');
assert_throws('InvalidStateError',
function() { sourceBuffer.mode = 'segments'; },
'Setting valid sourceBuffer.mode while still parsing media segment threw InvalidStateError.');
assert_equals(sourceBuffer.timestampOffset, 10.123456789);
assert_throws('InvalidStateError',
function() { sourceBuffer.timestampOffset = 20.0; },
'Setting valid sourceBuffer.timestampOffset while still parsing media segment threw InvalidStateError.');
// Append remainder of media segment.
test.expectEvent(sourceBuffer, 'updateend', 'Append ended of remainder of media segment.');
sourceBuffer.appendBuffer(mediaSegmentRemainder);
});
test.waitForExpectedEvents(function()
{
assert_false(sourceBuffer.updating, 'updating attribute is false');
assert_equals(sourceBuffer.mode, 'segments');
sourceBuffer.mode = 'segments'; // No exception should occur.
assert_equals(sourceBuffer.timestampOffset, 10.123456789);
sourceBuffer.timestampOffset = 20.0; // No exception should occur.
test.done();
});
}, 'Test setting SourceBuffer.mode and SourceBuffer.timestampOffset while parsing media segment.');
</script>
</body>
</html>