Chromium Code Reviews| Index: LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html |
| diff --git a/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html b/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html |
| index 16347a57dbf6bfc4311f68b2957c956789e40531..0b2120ac0c6170fcab0f5b0415651464e5444c20 100644 |
| --- a/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html |
| +++ b/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html |
| @@ -13,342 +13,417 @@ |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test SourceBuffer.appendBuffer() event dispatching."); |
| + }, 'Test SourceBuffer.appendBuffer() event dispatching.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| - assert_throws("InvalidStateError", |
| + assert_throws('InvalidStateError', |
| function() { sourceBuffer.appendBuffer(mediaData); }, |
| - "appendBuffer() throws an exception there is a pending append."); |
| + 'appendBuffer() throws an exception there is a pending append.'); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test SourceBuffer.appendBuffer() call during a pending appendBuffer()."); |
| + }, 'Test SourceBuffer.appendBuffer() call during a pending appendBuffer().'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "abort", "Append aborted."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'abort', 'Append aborted.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| sourceBuffer.abort(); |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test SourceBuffer.abort() call during a pending appendBuffer()."); |
| + }, 'Test SourceBuffer.abort() call during a pending appendBuffer().'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| - test.expectEvent(mediaSource, "sourceended", "MediaSource sourceended event"); |
| + test.expectEvent(mediaSource, 'sourceended', 'MediaSource sourceended event'); |
| mediaSource.endOfStream(); |
| - assert_equals(mediaSource.readyState, "ended", "MediaSource readyState is 'ended'"); |
| + assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"'); |
| }); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_equals(mediaSource.readyState, "ended", "MediaSource readyState is 'ended'"); |
| + assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"'); |
| - test.expectEvent(mediaSource, "sourceopen", "MediaSource sourceopen event"); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(mediaSource, 'sourceopen', 'MediaSource sourceopen event'); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_equals(mediaSource.readyState, "open", "MediaSource readyState is 'open'"); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"'); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| }); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_equals(mediaSource.readyState, "open", "MediaSource readyState is 'open'"); |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"'); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test SourceBuffer.appendBuffer() triggering an 'ended' to 'open' transition."); |
| + }, 'Test SourceBuffer.appendBuffer() triggering an "ended" to "open" transition.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| - test.expectEvent(mediaSource, "sourceended", "MediaSource sourceended event"); |
| + test.expectEvent(mediaSource, 'sourceended', 'MediaSource sourceended event'); |
| mediaSource.endOfStream(); |
| - assert_equals(mediaSource.readyState, "ended", "MediaSource readyState is 'ended'"); |
| + assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"'); |
| }); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_equals(mediaSource.readyState, "ended", "MediaSource readyState is 'ended'"); |
| + assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"'); |
| - test.expectEvent(mediaSource, "sourceopen", "MediaSource sourceopen event"); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(mediaSource, 'sourceopen', 'MediaSource sourceopen event'); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(new Uint8Array(0)); |
| - assert_equals(mediaSource.readyState, "open", "MediaSource readyState is 'open'"); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"'); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| }); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_equals(mediaSource.readyState, "open", "MediaSource readyState is 'open'"); |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"'); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test zero byte SourceBuffer.appendBuffer() call triggering an 'ended' to 'open' transition."); |
| + }, 'Test zero byte SourceBuffer.appendBuffer() call triggering an "ended" to "open" transition.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "abort", "Append aborted."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'abort', 'Append aborted.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| - test.expectEvent(mediaSource.activeSourceBuffers, "removesourcebuffer", "activeSourceBuffers"); |
| - test.expectEvent(mediaSource.sourceBuffers, "removesourcebuffer", "sourceBuffers"); |
| + test.expectEvent(mediaSource.activeSourceBuffers, 'removesourcebuffer', 'activeSourceBuffers'); |
| + test.expectEvent(mediaSource.sourceBuffers, 'removesourcebuffer', 'sourceBuffers'); |
| mediaSource.removeSourceBuffer(sourceBuffer); |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| - assert_throws("InvalidStateError", |
| + assert_throws('InvalidStateError', |
| function() { sourceBuffer.appendBuffer(mediaData); }, |
| - "appendBuffer() throws an exception because it isn't attached to the mediaSource anymore."); |
| + 'appendBuffer() throws an exception because it isn\'t attached to the mediaSource anymore.'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test MediaSource.removeSourceBuffer() call during a pending appendBuffer()."); |
| + }, 'Test MediaSource.removeSourceBuffer() call during a pending appendBuffer().'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| - assert_throws("InvalidStateError", |
| + assert_throws('InvalidStateError', |
| function() { mediaSource.duration = 1.0; }, |
| - "set duration throws an exception when updating attribute is true."); |
| + 'set duration throws an exception when updating attribute is true.'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test set MediaSource.duration during a pending appendBuffer() for one of its SourceBuffers."); |
| + }, 'Test set MediaSource.duration during a pending appendBuffer() for one of its SourceBuffers.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| - test.failOnEvent(mediaElement, "error"); |
| - test.failOnEvent(mediaSource, "sourceended"); |
| + test.failOnEvent(mediaElement, 'error'); |
| + test.failOnEvent(mediaSource, 'sourceended'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| - assert_throws("InvalidStateError", |
| + assert_throws('InvalidStateError', |
| function() { mediaSource.endOfStream(); }, |
| - "endOfStream() throws an exception when updating attribute is true."); |
| + 'endOfStream() throws an exception when updating attribute is true.'); |
| - assert_equals(mediaSource.readyState, "open"); |
| + assert_equals(mediaSource.readyState, 'open'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| - assert_equals(mediaSource.readyState, "open"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| + assert_equals(mediaSource.readyState, 'open'); |
| test.done(); |
| }); |
| - }, "Test MediaSource.endOfStream() during a pending appendBuffer() for one of its SourceBuffers."); |
| + }, 'Test MediaSource.endOfStream() during a pending appendBuffer() for one of its SourceBuffers.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(mediaData); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| - assert_throws("InvalidStateError", |
| + assert_throws('InvalidStateError', |
| function() { sourceBuffer.timestampOffset = 10.0; }, |
| - "set timestampOffset throws an exception when updating attribute is true."); |
| + 'set timestampOffset throws an exception when updating attribute is true.'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test set SourceBuffer.timestampOffset during a pending appendBuffer()."); |
| + }, 'Test set SourceBuffer.timestampOffset during a pending appendBuffer().'); |
| mediasource_test(function(test, mediaElement, mediaSource) |
| { |
| var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(new Uint8Array(0)); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test appending an empty ArrayBufferView."); |
| + }, 'Test appending an empty ArrayBufferView.'); |
| + |
|
wolenetz
2014/07/29 22:33:21
nit: remove extra line
prabhur1
2014/07/30 19:56:22
Done.
prabhur1
2014/07/30 19:56:22
ah...I need to get better are spotting those extra
wolenetz
2014/07/30 22:34:02
I can share off-CR some tips for horizontal traili
|
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| var arrayBufferView = new Uint8Array(mediaData); |
| - assert_equals(arrayBufferView.length, mediaData.length, "arrayBufferView.length before transfer."); |
| + assert_equals(arrayBufferView.length, mediaData.length, 'arrayBufferView.length before transfer.'); |
| // Send the buffer as in a message so it gets neutered. |
| - window.postMessage( "test", "*", [arrayBufferView.buffer]); |
| + window.postMessage( 'test', '*', [arrayBufferView.buffer]); |
| - assert_equals(arrayBufferView.length, 0, "arrayBufferView.length after transfer."); |
| + assert_equals(arrayBufferView.length, 0, 'arrayBufferView.length after transfer.'); |
| sourceBuffer.appendBuffer(arrayBufferView); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test appending a neutered ArrayBufferView."); |
| + }, 'Test appending a neutered ArrayBufferView.'); |
| mediasource_test(function(test, mediaElement, mediaSource) |
| { |
| var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| sourceBuffer.appendBuffer(new ArrayBuffer(0)); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test appending an empty ArrayBuffer."); |
| + }, 'Test appending an empty ArrayBuffer.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| test.failOnEvent(mediaElement, 'error'); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| var arrayBuffer = mediaData.buffer.slice(); |
| - assert_equals(arrayBuffer.byteLength, mediaData.buffer.byteLength, "arrayBuffer.byteLength before transfer."); |
| + assert_equals(arrayBuffer.byteLength, mediaData.buffer.byteLength, 'arrayBuffer.byteLength before transfer.'); |
| // Send the buffer as in a message so it gets neutered. |
| - window.postMessage( "test", "*", [arrayBuffer]); |
| + window.postMessage( 'test', '*', [arrayBuffer]); |
| - assert_equals(arrayBuffer.byteLength, 0, "arrayBuffer.byteLength after transfer."); |
| + assert_equals(arrayBuffer.byteLength, 0, 'arrayBuffer.byteLength after transfer.'); |
| sourceBuffer.appendBuffer(arrayBuffer); |
| - assert_true(sourceBuffer.updating, "updating attribute is true"); |
| + assert_true(sourceBuffer.updating, 'updating attribute is true'); |
| test.waitForExpectedEvents(function() |
| { |
| - assert_false(sourceBuffer.updating, "updating attribute is false"); |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| test.done(); |
| }); |
| - }, "Test appending a neutered ArrayBuffer."); |
| + }, 'Test appending a neutered ArrayBuffer.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init); |
| + var halfIndex = (initSegment.length + 1) / 2; |
| + var partialInitSegment = initSegment.subarray(0, halfIndex); |
| + var remainingInitSegment = initSegment.subarray(halfIndex); |
| + var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]); |
| + |
|
wolenetz
2014/07/29 22:33:22
nit: remove extra horizontal whitespace in this li
prabhur1
2014/07/30 19:56:22
Done.
|
| + test.expectEvent(sourceBuffer, 'updateend', 'partialInitSegment append ended.'); |
| + sourceBuffer.appendBuffer(partialInitSegment); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_equals(mediaElement.readyState, mediaElement.HAVE_NOTHING); |
| + assert_equals(mediaSource.duration, Number.NaN);; |
|
wolenetz
2014/07/29 22:33:22
nit: remove trailing extra ;
prabhur1
2014/07/30 19:56:21
Done.
|
| + test.expectEvent(sourceBuffer, 'updateend', 'remainingInitSegment append ended.'); |
| + test.expectEvent(mediaElement, 'loadedmetadata', 'loadedmetadata event received.'); |
| + sourceBuffer.appendBuffer(remainingInitSegment); |
| + }); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_equals(mediaElement.readyState, mediaElement.HAVE_METADATA); |
| + assert_equals(mediaSource.duration, segmentInfo.durationInInitSegment);; |
|
wolenetz
2014/07/29 22:33:22
nit: remove trailing extra ;
prabhur1
2014/07/30 19:56:22
Done.
|
| + test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.'); |
| + test.expectEvent(mediaElement, 'loadeddata', 'loadeddata fired.'); |
| + sourceBuffer.appendBuffer(mediaSegment); |
| + }); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_greater_than_equal(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA); |
| + assert_equals(sourceBuffer.updating, false); |
| + assert_not_equals(mediaSource.readyState, 'ended'); |
|
wolenetz
2014/07/29 22:33:22
nit: I'm not convinced this check needs to be this
prabhur1
2014/07/30 19:56:22
Done.
|
| + test.done(); |
| + }); |
| + }, 'Test appendBuffer with partial init segments.'); |
| + |
| + mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| + { |
| + var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init); |
| + var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]); |
| + var halfIndex = (mediaSegment.length + 1) / 2; |
| + var partialMediaSegment = mediaSegment.subarray(0, halfIndex); |
| + var remainingMediaSegment = mediaSegment.subarray(halfIndex); |
| + |
| + test.expectEvent(sourceBuffer, 'updateend', 'InitSegment append ended.'); |
| + test.expectEvent(mediaElement, 'loadedmetadata', 'loadedmetadata done.'); |
| + sourceBuffer.appendBuffer(initSegment); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_equals(mediaElement.readyState, mediaElement.HAVE_METADATA); |
| + assert_equals(mediaSource.duration, segmentInfo.durationInInitSegment); |
| + test.expectEvent(sourceBuffer, 'updateend', 'partial media segment append ended.'); |
| + sourceBuffer.appendBuffer(partialMediaSegment); |
| + }); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.'); |
| + test.expectEvent(mediaElement, 'loadeddata', 'loadeddata fired.'); |
|
wolenetz
2014/07/29 22:33:22
loadeddata could occur earlier, so this looks like
prabhur1
2014/07/30 19:56:21
Done.
prabhur1
2014/07/30 19:56:22
As per our discussion keeping this test as it is.
|
| + sourceBuffer.appendBuffer(remainingMediaSegment); |
| + }); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_greater_than_equal(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA); |
| + assert_not_equals(mediaSource.readyState, 'ended'); |
|
wolenetz
2014/07/29 22:33:22
nit: ditto: assert 'open' instead?
prabhur1
2014/07/30 19:56:21
Done.
|
| + assert_equals(sourceBuffer.updating, false); |
| + test.done(); |
| + }); |
| + }, 'Test appendBuffer with partial media segments.'); |
| + |
| + mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| + { |
| + var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init); |
| var partialInitSegment = initSegment.subarray(0, initSegment.length / 2); |
| var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]); |
| - test.expectEvent(sourceBuffer, "updateend", "partialInitSegment append ended."); |
| + test.expectEvent(sourceBuffer, 'updateend', 'partialInitSegment append ended.'); |
| sourceBuffer.appendBuffer(partialInitSegment); |
| test.waitForExpectedEvents(function() |
| @@ -357,14 +432,14 @@ |
| sourceBuffer.abort(); |
| // Append the full intiialization segment. |
| - test.expectEvent(sourceBuffer, "updateend", "initSegment append ended."); |
| + test.expectEvent(sourceBuffer, 'updateend', 'initSegment append ended.'); |
| sourceBuffer.appendBuffer(initSegment); |
| }); |
| test.waitForExpectedEvents(function() |
| { |
| - test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended."); |
| - test.expectEvent(mediaElement, "loadeddata", "loadeddata fired."); |
| + test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.'); |
| + test.expectEvent(mediaElement, 'loadeddata', 'loadeddata fired.'); |
| sourceBuffer.appendBuffer(mediaSegment); |
| }); |
| @@ -372,7 +447,7 @@ |
| { |
| test.done(); |
| }); |
| - }, "Test abort in the middle of an initialization segment."); |
| + }, 'Test abort in the middle of an initialization segment.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| @@ -381,12 +456,12 @@ |
| var partialMediaSegment = mediaSegment.subarray(0, 3 * mediaSegment.length / 4); |
| var partialBufferedRanges = null; |
| - test.expectEvent(sourceBuffer, "updateend", "initSegment append ended."); |
| + test.expectEvent(sourceBuffer, 'updateend', 'initSegment append ended.'); |
| sourceBuffer.appendBuffer(initSegment); |
| test.waitForExpectedEvents(function() |
| { |
| - test.expectEvent(sourceBuffer, "updateend", "partialMediaSegment append ended."); |
| + test.expectEvent(sourceBuffer, 'updateend', 'partialMediaSegment append ended.'); |
| sourceBuffer.appendBuffer(partialMediaSegment); |
| }); |
| @@ -397,48 +472,100 @@ |
| // Keep a copy of the buffered ranges before we append the whole media segment. |
| partialBufferedRanges = sourceBuffer.buffered; |
| - assert_equals(partialBufferedRanges.length, 1, "partialBufferedRanges has 1 range"); |
| + assert_equals(partialBufferedRanges.length, 1, 'partialBufferedRanges has 1 range'); |
| // Append the full media segment. |
| - test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended."); |
| + test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.'); |
| sourceBuffer.appendBuffer(mediaSegment); |
| }); |
| test.waitForExpectedEvents(function() |
| { |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| - assert_equals(sourceBuffer.buffered.length, 1, "sourceBuffer.buffered has 1 range"); |
| - assert_equals(sourceBuffer.buffered.length, partialBufferedRanges.length, "sourceBuffer.buffered and partialBufferedRanges are the same length."); |
| - assert_equals(sourceBuffer.buffered.start(0), partialBufferedRanges.start(0), "sourceBuffer.buffered and partialBufferedRanges start times match."); |
| - assert_greater_than(sourceBuffer.buffered.end(0), partialBufferedRanges.end(0), "sourceBuffer.buffered has a higher end time than partialBufferedRanges."); |
| + assert_equals(sourceBuffer.buffered.length, 1, 'sourceBuffer.buffered has 1 range'); |
| + assert_equals(sourceBuffer.buffered.length, partialBufferedRanges.length, 'sourceBuffer.buffered and partialBufferedRanges are the same length.'); |
| + assert_equals(sourceBuffer.buffered.start(0), partialBufferedRanges.start(0), 'sourceBuffer.buffered and partialBufferedRanges start times match.'); |
| + assert_greater_than(sourceBuffer.buffered.end(0), partialBufferedRanges.end(0), 'sourceBuffer.buffered has a higher end time than partialBufferedRanges.'); |
| + test.done(); |
| + }); |
| + }, 'Test abort in the middle of a media segment.'); |
| + |
| + mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| + { |
| + test.expectEvent(mediaSource.sourceBuffers, 'removesourcebuffer', 'SourceBuffer removed.'); |
| + mediaSource.removeSourceBuffer(sourceBuffer); |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_throws('InvalidStateError', |
| + function() { sourceBuffer.abort(); }, |
| + 'sourceBuffer.abort() throws an exception for InvalidStateError.'); |
| + |
| test.done(); |
| }); |
| - }, "Test abort in the middle of a media segment."); |
| + }, 'Test abort after removing sourcebuffer.'); |
| + |
| + mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| + { |
| + test.expectEvent(mediaSource, 'sourceended', 'source ended'); |
| + |
| + assert_equals(mediaSource.readyState, 'open', 'readyState is open.'); |
| + mediaSource.endOfStream(); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_equals(mediaSource.readyState, 'ended', 'readyState is ended.'); |
| + assert_throws('InvalidStateError', |
| + function() { sourceBuffer.abort(); }, |
| + 'sourceBuffer.abort() throws an exception for InvalidStateError.'); |
| + |
| + test.done(); |
| + }); |
| + |
| + }, 'Test abort after readyState is ended.'); |
|
wolenetz
2014/07/29 22:33:22
Some of these tests, like all the "test abort *",
prabhur1
2014/07/30 19:56:22
Added a P2 to the spreadsheet. Yes, we need to add
prabhur1
2014/07/30 19:56:22
Done.
|
| + mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| + { |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| + sourceBuffer.appendWindowStart = 1; |
| + sourceBuffer.appendWindowEnd = 100; |
| + sourceBuffer.appendBuffer(mediaData); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_false(sourceBuffer.updating, 'updating attribute is false'); |
| + sourceBuffer.abort(); |
| + assert_equals(sourceBuffer.appendWindowStart, 0, 'appendWindowStart is reset to 0'); |
| + assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY, |
| + 'appendWindowEnd is reset to +INFINITY'); |
| + test.done(); |
| + }); |
| + }, 'Test abort after appendBuffer update ends.'); |
| + |
| mediasource_test(function(test, mediaElement, mediaSource) |
| { |
| var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE); |
| - test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| - test.expectEvent(sourceBuffer, "update", "Append success."); |
| - test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.expectEvent(sourceBuffer, 'updatestart', 'Append started.'); |
| + test.expectEvent(sourceBuffer, 'update', 'Append success.'); |
| + test.expectEvent(sourceBuffer, 'updateend', 'Append ended.'); |
| - assert_throws( { name: "TypeError"} , |
| + assert_throws( { name: 'TypeError'} , |
| function() { sourceBuffer.appendBuffer(null); }, |
| - "appendBuffer(null) throws an exception."); |
| + 'appendBuffer(null) throws an exception.'); |
| test.done(); |
| - }, "Test appending null."); |
| + }, 'Test appending null.'); |
| mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| { |
| mediaSource.removeSourceBuffer(sourceBuffer); |
| - assert_throws( { name: "InvalidStateError"} , |
| + assert_throws( { name: 'InvalidStateError'} , |
| function() { sourceBuffer.appendBuffer(mediaData); }, |
| - "appendBuffer() throws an exception when called after removeSourceBuffer()."); |
| + 'appendBuffer() throws an exception when called after removeSourceBuffer().'); |
| test.done(); |
| - }, "Test appending after removeSourceBuffer()."); |
| + }, 'Test appending after removeSourceBuffer().'); |
|
wolenetz
2014/07/29 22:33:22
nit: remove trailing whitespace
prabhur1
2014/07/30 19:56:22
Done.
|
| </script> |
| </body> |
| </html> |