Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-append-legacystream.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-append-legacystream.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-append-legacystream.html |
deleted file mode 100644 |
index 08a1ea14bc78a4a64cb02453a32837bbf363661c..0000000000000000000000000000000000000000 |
--- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-append-legacystream.html |
+++ /dev/null |
@@ -1,385 +0,0 @@ |
-<!DOCTYPE html> |
-<html> |
- <head> |
- <script src="/w3c/resources/testharness.js"></script> |
- <script src="/w3c/resources/testharnessreport.js"></script> |
- <script src="mediasource-util.js"></script> |
- <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
- </head> |
- <body> |
- <div id="log"></div> |
- <script> |
- function createMediaXHR() { |
- var mediaURL = MediaSourceUtil.SEGMENT_INFO.url; |
- var xhr = new XMLHttpRequest(); |
- xhr.open('GET', mediaURL, true); |
- xhr.responseType = 'legacystream'; |
- |
- assert_equals(xhr.responseType, "legacystream", "Verify response type was set."); |
- |
- return xhr; |
- } |
- |
- function waitForLoadingState(test, xhr, callback) |
- { |
- var eventHandler = test.step_func(function(e) |
- { |
- if (e.target.readyState < e.target.LOADING) |
- return; |
- xhr.removeEventListener('readystatechange', eventHandler); |
- callback(); |
- }); |
- xhr.addEventListener('readystatechange', eventHandler); |
- } |
- |
- function appendStream(test, sourceBuffer, callback) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- |
- xhr.send(); |
- |
- waitForLoadingState(test, xhr, function() |
- { |
- assert_true(xhr.response != null, "xhr.response is not null"); |
- |
- test.expectEvent(xhr, "load", "XHR load completed."); |
- test.expectEvent(xhr, "loadend", "XHR load ended."); |
- |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- callback(); |
- }); |
- }); |
- } |
- |
- function appendStreamTest(callback, description) |
- { |
- mediasource_test(function(test, mediaElement, mediaSource) |
- { |
- var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.SEGMENT_INFO.type); |
- test.failOnEvent(mediaElement, 'error'); |
- callback(test, mediaElement, mediaSource, sourceBuffer); |
- }, description); |
- } |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- test.expectEvent(mediaElement, "canplaythrough", "Reached HAVE_ENOUGH_DATA."); |
- appendStream(test, sourceBuffer, function() { test.done(); }); |
- }, "Test SourceBuffer.appendStream() event dispatching."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- var xhr2 = createMediaXHR(); |
- xhr2.send(); |
- waitForLoadingState(test, xhr2, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- assert_throws("InvalidStateError", |
- function() { sourceBuffer.appendStream(xhr2.response); }, |
- "appendStream() throws an exception because there is a pending append."); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }); |
- }, "Test SourceBuffer.appendStream() call during a pending appendStream()."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "abort", "Append aborted."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- sourceBuffer.abort(); |
- |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }, "Test SourceBuffer.abort() call during a pending appendStream()."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- appendStream(test, sourceBuffer, function() |
- { |
- 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'"); |
- |
- var xhr2 = createMediaXHR(); |
- xhr2.send(); |
- waitForLoadingState(test, xhr2, function() |
- { |
- 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.appendStream(xhr2.response); |
- |
- 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"); |
- test.done(); |
- }); |
- }); |
- }); |
- }); |
- }, "Test SourceBuffer.appendStream() triggering an 'ended' to 'open' transition."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "abort", "Append aborted."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- assert_equals(mediaSource.activeSourceBuffers.length, 0, "activeSourceBuffers.length"); |
- |
- test.expectEvent(mediaSource.sourceBuffers, "removesourcebuffer", "sourceBuffers"); |
- mediaSource.removeSourceBuffer(sourceBuffer); |
- |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- |
- var xhr2 = createMediaXHR(); |
- test.failOnEvent(xhr2, 'error'); |
- xhr2.send(); |
- waitForLoadingState(test, xhr2, function() |
- { |
- assert_throws("InvalidStateError", |
- function() { sourceBuffer.appendStream(xhr2.response); }, |
- "appendStream() throws an exception because it isn't attached to the mediaSource anymore."); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }); |
- }, "Test MediaSource.removeSourceBuffer() call during a pending appendStream()."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- assert_throws("InvalidStateError", |
- function() { mediaSource.duration = 1.0; }, |
- "set duration throws an exception when updating attribute is true."); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }, "Test setting MediaSource.duration during a pending appendStream() for one of its SourceBuffers."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, "error"); |
- test.failOnEvent(mediaSource, "sourceended"); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- assert_throws("InvalidStateError", |
- function() { mediaSource.endOfStream(); }, |
- "endOfStream() throws an exception when updating attribute is true."); |
- |
- assert_equals(mediaSource.readyState, "open"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- assert_equals(mediaSource.readyState, "open"); |
- test.done(); |
- }); |
- }); |
- }, "Test MediaSource.endOfStream() during a pending appendStream() for one of its SourceBuffers."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- assert_throws("InvalidStateError", |
- function() { sourceBuffer.timestampOffset = 10.0; }, |
- "set timestampOffset throws an exception when updating attribute is true."); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }, "Test setting SourceBuffer.timestampOffset during a pending appendStream()."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response, 0); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }, "Test appending a Stream with maxSize equal to 0."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response, 10); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }, "Test appending a Stream with maxSize value less than the size of the XHR response."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response, 10 * 1024 * 1024); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }, "Test appending a Stream with maxSize value greater than the size of the XHR response."); |
- |
- appendStreamTest(function(test, mediaElement, mediaSource, sourceBuffer) |
- { |
- var xhr = createMediaXHR(); |
- test.failOnEvent(xhr, 'error'); |
- xhr.send(); |
- waitForLoadingState(test, xhr, function() |
- { |
- test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
- test.expectEvent(sourceBuffer, "update", "Append success."); |
- test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
- sourceBuffer.appendStream(xhr.response, "test"); |
- |
- assert_true(sourceBuffer.updating, "updating attribute is true"); |
- |
- test.waitForExpectedEvents(function() |
- { |
- assert_false(sourceBuffer.updating, "updating attribute is false"); |
- test.done(); |
- }); |
- }); |
- }, "Test appending a Stream with an invalid maxSize."); |
- |
- </script> |
- </body> |
-</html> |