[Media Source] Import updated w3c/web-platform-tests and rebaseline
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Sep 2016 00:47:53 +0000 (00:47 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Sep 2016 00:47:53 +0000 (00:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161723

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* web-platform-tests/media-source/OWNERS: Added.
* web-platform-tests/media-source/SourceBuffer-abort-expected.txt: Added.
* web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt: Added.
* web-platform-tests/media-source/SourceBuffer-abort-readyState.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-readyState.html.
* web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt: Added.
* web-platform-tests/media-source/SourceBuffer-abort-removed.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-removed.html.
* web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt: Added.
* web-platform-tests/media-source/SourceBuffer-abort-updating.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-updating.html.
* web-platform-tests/media-source/SourceBuffer-abort.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort.html.
* web-platform-tests/media-source/URL-createObjectURL-expected.txt: Added.
* web-platform-tests/media-source/URL-createObjectURL-null-expected.txt: Added.
* web-platform-tests/media-source/URL-createObjectURL-null.html: Added.
* web-platform-tests/media-source/URL-createObjectURL-revoke-expected.txt: Added.
* web-platform-tests/media-source/URL-createObjectURL-revoke.html: Added.
* web-platform-tests/media-source/URL-createObjectURL.html: Added.
* web-platform-tests/media-source/import_tests.sh: Added.
* web-platform-tests/media-source/interfaces-expected.txt: Added.
* web-platform-tests/media-source/interfaces.html: Added.
* web-platform-tests/media-source/manifest.txt: Added.
* web-platform-tests/media-source/mediasource-activesourcebuffers-expected.txt: Added.
* web-platform-tests/media-source/mediasource-activesourcebuffers.html: Added.
* web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt.
* web-platform-tests/media-source/mediasource-addsourcebuffer-mode-expected.txt: Added.
* web-platform-tests/media-source/mediasource-addsourcebuffer-mode.html: Added.
* web-platform-tests/media-source/mediasource-addsourcebuffer.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html.
* web-platform-tests/media-source/mediasource-append-buffer-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt.
* web-platform-tests/media-source/mediasource-append-buffer.html: Added.
* web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded-expected.txt: Added.
* web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded.html: Added.
* web-platform-tests/media-source/mediasource-appendwindow-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-appendwindow-expected.txt.
* web-platform-tests/media-source/mediasource-appendwindow.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-appendwindow.html.
* web-platform-tests/media-source/mediasource-avtracks-expected.txt: Added.
* web-platform-tests/media-source/mediasource-avtracks.html: Added.
* web-platform-tests/media-source/mediasource-buffered-expected.txt: Added.
* web-platform-tests/media-source/mediasource-buffered.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-buffered.html.
* web-platform-tests/media-source/mediasource-closed-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-closed-expected.txt.
* web-platform-tests/media-source/mediasource-closed.html: Added.
* web-platform-tests/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-mp4-a-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html.
* web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-mp4-v-framerate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-mp4-v-framerate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html.
* web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html.
* web-platform-tests/media-source/mediasource-config-change-webm-a-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-webm-a-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-webm-av-audio-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-webm-av-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-webm-av-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html.
* web-platform-tests/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-webm-av-video-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-webm-v-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-webm-v-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html.
* web-platform-tests/media-source/mediasource-config-change-webm-v-framerate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-webm-v-framerate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html.
* web-platform-tests/media-source/mediasource-config-change-webm-v-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt.
* web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html.
* web-platform-tests/media-source/mediasource-config-changes.js: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-changes.js.
(resolutionFromFilename):
(appendBuffer):
(mediaSourceConfigChangeTest):
* web-platform-tests/media-source/mediasource-detach-expected.txt: Added.
* web-platform-tests/media-source/mediasource-detach.html: Added.
* web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt: Added.
* web-platform-tests/media-source/mediasource-duration-boundaryconditions.html: Added.
* web-platform-tests/media-source/mediasource-duration-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-duration-expected.txt.
* web-platform-tests/media-source/mediasource-duration.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-duration.html.
* web-platform-tests/media-source/mediasource-endofstream-expected.txt: Added.
* web-platform-tests/media-source/mediasource-endofstream-invaliderror-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-endofstream-invaliderror-expected.txt.
* web-platform-tests/media-source/mediasource-endofstream-invaliderror.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-endofstream-invaliderror.html.
* web-platform-tests/media-source/mediasource-endofstream.html: Added.
* web-platform-tests/media-source/mediasource-errors-expected.txt: Added.
* web-platform-tests/media-source/mediasource-errors.html: Added.
* web-platform-tests/media-source/mediasource-getvideoplaybackquality-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-getvideoplaybackquality-expected.txt.
* web-platform-tests/media-source/mediasource-getvideoplaybackquality.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-getvideoplaybackquality.html.
* web-platform-tests/media-source/mediasource-is-type-supported-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt.
* web-platform-tests/media-source/mediasource-is-type-supported.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-is-type-supported.html.
* web-platform-tests/media-source/mediasource-liveseekable-expected.txt: Added.
* web-platform-tests/media-source/mediasource-liveseekable.html: Added.
* web-platform-tests/media-source/mediasource-multiple-attach-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-multiple-attach-expected.txt.
* web-platform-tests/media-source/mediasource-multiple-attach.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-multiple-attach.html.
* web-platform-tests/media-source/mediasource-play-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play-expected.txt.
* web-platform-tests/media-source/mediasource-play-then-seek-back-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-expected.txt.
* web-platform-tests/media-source/mediasource-play-then-seek-back.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html.
* web-platform-tests/media-source/mediasource-play.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play.html.
* web-platform-tests/media-source/mediasource-preload-expected.txt: Added.
* web-platform-tests/media-source/mediasource-preload.html: Added.
* web-platform-tests/media-source/mediasource-redundant-seek-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-redundant-seek-expected.txt.
* web-platform-tests/media-source/mediasource-redundant-seek.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-redundant-seek.html.
* web-platform-tests/media-source/mediasource-remove-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-remove-expected.txt.
* web-platform-tests/media-source/mediasource-remove.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-remove.html.
* web-platform-tests/media-source/mediasource-removesourcebuffer-expected.txt: Added.
* web-platform-tests/media-source/mediasource-removesourcebuffer.html: Added.
* web-platform-tests/media-source/mediasource-seek-beyond-duration-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-beyond-duration-expected.txt.
* web-platform-tests/media-source/mediasource-seek-beyond-duration.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-beyond-duration.html.
* web-platform-tests/media-source/mediasource-seek-during-pending-seek-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-during-pending-seek-expected.txt.
* web-platform-tests/media-source/mediasource-seek-during-pending-seek.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-during-pending-seek.html.
* web-platform-tests/media-source/mediasource-seekable-expected.txt: Added.
* web-platform-tests/media-source/mediasource-seekable.html: Added.
* web-platform-tests/media-source/mediasource-sequencemode-append-buffer-expected.txt: Added.
* web-platform-tests/media-source/mediasource-sequencemode-append-buffer.html: Added.
* web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode-expected.txt.
* web-platform-tests/media-source/mediasource-sourcebuffer-mode.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html.
* web-platform-tests/media-source/mediasource-sourcebuffer-trackdefaults-expected.txt: Added.
* web-platform-tests/media-source/mediasource-sourcebuffer-trackdefaults.html: Added.
* web-platform-tests/media-source/mediasource-sourcebufferlist-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt.
* web-platform-tests/media-source/mediasource-sourcebufferlist.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist.html.
* web-platform-tests/media-source/mediasource-timestamp-offset-expected.txt: Added.
* web-platform-tests/media-source/mediasource-timestamp-offset.html: Added.
* web-platform-tests/media-source/mediasource-trackdefault-expected.txt: Added.
* web-platform-tests/media-source/mediasource-trackdefault.html: Added.
* web-platform-tests/media-source/mediasource-trackdefaultlist-expected.txt: Added.
* web-platform-tests/media-source/mediasource-trackdefaultlist.html: Added.
* web-platform-tests/media-source/mediasource-util.js: Renamed from LayoutTests/http/tests/media/media-source/mediasource-util.js.
(EventExpectationsManager):
(EventExpectationsManager.prototype.expectEvent):
(EventExpectationsManager.prototype.waitForExpectedEvents):
(EventExpectationsManager.prototype.expectingEvents):
(EventExpectationsManager.prototype.handleWaitCallback_):
(EventExpectationsManager.prototype.getExpectations_):
(loadData_):
(onSourceOpen):
(openMediaSource_):
(MediaSourceUtil.loadTextData):
(MediaSourceUtil.loadBinaryData):
(MediaSourceUtil.fetchManifestAndData):
(MediaSourceUtil.extractSegmentData):
(MediaSourceUtil.getMediaDataForPlaybackTime):
(getFirstSupportedType):
(getSegmentInfo):
(MediaSourceUtil.getSubType):
(MediaSourceUtil.append):
(onEvent):
(onAppendDone):
(MediaSourceUtil.appendUntilEventFires):
(addExtraTestMethods.test.expectEvent):
(addExtraTestMethods.test.waitForExpectedEvents):
(addExtraTestMethods.test.waitForCurrentTimeChange):
(addExtraTestMethods.test.done):
(addExtraTestMethods):
(window.string_appeared_here):
* web-platform-tests/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json.
* web-platform-tests/media-source/mp4/test-a-128k-44100Hz-1ch.mp4: Added.
* web-platform-tests/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json.
* web-platform-tests/media-source/mp4/test-a-192k-44100Hz-1ch.mp4: Added.
* web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.mp4.
* web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.mp4.
* web-platform-tests/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.mp4.
* web-platform-tests/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.mp4.
* web-platform-tests/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4.
* web-platform-tests/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-v-128k-320x240-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-30fps-10kfr.mp4.
* web-platform-tests/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-v-128k-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-640x480-30fps-10kfr.mp4.
* web-platform-tests/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/mp4/test-v-256k-320x240-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-256k-320x240-30fps-10kfr.mp4.
* web-platform-tests/media-source/mp4/test.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test.mp4.
* web-platform-tests/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json.
* web-platform-tests/media-source/webm/test-a-128k-44100Hz-1ch.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-128k-44100Hz-1ch.webm.
* web-platform-tests/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json.
* web-platform-tests/media-source/webm/test-a-192k-44100Hz-1ch.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-192k-44100Hz-1ch.webm.
* web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm.
* web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.webm.
* web-platform-tests/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.webm.
* web-platform-tests/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.webm.
* web-platform-tests/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json.
* web-platform-tests/media-source/webm/test-v-128k-320x240-24fps-8kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-24fps-8kfr.webm.
* web-platform-tests/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/webm/test-v-128k-320x240-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-30fps-10kfr.webm.
* web-platform-tests/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/webm/test-v-128k-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-640x480-30fps-10kfr.webm.
* web-platform-tests/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json.
* web-platform-tests/media-source/webm/test-v-256k-320x240-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-256k-320x240-30fps-10kfr.webm.
* web-platform-tests/media-source/webm/test-vp8-vorbis-webvtt.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-vp8-vorbis-webvtt.webm.
* web-platform-tests/media-source/webm/test.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test.webm.

LayoutTests:

* http/tests/media/media-source/mediasource-append-buffer.html: Removed.
* http/tests/media/media-source/mediasource-buffered-expected.txt: Removed.
* http/tests/media/media-source/mediasource-closed.html: Removed.
* http/tests/media/media-source/mediasource-config-changes.js:
(resolutionFromFilename): Deleted.
(appendBuffer): Deleted.
(mediaSourceConfigChangeTest): Deleted.
* http/tests/media/media-source/mediasource-util.js:
(EventExpectationsManager): Deleted.
(EventExpectationsManager.prototype.expectEvent): Deleted.
(EventExpectationsManager.prototype.waitForExpectedEvents): Deleted.
(EventExpectationsManager.prototype.expectingEvents): Deleted.
(EventExpectationsManager.prototype.handleWaitCallback_): Deleted.
(EventExpectationsManager.prototype.getExpectations_): Deleted.
(loadData_): Deleted.
(onSourceOpen): Deleted.
(openMediaSource_): Deleted.
(MediaSourceUtil.loadTextData): Deleted.
(MediaSourceUtil.loadBinaryData): Deleted.
(MediaSourceUtil.fetchManifestAndData): Deleted.
(MediaSourceUtil.extractSegmentData): Deleted.
(MediaSourceUtil.getMediaDataForPlaybackTime): Deleted.
(getFirstSupportedType): Deleted.
(getSegmentInfo): Deleted.
(MediaSourceUtil.getSubType): Deleted.
(addExtraTestMethods.test.failOnEvent): Deleted.
(addExtraTestMethods.test.endOnEvent): Deleted.
(addExtraTestMethods.test.expectEvent): Deleted.
(addExtraTestMethods.test.waitForExpectedEvents): Deleted.
(addExtraTestMethods.test.waitForCurrentTimeChange): Deleted.
(addExtraTestMethods.test.done): Deleted.
(addExtraTestMethods): Deleted.
(window.string_appeared_here): Deleted.
* http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch.mp4: Removed.
* http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch.mp4: Removed.
* http/tests/media/media-source/webm/segment-info.js: Removed.
* platform/ios-simulator/TestExpectations:
* platform/mac/TestExpectations:
* platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-expected.txt: Added.
* platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt: Added.
* platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt: Added.
* platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205777 268f45cc-cd09-0410-ab3c-d52691b4dbfc

178 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html [deleted file]
LayoutTests/http/tests/media/media-source/mediasource-append-stream-expected.txt [deleted file]
LayoutTests/http/tests/media/media-source/mediasource-append-stream.html [deleted file]
LayoutTests/http/tests/media/media-source/mediasource-buffered-expected.txt [deleted file]
LayoutTests/http/tests/media/media-source/mediasource-closed.html [deleted file]
LayoutTests/http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch.mp4 [deleted file]
LayoutTests/http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch.mp4 [deleted file]
LayoutTests/http/tests/media/media-source/webm/segment-info.js [deleted file]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/ImportExpectations
LayoutTests/imported/w3c/web-platform-tests/media-source/OWNERS [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-readyState.html [moved from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-readyState.html with 93% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed.html [moved from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-removed.html with 93% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-updating.html [moved from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-updating.html with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort.html [moved from LayoutTests/http/tests/media/media-source/SourceBuffer-abort.html with 90% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-null-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-null.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-revoke-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-revoke.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/import_tests.sh [new file with mode: 0755]
LayoutTests/imported/w3c/web-platform-tests/media-source/interfaces-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/interfaces.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/manifest.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt with 61% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-mode-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-mode.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer.html [moved from LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html with 58% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-append-buffer-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt with 54% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-append-buffer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendwindow-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-appendwindow-expected.txt with 74% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendwindow.html [moved from LayoutTests/http/tests/media/media-source/mediasource-appendwindow.html with 60% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-avtracks.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-buffered-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-buffered.html [moved from LayoutTests/http/tests/media/media-source/mediasource-buffered.html with 59% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-closed-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-closed-expected.txt with 50% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-closed.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt with 95% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-a-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html with 54% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt with 95% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-framerate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-framerate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-a-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt with 95% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-a-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html with 54% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-av-audio-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-av-framesize-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-av-framesize.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-av-video-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-bitrate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt with 95% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-bitrate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framerate-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framerate.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html [moved from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-config-changes.js [moved from LayoutTests/http/tests/media/media-source/mediasource-config-changes.js with 84% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-detach-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-detach.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-duration-expected.txt with 74% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration.html [moved from LayoutTests/http/tests/media/media-source/mediasource-duration.html with 74% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream-invaliderror-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-endofstream-invaliderror-expected.txt with 99% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream-invaliderror.html [moved from LayoutTests/http/tests/media/media-source/mediasource-endofstream-invaliderror.html with 71% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-errors-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-errors.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-getvideoplaybackquality-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-getvideoplaybackquality-expected.txt with 97% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-getvideoplaybackquality.html [moved from LayoutTests/http/tests/media/media-source/mediasource-getvideoplaybackquality.html with 80% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt with 88% similarity, mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html [moved from LayoutTests/http/tests/media/media-source/mediasource-is-type-supported.html with 86% similarity, mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-liveseekable-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-liveseekable.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-multiple-attach-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-multiple-attach-expected.txt with 98% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-multiple-attach.html [moved from LayoutTests/http/tests/media/media-source/mediasource-multiple-attach.html with 93% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-play-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-play-expected.txt with 96% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-play-then-seek-back-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-expected.txt with 95% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-play-then-seek-back.html [moved from LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html with 84% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-play.html [moved from LayoutTests/http/tests/media/media-source/mediasource-play.html with 61% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-preload-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-preload.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-redundant-seek-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-redundant-seek-expected.txt with 95% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-redundant-seek.html [moved from LayoutTests/http/tests/media/media-source/mediasource-redundant-seek.html with 82% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-remove-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-remove-expected.txt with 75% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-remove.html [moved from LayoutTests/http/tests/media/media-source/mediasource-remove.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-removesourcebuffer-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-removesourcebuffer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-seek-beyond-duration-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-seek-beyond-duration-expected.txt with 97% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-seek-beyond-duration.html [moved from LayoutTests/http/tests/media/media-source/mediasource-seek-beyond-duration.html with 86% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-seek-during-pending-seek-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-seek-during-pending-seek-expected.txt with 98% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-seek-during-pending-seek.html [moved from LayoutTests/http/tests/media/media-source/mediasource-seek-during-pending-seek.html with 55% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-seekable-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-seekable.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sequencemode-append-buffer-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sequencemode-append-buffer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode-expected.txt with 99% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode.html [moved from LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html with 95% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-trackdefaults-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-trackdefaults.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebufferlist-expected.txt [moved from LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt with 78% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebufferlist.html [moved from LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist.html with 76% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-timestamp-offset-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-timestamp-offset.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-trackdefault-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-trackdefault.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-trackdefaultlist-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-trackdefaultlist.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-util.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-a-128k-44100Hz-1ch.mp4 [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-a-192k-44100Hz-1ch.mp4 [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.mp4 with 91% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.mp4 with 88% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.mp4 with 86% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.mp4 with 93% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4 with 90% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-128k-320x240-30fps-10kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-30fps-10kfr.mp4 with 88% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-128k-640x480-30fps-10kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-640x480-30fps-10kfr.mp4 with 79% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test-v-256k-320x240-30fps-10kfr.mp4 [moved from LayoutTests/http/tests/media/media-source/mp4/test-v-256k-320x240-30fps-10kfr.mp4 with 87% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/mp4/test.mp4 [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-a-128k-44100Hz-1ch.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-a-128k-44100Hz-1ch.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-a-192k-44100Hz-1ch.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-a-192k-44100Hz-1ch.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-128k-320x240-24fps-8kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-24fps-8kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-128k-320x240-30fps-10kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-30fps-10kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-128k-640x480-30fps-10kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-v-128k-640x480-30fps-10kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json [moved from LayoutTests/http/tests/media/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-v-256k-320x240-30fps-10kfr.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-v-256k-320x240-30fps-10kfr.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test-vp8-vorbis-webvtt.webm [moved from LayoutTests/http/tests/media/media-source/webm/test-vp8-vorbis-webvtt.webm with 100% similarity]
LayoutTests/imported/w3c/web-platform-tests/media-source/webm/test.webm [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt [new file with mode: 0644]

index 5e535b6..4fbd564 100644 (file)
@@ -1,3 +1,53 @@
+2016-09-09  Jer Noble  <jer.noble@apple.com>
+
+        [Media Source] Import updated w3c/web-platform-tests and rebaseline
+        https://bugs.webkit.org/show_bug.cgi?id=161723
+
+        Reviewed by Youenn Fablet.
+
+        * http/tests/media/media-source/mediasource-append-buffer.html: Removed.
+        * http/tests/media/media-source/mediasource-buffered-expected.txt: Removed.
+        * http/tests/media/media-source/mediasource-closed.html: Removed.
+        * http/tests/media/media-source/mediasource-config-changes.js:
+        (resolutionFromFilename): Deleted.
+        (appendBuffer): Deleted.
+        (mediaSourceConfigChangeTest): Deleted.
+        * http/tests/media/media-source/mediasource-util.js:
+        (EventExpectationsManager): Deleted.
+        (EventExpectationsManager.prototype.expectEvent): Deleted.
+        (EventExpectationsManager.prototype.waitForExpectedEvents): Deleted.
+        (EventExpectationsManager.prototype.expectingEvents): Deleted.
+        (EventExpectationsManager.prototype.handleWaitCallback_): Deleted.
+        (EventExpectationsManager.prototype.getExpectations_): Deleted.
+        (loadData_): Deleted.
+        (onSourceOpen): Deleted.
+        (openMediaSource_): Deleted.
+        (MediaSourceUtil.loadTextData): Deleted.
+        (MediaSourceUtil.loadBinaryData): Deleted.
+        (MediaSourceUtil.fetchManifestAndData): Deleted.
+        (MediaSourceUtil.extractSegmentData): Deleted.
+        (MediaSourceUtil.getMediaDataForPlaybackTime): Deleted.
+        (getFirstSupportedType): Deleted.
+        (getSegmentInfo): Deleted.
+        (MediaSourceUtil.getSubType): Deleted.
+        (addExtraTestMethods.test.failOnEvent): Deleted.
+        (addExtraTestMethods.test.endOnEvent): Deleted.
+        (addExtraTestMethods.test.expectEvent): Deleted.
+        (addExtraTestMethods.test.waitForExpectedEvents): Deleted.
+        (addExtraTestMethods.test.waitForCurrentTimeChange): Deleted.
+        (addExtraTestMethods.test.done): Deleted.
+        (addExtraTestMethods): Deleted.
+        (window.string_appeared_here): Deleted.
+        * http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch.mp4: Removed.
+        * http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch.mp4: Removed.
+        * http/tests/media/media-source/webm/segment-info.js: Removed.
+        * platform/ios-simulator/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-expected.txt: Added.
+        * platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt: Added.
+        * platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt: Added.
+        * platform/mac/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt: Added.
+
 2016-09-08  Dean Jackson  <dino@apple.com>
 
         Expose Apple Pencil data to Touch events
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html b/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html
deleted file mode 100644 (file)
index 1ba0b97..0000000
+++ /dev/null
@@ -1,262 +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>
-    </head>
-    <body>
-        <div id="log"></div>
-        <script>
-          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.");
-              sourceBuffer.appendBuffer(mediaData);
-
-              assert_true(sourceBuffer.updating, "updating attribute is true");
-
-              test.waitForExpectedEvents(function()
-              {
-                 assert_false(sourceBuffer.updating, "updating attribute is false");
-                 test.done();
-              });
-          }, "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.");
-              sourceBuffer.appendBuffer(mediaData);
-
-              assert_true(sourceBuffer.updating, "updating attribute is true");
-
-              assert_throws("InvalidStateError",
-                  function() { sourceBuffer.appendBuffer(mediaData); },
-                  "appendBuffer() throws an exception 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.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.");
-              sourceBuffer.appendBuffer(mediaData);
-
-              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 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.");
-              sourceBuffer.appendBuffer(mediaData);
-              assert_true(sourceBuffer.updating, "updating attribute is true");
-
-              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");
-                  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");
-              });
-
-              test.waitForExpectedEvents(function()
-              {
-                  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.");
-
-          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.");
-              sourceBuffer.appendBuffer(mediaData);
-
-              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");
-
-              assert_throws("InvalidStateError",
-                  function() { sourceBuffer.appendBuffer(mediaData); },
-                  "appendBuffer() 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 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.");
-              sourceBuffer.appendBuffer(mediaData);
-
-              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 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.expectEvent(sourceBuffer, "updatestart", "Append started.");
-              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
-              sourceBuffer.appendBuffer(mediaData);
-
-              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 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.");
-              sourceBuffer.appendBuffer(mediaData);
-
-              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 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.");
-              sourceBuffer.appendBuffer(new Uint8Array(0));
-
-              assert_true(sourceBuffer.updating, "updating attribute is true");
-
-              test.waitForExpectedEvents(function()
-              {
-                  assert_false(sourceBuffer.updating, "updating attribute is false");
-                  test.done();
-              });
-          }, "Test appending an empty 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.");
-              sourceBuffer.appendBuffer(new ArrayBuffer(0));
-
-              assert_true(sourceBuffer.updating, "updating attribute is true");
-
-              test.waitForExpectedEvents(function()
-              {
-                  assert_false(sourceBuffer.updating, "updating attribute is false");
-                  test.done();
-              });
-          }, "Test appending an empty ArrayBuffer.");
-
-          mediasource_test(function(test, mediaElement, mediaSource)
-          {
-              assert_throws(new TypeError(), function() { mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE).appendBufer(null); });
-              assert_throws(new TypeError(), function() { mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE).appendBufer(undefined); });
-              assert_throws(new TypeError(), function() { mediaSource.removeSourceBuffer(null); });
-              assert_throws(new TypeError(), function() { mediaSource.removeSourceBuffer(undefined); });
-              assert_throws(new TypeError(), function() { mediaSource.addSourceBuffer(null); });
-              assert_throws(new TypeError(), function() { mediaSource.addSourceBuffer(undefined); });
-
-              test.done();
-          }, "Test passing null or undefined to some MediaSource and SourceBuffer API methods.");
-
-        </script>
-    </body>
-</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-append-stream-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-append-stream-expected.txt
deleted file mode 100644 (file)
index 65c0c69..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-PASS Test SourceBuffer.appendStream() event dispatching. 
-PASS Test SourceBuffer.appendStream() call during a pending appendStream(). 
-PASS Test SourceBuffer.abort() call during a pending appendStream(). 
-PASS Test SourceBuffer.appendStream() triggering an 'ended' to 'open' transition. 
-PASS Test MediaSource.removeSourceBuffer() call during a pending appendStream(). 
-PASS Test setting MediaSource.duration during a pending appendStream() for one of its SourceBuffers. 
-PASS Test MediaSource.endOfStream() during a pending appendStream() for one of its SourceBuffers. 
-PASS Test setting SourceBuffer.timestampOffset during a pending appendStream(). 
-PASS Test appending a Stream with maxSize equal to 0. 
-PASS Test appending a Stream with maxSize value less than the size of the XHR response. 
-PASS Test appending a Stream with maxSize value greater than the size of the XHR response. 
-PASS Test appending a Stream with an invalid maxSize. 
-
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-append-stream.html b/LayoutTests/http/tests/media/media-source/mediasource-append-stream.html
deleted file mode 100644 (file)
index 06dc91c..0000000
+++ /dev/null
@@ -1,384 +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>
-    </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 = 'stream';
-
-              assert_equals(xhr.responseType, "stream", "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>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-buffered-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-buffered-expected.txt
deleted file mode 100644 (file)
index 059b541..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-PASS Demuxed content with different lengths 
-PASS Muxed tracks with different lengths 
-PASS Demuxed content with an empty buffered range on one SourceBuffer 
-PASS Muxed content empty buffered ranges. 
-
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-closed.html b/LayoutTests/http/tests/media/media-source/mediasource-closed.html
deleted file mode 100644 (file)
index c681e26..0000000
+++ /dev/null
@@ -1,67 +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>
-    </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.duration = 10; },
-                  "Setting duration throws an exception when closed.");
-          }, "Test setting duration while closed.");
-
-        </script>
-    </body>
-</html>
diff --git a/LayoutTests/http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch.mp4 b/LayoutTests/http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch.mp4
deleted file mode 100644 (file)
index d948ad2..0000000
Binary files a/LayoutTests/http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch.mp4 and /dev/null differ
diff --git a/LayoutTests/http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch.mp4 b/LayoutTests/http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch.mp4
deleted file mode 100644 (file)
index e792ff7..0000000
Binary files a/LayoutTests/http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch.mp4 and /dev/null differ
diff --git a/LayoutTests/http/tests/media/media-source/webm/segment-info.js b/LayoutTests/http/tests/media/media-source/webm/segment-info.js
deleted file mode 100644 (file)
index c7532bb..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-var WebMSegmentInfo = {};
-
-WebMSegmentInfo.testWebM = {
-    url: '/media/resources/media-source/webm/test.webm',
-    type: 'video/webm; codecs="vp8, vorbis"',
-    duration: 6.042,
-    init: { offset: 0, size: 4357 },
-    media: [
-        {  offset: 4357, size: 11830, timecode: 0 },
-        {  offset: 16187, size: 12588, timecode: 0.385 },
-        {  offset: 28775, size: 14588, timecode: 0.779 },
-        {  offset: 43363, size: 13023, timecode: 1.174 },
-        {  offset: 56386, size: 13127, timecode: 1.592 },
-        {  offset: 69513, size: 14456, timecode: 1.987 },
-        {  offset: 83969, size: 13458, timecode: 2.381 },
-        {  offset: 97427, size: 14566, timecode: 2.776 },
-        {  offset: 111993, size: 13201, timecode: 3.171 },
-        {  offset: 125194, size: 14061, timecode: 3.566 },
-        {  offset: 139255, size: 15353, timecode: 3.96 },
-        {  offset: 154608, size: 13618, timecode: 4.378 },
-        {  offset: 168226, size: 15094, timecode: 4.773 },
-        {  offset: 183320, size: 13069, timecode: 5.168 },
-        {  offset: 196389, size: 13788, timecode: 5.563 },
-        {  offset: 210177, size: 9009, timecode: 5.957 },
-    ],
-};
index ac4132e..0f70c04 100644 (file)
@@ -1,3 +1,203 @@
+2016-09-09  Jer Noble  <jer.noble@apple.com>
+
+        [Media Source] Import updated w3c/web-platform-tests and rebaseline
+        https://bugs.webkit.org/show_bug.cgi?id=161723
+
+        Reviewed by Youenn Fablet.
+
+        * web-platform-tests/media-source/OWNERS: Added.
+        * web-platform-tests/media-source/SourceBuffer-abort-expected.txt: Added.
+        * web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt: Added.
+        * web-platform-tests/media-source/SourceBuffer-abort-readyState.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-readyState.html.
+        * web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt: Added.
+        * web-platform-tests/media-source/SourceBuffer-abort-removed.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-removed.html.
+        * web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt: Added.
+        * web-platform-tests/media-source/SourceBuffer-abort-updating.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort-updating.html.
+        * web-platform-tests/media-source/SourceBuffer-abort.html: Renamed from LayoutTests/http/tests/media/media-source/SourceBuffer-abort.html.
+        * web-platform-tests/media-source/URL-createObjectURL-expected.txt: Added.
+        * web-platform-tests/media-source/URL-createObjectURL-null-expected.txt: Added.
+        * web-platform-tests/media-source/URL-createObjectURL-null.html: Added.
+        * web-platform-tests/media-source/URL-createObjectURL-revoke-expected.txt: Added.
+        * web-platform-tests/media-source/URL-createObjectURL-revoke.html: Added.
+        * web-platform-tests/media-source/URL-createObjectURL.html: Added.
+        * web-platform-tests/media-source/import_tests.sh: Added.
+        * web-platform-tests/media-source/interfaces-expected.txt: Added.
+        * web-platform-tests/media-source/interfaces.html: Added.
+        * web-platform-tests/media-source/manifest.txt: Added.
+        * web-platform-tests/media-source/mediasource-activesourcebuffers-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-activesourcebuffers.html: Added.
+        * web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt.
+        * web-platform-tests/media-source/mediasource-addsourcebuffer-mode-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-addsourcebuffer-mode.html: Added.
+        * web-platform-tests/media-source/mediasource-addsourcebuffer.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html.
+        * web-platform-tests/media-source/mediasource-append-buffer-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt.
+        * web-platform-tests/media-source/mediasource-append-buffer.html: Added.
+        * web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded.html: Added.
+        * web-platform-tests/media-source/mediasource-appendwindow-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-appendwindow-expected.txt.
+        * web-platform-tests/media-source/mediasource-appendwindow.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-appendwindow.html.
+        * web-platform-tests/media-source/mediasource-avtracks-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-avtracks.html: Added.
+        * web-platform-tests/media-source/mediasource-buffered-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-buffered.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-buffered.html.
+        * web-platform-tests/media-source/mediasource-closed-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-closed-expected.txt.
+        * web-platform-tests/media-source/mediasource-closed.html: Added.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-a-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-v-framerate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-v-framerate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html.
+        * web-platform-tests/media-source/mediasource-config-change-webm-a-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-webm-a-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-webm-av-audio-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-webm-av-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-webm-av-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html.
+        * web-platform-tests/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-webm-av-video-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-webm-v-bitrate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-webm-v-bitrate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html.
+        * web-platform-tests/media-source/mediasource-config-change-webm-v-framerate-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-webm-v-framerate.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html.
+        * web-platform-tests/media-source/mediasource-config-change-webm-v-framesize-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt.
+        * web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html.
+        * web-platform-tests/media-source/mediasource-config-changes.js: Renamed from LayoutTests/http/tests/media/media-source/mediasource-config-changes.js.
+        (resolutionFromFilename):
+        (appendBuffer):
+        (mediaSourceConfigChangeTest):
+        * web-platform-tests/media-source/mediasource-detach-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-detach.html: Added.
+        * web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-duration-boundaryconditions.html: Added.
+        * web-platform-tests/media-source/mediasource-duration-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-duration-expected.txt.
+        * web-platform-tests/media-source/mediasource-duration.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-duration.html.
+        * web-platform-tests/media-source/mediasource-endofstream-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-endofstream-invaliderror-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-endofstream-invaliderror-expected.txt.
+        * web-platform-tests/media-source/mediasource-endofstream-invaliderror.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-endofstream-invaliderror.html.
+        * web-platform-tests/media-source/mediasource-endofstream.html: Added.
+        * web-platform-tests/media-source/mediasource-errors-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-errors.html: Added.
+        * web-platform-tests/media-source/mediasource-getvideoplaybackquality-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-getvideoplaybackquality-expected.txt.
+        * web-platform-tests/media-source/mediasource-getvideoplaybackquality.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-getvideoplaybackquality.html.
+        * web-platform-tests/media-source/mediasource-is-type-supported-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt.
+        * web-platform-tests/media-source/mediasource-is-type-supported.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-is-type-supported.html.
+        * web-platform-tests/media-source/mediasource-liveseekable-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-liveseekable.html: Added.
+        * web-platform-tests/media-source/mediasource-multiple-attach-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-multiple-attach-expected.txt.
+        * web-platform-tests/media-source/mediasource-multiple-attach.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-multiple-attach.html.
+        * web-platform-tests/media-source/mediasource-play-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play-expected.txt.
+        * web-platform-tests/media-source/mediasource-play-then-seek-back-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-expected.txt.
+        * web-platform-tests/media-source/mediasource-play-then-seek-back.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html.
+        * web-platform-tests/media-source/mediasource-play.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-play.html.
+        * web-platform-tests/media-source/mediasource-preload-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-preload.html: Added.
+        * web-platform-tests/media-source/mediasource-redundant-seek-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-redundant-seek-expected.txt.
+        * web-platform-tests/media-source/mediasource-redundant-seek.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-redundant-seek.html.
+        * web-platform-tests/media-source/mediasource-remove-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-remove-expected.txt.
+        * web-platform-tests/media-source/mediasource-remove.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-remove.html.
+        * web-platform-tests/media-source/mediasource-removesourcebuffer-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-removesourcebuffer.html: Added.
+        * web-platform-tests/media-source/mediasource-seek-beyond-duration-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-beyond-duration-expected.txt.
+        * web-platform-tests/media-source/mediasource-seek-beyond-duration.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-beyond-duration.html.
+        * web-platform-tests/media-source/mediasource-seek-during-pending-seek-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-during-pending-seek-expected.txt.
+        * web-platform-tests/media-source/mediasource-seek-during-pending-seek.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-seek-during-pending-seek.html.
+        * web-platform-tests/media-source/mediasource-seekable-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-seekable.html: Added.
+        * web-platform-tests/media-source/mediasource-sequencemode-append-buffer-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-sequencemode-append-buffer.html: Added.
+        * web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode-expected.txt.
+        * web-platform-tests/media-source/mediasource-sourcebuffer-mode.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html.
+        * web-platform-tests/media-source/mediasource-sourcebuffer-trackdefaults-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-sourcebuffer-trackdefaults.html: Added.
+        * web-platform-tests/media-source/mediasource-sourcebufferlist-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt.
+        * web-platform-tests/media-source/mediasource-sourcebufferlist.html: Renamed from LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist.html.
+        * web-platform-tests/media-source/mediasource-timestamp-offset-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-timestamp-offset.html: Added.
+        * web-platform-tests/media-source/mediasource-trackdefault-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-trackdefault.html: Added.
+        * web-platform-tests/media-source/mediasource-trackdefaultlist-expected.txt: Added.
+        * web-platform-tests/media-source/mediasource-trackdefaultlist.html: Added.
+        * web-platform-tests/media-source/mediasource-util.js: Renamed from LayoutTests/http/tests/media/media-source/mediasource-util.js.
+        (EventExpectationsManager):
+        (EventExpectationsManager.prototype.expectEvent):
+        (EventExpectationsManager.prototype.waitForExpectedEvents):
+        (EventExpectationsManager.prototype.expectingEvents):
+        (EventExpectationsManager.prototype.handleWaitCallback_):
+        (EventExpectationsManager.prototype.getExpectations_):
+        (loadData_):
+        (onSourceOpen):
+        (openMediaSource_):
+        (MediaSourceUtil.loadTextData):
+        (MediaSourceUtil.loadBinaryData):
+        (MediaSourceUtil.fetchManifestAndData):
+        (MediaSourceUtil.extractSegmentData):
+        (MediaSourceUtil.getMediaDataForPlaybackTime):
+        (getFirstSupportedType):
+        (getSegmentInfo):
+        (MediaSourceUtil.getSubType):
+        (MediaSourceUtil.append):
+        (onEvent):
+        (onAppendDone):
+        (MediaSourceUtil.appendUntilEventFires):
+        (addExtraTestMethods.test.expectEvent):
+        (addExtraTestMethods.test.waitForExpectedEvents):
+        (addExtraTestMethods.test.waitForCurrentTimeChange):
+        (addExtraTestMethods.test.done):
+        (addExtraTestMethods):
+        (window.string_appeared_here):
+        * web-platform-tests/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json.
+        * web-platform-tests/media-source/mp4/test-a-128k-44100Hz-1ch.mp4: Added.
+        * web-platform-tests/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json.
+        * web-platform-tests/media-source/mp4/test-a-192k-44100Hz-1ch.mp4: Added.
+        * web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.mp4.
+        * web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.mp4.
+        * web-platform-tests/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.mp4.
+        * web-platform-tests/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.mp4.
+        * web-platform-tests/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4.
+        * web-platform-tests/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-v-128k-320x240-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-320x240-30fps-10kfr.mp4.
+        * web-platform-tests/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-v-128k-640x480-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-128k-640x480-30fps-10kfr.mp4.
+        * web-platform-tests/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/mp4/test-v-256k-320x240-30fps-10kfr.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test-v-256k-320x240-30fps-10kfr.mp4.
+        * web-platform-tests/media-source/mp4/test.mp4: Renamed from LayoutTests/http/tests/media/media-source/mp4/test.mp4.
+        * web-platform-tests/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json.
+        * web-platform-tests/media-source/webm/test-a-128k-44100Hz-1ch.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-128k-44100Hz-1ch.webm.
+        * web-platform-tests/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json.
+        * web-platform-tests/media-source/webm/test-a-192k-44100Hz-1ch.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-a-192k-44100Hz-1ch.webm.
+        * web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm.
+        * web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.webm.
+        * web-platform-tests/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.webm.
+        * web-platform-tests/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.webm.
+        * web-platform-tests/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-v-128k-320x240-24fps-8kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-24fps-8kfr.webm.
+        * web-platform-tests/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-v-128k-320x240-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-320x240-30fps-10kfr.webm.
+        * web-platform-tests/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-v-128k-640x480-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-128k-640x480-30fps-10kfr.webm.
+        * web-platform-tests/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json.
+        * web-platform-tests/media-source/webm/test-v-256k-320x240-30fps-10kfr.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-v-256k-320x240-30fps-10kfr.webm.
+        * web-platform-tests/media-source/webm/test-vp8-vorbis-webvtt.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test-vp8-vorbis-webvtt.webm.
+        * web-platform-tests/media-source/webm/test.webm: Renamed from LayoutTests/http/tests/media/media-source/webm/test.webm.
+
 2016-09-09  Jiewen Tan  <jiewen_tan@apple.com>
 
         Rename Key to CryptoKey
index e2e0fcc..c893181 100644 (file)
@@ -230,7 +230,6 @@ web-platform-tests/infrastructure [ Skip ]
 web-platform-tests/innerText [ Skip ]
 web-platform-tests/input-events [ Skip ]
 web-platform-tests/js [ Skip ]
-web-platform-tests/media-source [ Skip ]
 web-platform-tests/mediacapture-streams [ Skip ]
 web-platform-tests/microdata [ Skip ]
 web-platform-tests/mixed-content [ Skip ]
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/OWNERS b/LayoutTests/imported/w3c/web-platform-tests/media-source/OWNERS
new file mode 100644 (file)
index 0000000..93f1b9e
--- /dev/null
@@ -0,0 +1,5 @@
+@bit
+@acolwell
+@shishimaru
+@sideshowbarker
+@wolenetz
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-expected.txt
new file mode 100644 (file)
index 0000000..fa3b6a7
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS SourceBuffer#abort() (video/webm; codecs="vorbis,vp8"): Check the values of appendWindowStart and appendWindowEnd. 
+PASS SourceBuffer#abort() (video/mp4): Check the values of appendWindowStart and appendWindowEnd. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-readyState-expected.txt
new file mode 100644 (file)
index 0000000..acb1505
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS SourceBuffer#abort() (video/webm; codecs="vorbis,vp8") : If the readyState attribute of the parent media source is not in the "open" state then throw an INVALID_STATE_ERR exception and abort these steps. 
+PASS SourceBuffer#abort() (video/mp4) : If the readyState attribute of the parent media source is not in the "open" state then throw an INVALID_STATE_ERR exception and abort these steps. 
+
@@ -3,8 +3,9 @@
 <head>
   <meta charset='utf-8'>
   <title>SourceBuffer#abort() when readyState attribute is not in the "open"</title>
-  <script src="/w3c/resources/testharness.js"></script>
-  <script src="/w3c/resources/testharnessreport.js"></script>
+  <meta name="timeout" content="long">
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
 <div id="log"></div>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed-expected.txt
new file mode 100644 (file)
index 0000000..9ede3f9
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS SourceBuffer#abort (video/webm; codecs="vorbis,vp8") : if this object has been removed from the sourceBuffers attribute of the parent media source, then throw an INVALID_STATE_ERR exception and abort these steps. 
+PASS SourceBuffer#abort (video/mp4) : if this object has been removed from the sourceBuffers attribute of the parent media source, then throw an INVALID_STATE_ERR exception and abort these steps. 
+
@@ -3,8 +3,8 @@
 <head>
   <meta charset='utf-8'>
   <title>SourceBuffer#abort() for already removed buffer from parent media source</title>
-  <script src="/w3c/resources/testharness.js"></script>
-  <script src="/w3c/resources/testharnessreport.js"></script>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
 <div id="log"></div>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-updating-expected.txt
new file mode 100644 (file)
index 0000000..bc2d647
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS SourceBuffer#abort() (video/webm; codecs="vorbis,vp8") : Check the algorithm when the updating attribute is true. 
+PASS SourceBuffer#abort() (video/mp4) : Check the algorithm when the updating attribute is true. 
+
@@ -3,8 +3,8 @@
 <head>
   <meta charset='utf-8'>
   <title>Check SourceBuffer#abort() when the updating attribute is true</title>
-  <script src="/w3c/resources/testharness.js"></script>
-  <script src="/w3c/resources/testharnessreport.js"></script>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
 <div id="log"></div>
@@ -3,8 +3,8 @@
 <head>
   <meta charset='utf-8'>
   <title>Check the values of appendWindowStart and appendWindowEnd after abort()</title>
-  <script src="/w3c/resources/testharness.js"></script>
-  <script src="/w3c/resources/testharnessreport.js"></script>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
 <div id="log"></div>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-expected.txt
new file mode 100644 (file)
index 0000000..0b2d3d0
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS URL.createObjectURL(mediaSource) should return a unique Blob URI. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-null-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-null-expected.txt
new file mode 100644 (file)
index 0000000..4a58876
--- /dev/null
@@ -0,0 +1,2 @@
+
+PASS URL.createObjectURL(null)
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-null.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-null.html
new file mode 100644 (file)
index 0000000..a4177dd
--- /dev/null
@@ -0,0 +1,19 @@
+<!doctype html>
+<html>
+<head>
+  <meta charset='utf-8'>
+  <title>URL.createObjectURL(null)</title>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+    assert_throws(new TypeError(), function() {
+        window.URL.createObjectURL(null);
+    });
+}, "URL.createObjectURL(null)");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-revoke-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-revoke-expected.txt
new file mode 100644 (file)
index 0000000..6e161b8
--- /dev/null
@@ -0,0 +1,5 @@
+
+PASS Check revoking behavior of URL.revokeObjectURL(url). 
+PASS Check referenced MediaSource can open after URL.revokeObjectURL(url). 
+PASS Check auto-revoking behavior with URL.createObjectURL(MediaSource). 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-revoke.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL-revoke.html
new file mode 100644 (file)
index 0000000..c5e18d4
--- /dev/null
@@ -0,0 +1,59 @@
+<!doctype html>
+<html>
+<head>
+  <meta charset='utf-8'>
+  <title>Revoking a created URL with URL.revokeObjectURL(url)</title>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+async_test(function(t) {
+    var mediaSource = new MediaSource();
+    var url = window.URL.createObjectURL(mediaSource);
+    window.URL.revokeObjectURL(url);
+    mediaSource.addEventListener('sourceopen',
+                                 t.unreached_func("url should not reference MediaSource."));
+    var video = document.createElement('video');
+    video.src = url;
+    video.addEventListener('error', t.step_func_done(function(e) {
+        assert_equals(e.target.error.code,
+                      MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
+                      'Expected error code');
+        assert_equals(mediaSource.readyState, 'closed');
+    }));
+}, "Check revoking behavior of URL.revokeObjectURL(url).");
+async_test(function(t) {
+    var mediaSource = new MediaSource();
+    var url = window.URL.createObjectURL(mediaSource);
+    var video = document.createElement('video');
+    var unexpectedErrorHandler = t.unreached_func("Unexpected error.")
+    video.addEventListener('error', unexpectedErrorHandler);
+    video.src = url;
+    window.URL.revokeObjectURL(url);
+    mediaSource.addEventListener('sourceopen', t.step_func_done(function(e) {
+        assert_equals(mediaSource.readyState, 'open');
+        mediaSource.endOfStream();
+        video.removeEventListener('error', unexpectedErrorHandler);
+    }));
+}, "Check referenced MediaSource can open after URL.revokeObjectURL(url).");
+async_test(function(t) {
+    var mediaSource = new MediaSource();
+    var url = window.URL.createObjectURL(mediaSource);
+    setTimeout(function() {
+        mediaSource.addEventListener('sourceopen',
+                                     t.unreached_func("url should not reference MediaSource."));
+        var video = document.createElement('video');
+        video.src = url;
+        video.addEventListener('error', t.step_func_done(function(e) {
+            assert_equals(e.target.error.code,
+                          MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
+                          'Expected error code');
+            assert_equals(mediaSource.readyState, 'closed');
+        }));
+    }, 0);
+}, "Check auto-revoking behavior with URL.createObjectURL(MediaSource).");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/URL-createObjectURL.html
new file mode 100644 (file)
index 0000000..da82806
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+<head>
+  <meta charset='utf-8'>
+  <title>URL.createObjectURL(mediaSource)</title>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+    var mediaSource = new MediaSource();
+    var url = window.URL.createObjectURL(mediaSource);
+    assert_true(url != null);
+    assert_true(url.match(/^blob:.+/) != null);
+}, "URL.createObjectURL(mediaSource) should return a unique Blob URI.");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/import_tests.sh b/LayoutTests/imported/w3c/web-platform-tests/media-source/import_tests.sh
new file mode 100755 (executable)
index 0000000..a87619c
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+if [ $# -lt 1 ]
+then
+  echo "Usage: $0 <Blink directory>"
+  exit -1
+fi
+
+BLINK_ROOT=$1
+LAYOUT_TEST_DIR=$BLINK_ROOT/LayoutTests
+HTTP_MEDIA_TEST_DIR=$LAYOUT_TEST_DIR/http/tests/media
+
+if [ ! -d "$BLINK_ROOT" ]
+then
+  echo "$BLINK_ROOT is not a directory or doesn't exist"
+  exit -1
+fi
+
+if [ ! -d "$LAYOUT_TEST_DIR" ]
+then
+  echo "$LAYOUT_TEST_DIR is not a directory or doesn't exist"
+  exit -1
+fi
+
+#rm -rf *.html *.js webm mp4 manifest.txt
+
+cp $HTTP_MEDIA_TEST_DIR/media-source/mediasource-*.html $HTTP_MEDIA_TEST_DIR/media-source/mediasource-*.js .
+cp -r $HTTP_MEDIA_TEST_DIR/resources/media-source/webm .
+cp -r $HTTP_MEDIA_TEST_DIR/resources/media-source/mp4 .
+
+# Remove Blink-specific files
+rm mediasource-gc-after-decode-error-crash.html
+
+sed -i 's/\/w3c\/resources\//\/resources\//g' *.html
+sed -i 's/\/media\/resources\/media-source\///g' *.html
+sed -i 's/\/media\/resources\/media-source\///g' *.js
+sed -i 's/\/media\/resources\/media-source\///g' webm/*
+
+
+for TEST_FILE in `ls *.html`
+do
+  if [ "$TEST_FILE" = "index.html" ]
+  then
+    continue
+  fi
+  echo -e "$TEST_FILE" >> manifest.txt
+done
+
+cp import_tests-template.txt index.html
+
+chmod -R a+r *.html *.js webm mp4 manifest.txt
+chmod a+rx webm mp4
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/interfaces-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/interfaces-expected.txt
new file mode 100644 (file)
index 0000000..a6bd542
--- /dev/null
@@ -0,0 +1,163 @@
+
+PASS URL interface: operation createObjectURL(MediaSource) 
+PASS HTMLVideoElement interface: operation getVideoPlaybackQuality() 
+PASS AudioTrack interface: attribute sourceBuffer 
+PASS VideoTrack interface: attribute sourceBuffer 
+PASS TextTrack interface: attribute sourceBuffer 
+PASS MediaSource interface: existence and properties of interface object 
+PASS MediaSource interface object length 
+PASS MediaSource interface object name 
+PASS MediaSource interface: existence and properties of interface prototype object 
+PASS MediaSource interface: existence and properties of interface prototype object's "constructor" property 
+PASS MediaSource interface: attribute sourceBuffers 
+PASS MediaSource interface: attribute activeSourceBuffers 
+PASS MediaSource interface: attribute readyState 
+PASS MediaSource interface: attribute duration 
+PASS MediaSource interface: attribute onsourceopen 
+PASS MediaSource interface: attribute onsourceended 
+PASS MediaSource interface: attribute onsourceclose 
+PASS MediaSource interface: operation addSourceBuffer(DOMString) 
+PASS MediaSource interface: operation removeSourceBuffer(SourceBuffer) 
+PASS MediaSource interface: operation endOfStream(EndOfStreamError) 
+PASS MediaSource interface: operation setLiveSeekableRange(double,double) 
+PASS MediaSource interface: operation clearLiveSeekableRange() 
+PASS MediaSource interface: operation isTypeSupported(DOMString) 
+PASS MediaSource must be primary interface of mediaSource 
+PASS Stringification of mediaSource 
+PASS MediaSource interface: mediaSource must inherit property "sourceBuffers" with the proper type (0) 
+PASS MediaSource interface: mediaSource must inherit property "activeSourceBuffers" with the proper type (1) 
+PASS MediaSource interface: mediaSource must inherit property "readyState" with the proper type (2) 
+PASS MediaSource interface: mediaSource must inherit property "duration" with the proper type (3) 
+PASS MediaSource interface: mediaSource must inherit property "onsourceopen" with the proper type (4) 
+PASS MediaSource interface: mediaSource must inherit property "onsourceended" with the proper type (5) 
+PASS MediaSource interface: mediaSource must inherit property "onsourceclose" with the proper type (6) 
+PASS MediaSource interface: mediaSource must inherit property "addSourceBuffer" with the proper type (7) 
+PASS MediaSource interface: calling addSourceBuffer(DOMString) on mediaSource with too few arguments must throw TypeError 
+PASS MediaSource interface: mediaSource must inherit property "removeSourceBuffer" with the proper type (8) 
+PASS MediaSource interface: calling removeSourceBuffer(SourceBuffer) on mediaSource with too few arguments must throw TypeError 
+PASS MediaSource interface: mediaSource must inherit property "endOfStream" with the proper type (9) 
+PASS MediaSource interface: calling endOfStream(EndOfStreamError) on mediaSource with too few arguments must throw TypeError 
+PASS MediaSource interface: mediaSource must inherit property "setLiveSeekableRange" with the proper type (10) 
+PASS MediaSource interface: calling setLiveSeekableRange(double,double) on mediaSource with too few arguments must throw TypeError 
+PASS MediaSource interface: mediaSource must inherit property "clearLiveSeekableRange" with the proper type (11) 
+PASS MediaSource interface: mediaSource must inherit property "isTypeSupported" with the proper type (12) 
+PASS MediaSource interface: calling isTypeSupported(DOMString) on mediaSource with too few arguments must throw TypeError 
+PASS EventTarget interface: mediaSource must inherit property "addEventListener" with the proper type (0) 
+PASS EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on mediaSource with too few arguments must throw TypeError 
+PASS EventTarget interface: mediaSource must inherit property "removeEventListener" with the proper type (1) 
+PASS EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on mediaSource with too few arguments must throw TypeError 
+PASS EventTarget interface: mediaSource must inherit property "dispatchEvent" with the proper type (2) 
+PASS EventTarget interface: calling dispatchEvent(Event) on mediaSource with too few arguments must throw TypeError 
+PASS SourceBuffer interface: existence and properties of interface object 
+PASS SourceBuffer interface object length 
+PASS SourceBuffer interface object name 
+PASS SourceBuffer interface: existence and properties of interface prototype object 
+PASS SourceBuffer interface: existence and properties of interface prototype object's "constructor" property 
+PASS SourceBuffer interface: attribute mode 
+PASS SourceBuffer interface: attribute updating 
+PASS SourceBuffer interface: attribute buffered 
+PASS SourceBuffer interface: attribute timestampOffset 
+PASS SourceBuffer interface: attribute audioTracks 
+PASS SourceBuffer interface: attribute videoTracks 
+PASS SourceBuffer interface: attribute textTracks 
+PASS SourceBuffer interface: attribute appendWindowStart 
+PASS SourceBuffer interface: attribute appendWindowEnd 
+PASS SourceBuffer interface: attribute onupdatestart 
+PASS SourceBuffer interface: attribute onupdate 
+PASS SourceBuffer interface: attribute onupdateend 
+PASS SourceBuffer interface: attribute onerror 
+PASS SourceBuffer interface: attribute onabort 
+PASS SourceBuffer interface: operation appendBuffer(ArrayBuffer) 
+PASS SourceBuffer interface: operation appendBuffer(ArrayBufferView) 
+PASS SourceBuffer interface: operation appendStream(ReadableStream,unsigned long long) 
+PASS SourceBuffer interface: operation abort() 
+PASS SourceBuffer interface: operation remove(double,unrestricted double) 
+PASS SourceBuffer interface: attribute trackDefaults 
+PASS SourceBuffer must be primary interface of sourceBuffer 
+PASS Stringification of sourceBuffer 
+PASS SourceBuffer interface: sourceBuffer must inherit property "mode" with the proper type (0) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "updating" with the proper type (1) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "buffered" with the proper type (2) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "timestampOffset" with the proper type (3) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "audioTracks" with the proper type (4) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "videoTracks" with the proper type (5) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "textTracks" with the proper type (6) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "appendWindowStart" with the proper type (7) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "appendWindowEnd" with the proper type (8) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "onupdatestart" with the proper type (9) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "onupdate" with the proper type (10) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "onupdateend" with the proper type (11) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "onerror" with the proper type (12) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "onabort" with the proper type (13) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "appendBuffer" with the proper type (14) 
+PASS SourceBuffer interface: calling appendBuffer(ArrayBuffer) on sourceBuffer with too few arguments must throw TypeError 
+PASS SourceBuffer interface: sourceBuffer must inherit property "appendBuffer" with the proper type (15) 
+PASS SourceBuffer interface: calling appendBuffer(ArrayBufferView) on sourceBuffer with too few arguments must throw TypeError 
+PASS SourceBuffer interface: sourceBuffer must inherit property "appendStream" with the proper type (16) 
+PASS SourceBuffer interface: calling appendStream(ReadableStream,unsigned long long) on sourceBuffer with too few arguments must throw TypeError 
+PASS SourceBuffer interface: sourceBuffer must inherit property "abort" with the proper type (17) 
+PASS SourceBuffer interface: sourceBuffer must inherit property "remove" with the proper type (18) 
+PASS SourceBuffer interface: calling remove(double,unrestricted double) on sourceBuffer with too few arguments must throw TypeError 
+PASS SourceBuffer interface: sourceBuffer must inherit property "trackDefaults" with the proper type (19) 
+PASS EventTarget interface: sourceBuffer must inherit property "addEventListener" with the proper type (0) 
+PASS EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on sourceBuffer with too few arguments must throw TypeError 
+PASS EventTarget interface: sourceBuffer must inherit property "removeEventListener" with the proper type (1) 
+PASS EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on sourceBuffer with too few arguments must throw TypeError 
+PASS EventTarget interface: sourceBuffer must inherit property "dispatchEvent" with the proper type (2) 
+PASS EventTarget interface: calling dispatchEvent(Event) on sourceBuffer with too few arguments must throw TypeError 
+PASS SourceBufferList interface: existence and properties of interface object 
+PASS SourceBufferList interface object length 
+PASS SourceBufferList interface object name 
+PASS SourceBufferList interface: existence and properties of interface prototype object 
+PASS SourceBufferList interface: existence and properties of interface prototype object's "constructor" property 
+PASS SourceBufferList interface: attribute length 
+PASS SourceBufferList interface: attribute onaddsourcebuffer 
+PASS SourceBufferList interface: attribute onremovesourcebuffer 
+PASS SourceBufferList must be primary interface of mediaSource.sourceBuffers 
+PASS Stringification of mediaSource.sourceBuffers 
+PASS SourceBufferList interface: mediaSource.sourceBuffers must inherit property "length" with the proper type (0) 
+PASS SourceBufferList interface: mediaSource.sourceBuffers must inherit property "onaddsourcebuffer" with the proper type (1) 
+PASS SourceBufferList interface: mediaSource.sourceBuffers must inherit property "onremovesourcebuffer" with the proper type (2) 
+PASS EventTarget interface: mediaSource.sourceBuffers must inherit property "addEventListener" with the proper type (0) 
+PASS EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on mediaSource.sourceBuffers with too few arguments must throw TypeError 
+PASS EventTarget interface: mediaSource.sourceBuffers must inherit property "removeEventListener" with the proper type (1) 
+PASS EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on mediaSource.sourceBuffers with too few arguments must throw TypeError 
+PASS EventTarget interface: mediaSource.sourceBuffers must inherit property "dispatchEvent" with the proper type (2) 
+PASS EventTarget interface: calling dispatchEvent(Event) on mediaSource.sourceBuffers with too few arguments must throw TypeError 
+PASS VideoPlaybackQuality interface: existence and properties of interface object 
+PASS VideoPlaybackQuality interface object length 
+PASS VideoPlaybackQuality interface object name 
+PASS VideoPlaybackQuality interface: existence and properties of interface prototype object 
+PASS VideoPlaybackQuality interface: existence and properties of interface prototype object's "constructor" property 
+PASS VideoPlaybackQuality interface: attribute creationTime 
+PASS VideoPlaybackQuality interface: attribute totalVideoFrames 
+PASS VideoPlaybackQuality interface: attribute droppedVideoFrames 
+PASS VideoPlaybackQuality interface: attribute corruptedVideoFrames 
+PASS VideoPlaybackQuality interface: attribute totalFrameDelay 
+PASS VideoPlaybackQuality must be primary interface of video.getVideoPlaybackQuality() 
+PASS Stringification of video.getVideoPlaybackQuality() 
+PASS VideoPlaybackQuality interface: video.getVideoPlaybackQuality() must inherit property "creationTime" with the proper type (0) 
+PASS VideoPlaybackQuality interface: video.getVideoPlaybackQuality() must inherit property "totalVideoFrames" with the proper type (1) 
+PASS VideoPlaybackQuality interface: video.getVideoPlaybackQuality() must inherit property "droppedVideoFrames" with the proper type (2) 
+PASS VideoPlaybackQuality interface: video.getVideoPlaybackQuality() must inherit property "corruptedVideoFrames" with the proper type (3) 
+PASS VideoPlaybackQuality interface: video.getVideoPlaybackQuality() must inherit property "totalFrameDelay" with the proper type (4) 
+PASS TrackDefault interface: existence and properties of interface object 
+PASS TrackDefault interface object length 
+PASS TrackDefault interface object name 
+PASS TrackDefault interface: existence and properties of interface prototype object 
+PASS TrackDefault interface: existence and properties of interface prototype object's "constructor" property 
+PASS TrackDefault interface: attribute type 
+PASS TrackDefault interface: attribute byteStreamTrackID 
+PASS TrackDefault interface: attribute language 
+PASS TrackDefault interface: attribute label 
+PASS TrackDefault interface: operation getKinds() 
+PASS TrackDefaultList interface: existence and properties of interface object 
+PASS TrackDefaultList interface object length 
+PASS TrackDefaultList interface object name 
+PASS TrackDefaultList interface: existence and properties of interface prototype object 
+PASS TrackDefaultList interface: existence and properties of interface prototype object's "constructor" property 
+PASS TrackDefaultList interface: attribute length 
+PASS TrackDefaultList must be primary interface of sourceBuffer.trackDefaults 
+PASS Stringification of sourceBuffer.trackDefaults 
+PASS TrackDefaultList interface: sourceBuffer.trackDefaults must inherit property "length" with the proper type (0) 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/interfaces.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/interfaces.html
new file mode 100644 (file)
index 0000000..0480944
--- /dev/null
@@ -0,0 +1,178 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Media Source Extensions IDL tests</title>
+<div id=log></div>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/resources/WebIDLParser.js></script>
+<script src=/resources/idlharness.js></script>
+<script type=text/plain class=untested>
+interface EventTarget {
+  void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
+  void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
+  boolean dispatchEvent(Event event);
+};
+interface URL {};
+interface HTMLVideoElement {};
+interface AudioTrack {};
+interface AudioTrackList {};
+interface VideoTrack {};
+interface VideoTrackList {};
+interface TextTrack {};
+interface TextTrackList {};
+interface TimeRanges {};
+typedef double DOMHighResTimeStamp;
+</script>
+<script type=text/plain>
+[Constructor]
+interface MediaSource : EventTarget {
+    readonly    attribute SourceBufferList    sourceBuffers;
+    readonly    attribute SourceBufferList    activeSourceBuffers;
+    readonly    attribute ReadyState          readyState;
+                attribute unrestricted double duration;
+                attribute EventHandler        onsourceopen;
+                attribute EventHandler        onsourceended;
+                attribute EventHandler        onsourceclose;
+    SourceBuffer   addSourceBuffer (DOMString type);
+    void           removeSourceBuffer (SourceBuffer sourceBuffer);
+    void           endOfStream (optional EndOfStreamError error);
+    void           setLiveSeekableRange (double start, double end);
+    void           clearLiveSeekableRange ();
+    static boolean isTypeSupported (DOMString type);
+};
+
+interface SourceBuffer : EventTarget {
+                attribute AppendMode          mode;
+    readonly    attribute boolean             updating;
+    readonly    attribute TimeRanges          buffered;
+                attribute double              timestampOffset;
+    readonly    attribute AudioTrackList      audioTracks;
+    readonly    attribute VideoTrackList      videoTracks;
+    readonly    attribute TextTrackList       textTracks;
+                attribute double              appendWindowStart;
+                attribute unrestricted double appendWindowEnd;
+                attribute EventHandler        onupdatestart;
+                attribute EventHandler        onupdate;
+                attribute EventHandler        onupdateend;
+                attribute EventHandler        onerror;
+                attribute EventHandler        onabort;
+    void appendBuffer (ArrayBuffer data);
+    void appendBuffer (ArrayBufferView data);
+    void appendStream (ReadableStream stream, [EnforceRange] optional unsigned long long maxSize);
+    void abort ();
+    void remove (double start, unrestricted double end);
+                    attribute TrackDefaultList    trackDefaults;
+};
+
+interface SourceBufferList : EventTarget {
+    readonly    attribute unsigned long length;
+                attribute EventHandler  onaddsourcebuffer;
+                attribute EventHandler  onremovesourcebuffer;
+    getter SourceBuffer (unsigned long index);
+};
+
+interface VideoPlaybackQuality {
+    readonly    attribute DOMHighResTimeStamp creationTime;
+    readonly    attribute unsigned long       totalVideoFrames;
+    readonly    attribute unsigned long       droppedVideoFrames;
+    readonly    attribute unsigned long       corruptedVideoFrames;
+    readonly    attribute double              totalFrameDelay;
+};
+
+[ Constructor (TrackDefaultType type, DOMString language, DOMString label, sequence<DOMString> kinds, optional DOMString byteStreamTrackID = "")]
+interface TrackDefault {
+    readonly    attribute TrackDefaultType    type;
+    readonly    attribute DOMString           byteStreamTrackID;
+    readonly    attribute DOMString           language;
+    readonly    attribute DOMString           label;
+    sequence<DOMString> getKinds ();
+};
+
+[ Constructor (optional sequence<TrackDefault> trackDefaults = [])]
+interface TrackDefaultList {
+    readonly    attribute unsigned long length;
+    getter TrackDefault (unsigned long index);
+};
+
+[Exposed=Window,DedicatedWorker,SharedWorker]
+partial interface URL {
+    static DOMString createObjectURL (MediaSource mediaSource);
+};
+
+partial interface HTMLVideoElement {
+    VideoPlaybackQuality getVideoPlaybackQuality ();
+};
+
+partial interface AudioTrack {
+    readonly    attribute SourceBuffer? sourceBuffer;
+};
+
+partial interface VideoTrack {
+    readonly    attribute SourceBuffer? sourceBuffer;
+};
+
+partial interface TextTrack {
+    readonly    attribute SourceBuffer? sourceBuffer;
+};
+
+enum EndOfStreamError {
+    "network",
+    "decode"
+};
+
+enum AppendMode {
+    "segments",
+    "sequence"
+};
+
+enum ReadyState {
+    "closed",
+    "open",
+    "ended"
+};
+
+enum TrackDefaultType {
+    "audio",
+    "video",
+    "text"
+};
+</script>
+<script>
+"use strict";
+var mediaSource;
+var sourceBuffer;
+var video = document.createElement("video");
+var idlCheck = function() {
+  var idlArray = new IdlArray();
+  [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
+    if (node.className == "untested") {
+      idlArray.add_untested_idls(node.textContent);
+    } else {
+      idlArray.add_idls(node.textContent);
+    }
+  });
+  idlArray.add_objects({
+    MediaSource: ['mediaSource'],
+    SourceBuffer: ['sourceBuffer'],
+    SourceBufferList: ['mediaSource.sourceBuffers'],
+    VideoPlaybackQuality: ['video.getVideoPlaybackQuality()'],
+    TrackDefaultList: ['sourceBuffer.trackDefaults']
+  });
+  idlArray.test();
+}
+mediaSource = new MediaSource();
+video.src = URL.createObjectURL(mediaSource);
+mediaSource.addEventListener("sourceopen", function () {
+  var defaultType ='video/webm;codecs="vp8,vorbis"';
+  if (video.canPlayType(defaultType)) {
+    sourceBuffer = mediaSource.addSourceBuffer(defaultType);
+  } else {
+    sourceBuffer = mediaSource.addSourceBuffer('video/mp4');
+  }
+  sourceBuffer.addEventListener("updateend", function (e) {
+    mediaSource.endOfStream();
+    idlCheck();
+  });
+  sourceBuffer.appendBuffer(new ArrayBuffer());
+});
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/manifest.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/manifest.txt
new file mode 100644 (file)
index 0000000..0a6e92f
--- /dev/null
@@ -0,0 +1,38 @@
+mediasource-addsourcebuffer.html
+mediasource-append-buffer.html
+mediasource-appendwindow.html
+mediasource-buffered.html
+mediasource-closed.html
+mediasource-config-change-mp4-a-bitrate.html
+mediasource-config-change-mp4-av-audio-bitrate.html
+mediasource-config-change-mp4-av-framesize.html
+mediasource-config-change-mp4-av-video-bitrate.html
+mediasource-config-change-mp4-v-bitrate.html
+mediasource-config-change-mp4-v-framerate.html
+mediasource-config-change-mp4-v-framesize.html
+mediasource-config-change-webm-a-bitrate.html
+mediasource-config-change-webm-av-audio-bitrate.html
+mediasource-config-change-webm-av-framesize.html
+mediasource-config-change-webm-av-video-bitrate.html
+mediasource-config-change-webm-v-bitrate.html
+mediasource-config-change-webm-v-framerate.html
+mediasource-config-change-webm-v-framesize.html
+mediasource-duration-boundaryconditions.html
+mediasource-duration.html
+mediasource-endofstream-invaliderror.html
+mediasource-getvideoplaybackquality.html
+mediasource-is-type-supported.html
+mediasource-liveseekable.html
+mediasource-multiple-attach.html
+mediasource-play.html
+mediasource-play-then-seek-back.html
+mediasource-preload.html
+mediasource-redundant-seek.html
+mediasource-remove.html
+mediasource-removesourcebuffer.html
+mediasource-seek-beyond-duration.html
+mediasource-seek-during-pending-seek.html
+mediasource-sequencemode-append-buffer.html
+mediasource-sourcebufferlist.html
+mediasource-sourcebuffer-mode.html
+mediasource-timestamp-offset.html
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers-expected.txt
new file mode 100644 (file)
index 0000000..c518ee5
--- /dev/null
@@ -0,0 +1,10 @@
+
+PASS SourceBuffer added to activeSourceBuffers list when its only audio track gets loaded (and thus becomes enabled). 
+PASS SourceBuffer added to activeSourceBuffers list when its only video track gets loaded (and thus becomes selected). 
+PASS Active SourceBuffers must appear in the same order as they appear in the sourceBuffers attribute: audio is first sourceBuffer, audio media appended first 
+PASS Active SourceBuffers must appear in the same order as they appear in the sourceBuffers attribute: audio is first sourceBuffer, video media appended first 
+PASS Active SourceBuffers must appear in the same order as they appear in the sourceBuffers attribute: video is first sourceBuffer, audio media appended first 
+PASS Active SourceBuffers must appear in the same order as they appear in the sourceBuffers attribute: video is first sourceBuffer, video media appended first 
+PASS Active SourceBuffers list reflects changes to selected audio/video tracks associated with separate SourceBuffers. 
+PASS Active SourceBuffers list ignores changes to selected audio/video tracks that do not affect the activation of the SourceBuffer. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers.html
new file mode 100644 (file)
index 0000000..8280736
--- /dev/null
@@ -0,0 +1,238 @@
+<!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
+<html>
+    <head>
+        <title>Checks MediaSource.activeSourceBuffers and changes to selected/enabled track state</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>
+          // Audio / Video files supported by the user agent under test
+          var subType = MediaSourceUtil.getSubType(MediaSourceUtil.AUDIO_ONLY_TYPE);
+          var manifestFilenameAudio = subType + "/test-a-128k-44100Hz-1ch-manifest.json";
+          var manifestFilenameVideo = subType + "/test-v-128k-320x240-30fps-10kfr-manifest.json";
+          var manifestFilenameAV = subType + "/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json";
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+              MediaSourceUtil.fetchManifestAndData(test, manifestFilenameAudio, function (typeAudio, dataAudio)
+              {
+                  var sourceBuffer = mediaSource.addSourceBuffer(typeAudio);
+                  assert_equals(mediaSource.sourceBuffers.length, 1,
+                    "sourceBuffers list contains one SourceBuffer");
+                  assert_equals(mediaSource.activeSourceBuffers.length, 0,
+                    "activeSourceBuffers is empty to start with");
+
+                  test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer");
+                  test.expectEvent(mediaElement, "loadedmetadata");
+                  sourceBuffer.appendBuffer(dataAudio);
+
+                  test.waitForExpectedEvents(function()
+                  {
+                      assert_equals(mediaSource.activeSourceBuffers.length, 1,
+                        "activeSourceBuffers updated when media element is loaded");
+                      assert_equals(mediaSource.activeSourceBuffers[0], sourceBuffer,
+                        "activeSourceBuffers contains sourceBuffer when media element is loaded");
+                      test.done();
+                  });
+              });
+          }, "SourceBuffer added to activeSourceBuffers list when its only audio track gets loaded (and thus becomes enabled).");
+
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+              MediaSourceUtil.fetchManifestAndData(test, manifestFilenameVideo, function (typeVideo, dataVideo)
+              {
+                  var sourceBuffer = mediaSource.addSourceBuffer(typeVideo);
+                  assert_equals(mediaSource.sourceBuffers.length, 1,
+                    "sourceBuffers list contains one SourceBuffer");
+                  assert_equals(mediaSource.activeSourceBuffers.length, 0,
+                    "activeSourceBuffers is empty to start with");
+
+                  test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer");
+                  test.expectEvent(mediaElement, "loadedmetadata");
+                  sourceBuffer.appendBuffer(dataVideo);
+
+                  test.waitForExpectedEvents(function()
+                  {
+                      assert_equals(mediaSource.activeSourceBuffers.length, 1,
+                        "activeSourceBuffers updated when media element is loaded");
+                      assert_equals(mediaSource.activeSourceBuffers[0], sourceBuffer,
+                        "activeSourceBuffers contains sourceBuffer when media element is loaded");
+                      test.done();
+                  });
+              });
+          }, "SourceBuffer added to activeSourceBuffers list when its only video track gets loaded (and thus becomes selected).");
+
+          function mediaSourceActiveSourceBufferOrderTest(addAudioFirst, appendAudioFirst)
+          {
+              mediasource_test(function(test, mediaElement, mediaSource)
+              {
+                  mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+                  MediaSourceUtil.fetchManifestAndData(test, manifestFilenameAudio, function (typeAudio, dataAudio)
+                  {
+                      MediaSourceUtil.fetchManifestAndData(test, manifestFilenameVideo, function (typeVideo, dataVideo)
+                      {
+                          var sourceBufferAudio, sourceBufferVideo, expectedFirstSB, expectedSecondSB;
+                          if (addAudioFirst) {
+                              expectedFirstSB = sourceBufferAudio = mediaSource.addSourceBuffer(typeAudio);
+                              expectedSecondSB = sourceBufferVideo = mediaSource.addSourceBuffer(typeVideo);
+                          } else {
+                              expectedFirstSB = sourceBufferVideo = mediaSource.addSourceBuffer(typeVideo);
+                              expectedSecondSB = sourceBufferAudio = mediaSource.addSourceBuffer(typeAudio);
+                          }
+
+                          assert_equals(mediaSource.activeSourceBuffers.length, 0,
+                            "activeSourceBuffers is empty to start with");
+                          assert_equals(mediaSource.sourceBuffers.length, 2,
+                            "sourceBuffers list contains both SourceBuffers");
+                          assert_equals(mediaSource.sourceBuffers[0], expectedFirstSB,
+                            "first SourceBuffer matches expectation");
+                          assert_equals(mediaSource.sourceBuffers[1], expectedSecondSB,
+                            "second SourceBuffer matches expectation");
+                          test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer");
+                          test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer");
+                          test.expectEvent(mediaElement, "loadedmetadata");
+                          if (appendAudioFirst) {
+                              sourceBufferAudio.appendBuffer(dataAudio);
+                              sourceBufferVideo.appendBuffer(dataVideo);
+                          } else {
+                              sourceBufferVideo.appendBuffer(dataVideo);
+                              sourceBufferAudio.appendBuffer(dataAudio);
+                          }
+
+                          test.waitForExpectedEvents(function()
+                          {
+                              assert_equals(mediaSource.activeSourceBuffers.length, 2,
+                                "activeSourceBuffers list updated when tracks are loaded");
+                              assert_equals(mediaSource.activeSourceBuffers[0], mediaSource.sourceBuffers[0],
+                                "first active SourceBuffer matches first SourceBuffer");
+                              assert_equals(mediaSource.activeSourceBuffers[1], mediaSource.sourceBuffers[1],
+                                "second active SourceBuffer matches second SourceBuffer");
+                              test.done();
+                          });
+                      });
+                  });
+              },
+              "Active SourceBuffers must appear in the same order as they appear in the sourceBuffers attribute: " +
+                (addAudioFirst ? "audio is first sourceBuffer" : "video is first sourceBuffer") + ", " +
+                (appendAudioFirst ? "audio media appended first" : "video media appended first"));
+          }
+
+          mediaSourceActiveSourceBufferOrderTest(true, true);
+          mediaSourceActiveSourceBufferOrderTest(true, false);
+          mediaSourceActiveSourceBufferOrderTest(false, true);
+          mediaSourceActiveSourceBufferOrderTest(false, false);
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+              MediaSourceUtil.fetchManifestAndData(test, manifestFilenameAudio, function (typeAudio, dataAudio)
+              {
+                  MediaSourceUtil.fetchManifestAndData(test, manifestFilenameVideo, function (typeVideo, dataVideo)
+                  {
+                      var sourceBufferAudio = mediaSource.addSourceBuffer(typeAudio);
+                      var sourceBufferVideo = mediaSource.addSourceBuffer(typeVideo);
+
+                      test.expectEvent(sourceBufferAudio.audioTracks, "addtrack");
+                      test.expectEvent(sourceBufferVideo.videoTracks, "addtrack");
+                      sourceBufferAudio.appendBuffer(dataAudio);
+                      sourceBufferVideo.appendBuffer(dataVideo);
+
+                      test.waitForExpectedEvents(function()
+                      {
+                          assert_equals(mediaSource.activeSourceBuffers.length, 2,
+                            "activeSourceBuffers list updated when tracks are loaded");
+                          assert_equals(sourceBufferAudio.audioTracks.length, 1,
+                            "audio track list contains loaded audio track");
+                          assert_equals(sourceBufferVideo.videoTracks.length, 1,
+                            "video track list contains loaded video track");
+
+                          test.expectEvent(mediaSource.activeSourceBuffers, "removesourcebuffer");
+                          sourceBufferAudio.audioTracks[0].enabled = false;
+                      });
+
+                      test.waitForExpectedEvents(function()
+                      {
+                          assert_equals(mediaSource.activeSourceBuffers.length, 1,
+                            "audio source buffer no longer in the activeSourceBuffers list");
+                          assert_equals(mediaSource.activeSourceBuffers[0], sourceBufferVideo,
+                            "activeSourceBuffers list only contains the video SourceBuffer");
+
+                          test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer");
+                          test.expectEvent(mediaSource.activeSourceBuffers, "removesourcebuffer");
+                          sourceBufferAudio.audioTracks[0].enabled = true;
+                          sourceBufferVideo.videoTracks[0].selected = false;
+                      });
+
+                      test.waitForExpectedEvents(function()
+                      {
+                          assert_equals(mediaSource.activeSourceBuffers.length, 1,
+                            "video source buffer no longer in the activeSourceBuffers list");
+                          assert_equals(mediaSource.activeSourceBuffers[0], sourceBufferAudio,
+                            "activeSourceBuffers list only contains the audio SourceBuffer");
+                          test.done();
+                      });
+                  });
+              });
+          }, "Active SourceBuffers list reflects changes to selected audio/video tracks associated with separate SourceBuffers.");
+
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+              MediaSourceUtil.fetchManifestAndData(test, manifestFilenameAV, function (typeAV, dataAV)
+              {
+                  var sourceBuffer = mediaSource.addSourceBuffer(typeAV);
+
+                  test.expectEvent(sourceBuffer.audioTracks, "addtrack");
+                  test.expectEvent(sourceBuffer.videoTracks, "addtrack");
+                  sourceBuffer.appendBuffer(dataAV);
+
+                  test.waitForExpectedEvents(function()
+                  {
+                      assert_equals(mediaSource.activeSourceBuffers.length, 1,
+                        "activeSourceBuffers list updated when tracks are loaded");
+                      assert_equals(sourceBuffer.audioTracks.length, 1,
+                        "audio track list contains loaded audio track");
+                      assert_equals(sourceBuffer.videoTracks.length, 1,
+                        "video track list contains loaded video track");
+
+                      mediaSource.activeSourceBuffers.addEventListener("removesourcebuffer", test.unreached_func(
+                        "Unexpected removal from activeSourceBuffers list"));
+                      mediaSource.activeSourceBuffers.addEventListener("addsourcebuffer", test.unreached_func(
+                        "Unexpected insertion in activeSourceBuffers list"));
+
+                      // Changes should only trigger events at the
+                      // AudioTrack/VideoTrack instance
+                      test.expectEvent(sourceBuffer.audioTracks, "change");
+                      sourceBuffer.audioTracks[0].enabled = false;
+                  });
+
+                  test.waitForExpectedEvents(function()
+                  {
+                      assert_equals(mediaSource.activeSourceBuffers.length, 1,
+                        "activeSourceBuffers list unchanged");
+
+                      test.expectEvent(sourceBuffer.videoTracks, "change");
+                      sourceBuffer.audioTracks[0].enabled = true;
+                      sourceBuffer.videoTracks[0].selected = false;
+                  });
+
+                  test.waitForExpectedEvents(function()
+                  {
+                      assert_equals(mediaSource.activeSourceBuffers.length, 1,
+                        "activeSourceBuffers list unchanged");
+                      test.done();
+                  });
+              });
+          }, "Active SourceBuffers list ignores changes to selected audio/video tracks " +
+            "that do not affect the activation of the SourceBuffer.");
+        </script>
+    </body>
+</html>
@@ -1,8 +1,13 @@
+
+PASS Test addSourceBuffer() in 'ended' state. 
 PASS Test addSourceBuffer() with empty type 
+PASS Test addSourceBuffer() with null 
 PASS Test addSourceBuffer() with unsupported type 
 PASS Test addSourceBuffer() with Vorbis and VP8 
 PASS Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers 
+PASS Test addSourceBuffer() video only 
+PASS Test addSourceBuffer() audio only 
 PASS Test addSourceBuffer() with AAC and H.264 
 PASS Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers 
+PASS Test addSourceBuffer() QuotaExceededError. 
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-mode-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-mode-expected.txt
new file mode 100644 (file)
index 0000000..a880ba7
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS addSourceBuffer() sets SourceBuffer.mode to 'segments' when the generate timestamps flag is false 
+PASS addSourceBuffer() sets SourceBuffer.mode to 'sequence' when the generate timestamps flag is true 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-mode.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-mode.html
new file mode 100644 (file)
index 0000000..cf7f57f
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Checks MediaSource.addSourceBuffer() sets SourceBuffer.mode appropriately</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="mediasource-util.js"></script>
+<script>
+    mediasource_test(function(test, mediaElement, mediaSource)
+    {
+        // Note all mime types in mediasource-util.js
+        // set the "generate timestamps flag" to false
+        var mime = MediaSourceUtil.VIDEO_ONLY_TYPE;
+        var sourceBuffer = mediaSource.addSourceBuffer(mime);
+        assert_equals(sourceBuffer.mode, "segments");
+        test.done();
+    }, "addSourceBuffer() sets SourceBuffer.mode to 'segments' when the generate timestamps flag is false");
+
+    mediasource_test(function(test, mediaElement, mediaSource)
+    {
+        var mime = 'audio/aac';
+        if (!MediaSource.isTypeSupported(mime)) {
+            mime = 'audio/mpeg';
+            if (!MediaSource.isTypeSupported(mime)) {
+                assert_unreached("Browser does not support the audio/aac and audio/mpeg MIME types used in this test");
+            }
+        }
+        sourceBuffer = mediaSource.addSourceBuffer(mime);
+        assert_equals(sourceBuffer.mode, "sequence");
+        test.done();
+    }, "addSourceBuffer() sets SourceBuffer.mode to 'sequence' when the generate timestamps flag is true");
+</script>
\ No newline at end of file
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MediaSource.addSourceBuffer() test cases</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
     </head>
     <body>
         <script>
           mediasource_test(function(test, mediaElement, mediaSource)
           {
+              mediaSource.endOfStream();
+              assert_throws("InvalidStateError",
+                          function() { mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); },
+                          "addSourceBuffer() threw an exception when in 'ended' state.");
+              test.done();
+          }, "Test addSourceBuffer() in 'ended' state.");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
               assert_throws(new TypeError(),
                           function() { mediaSource.addSourceBuffer(""); },
                           "addSourceBuffer() threw an exception when passed an empty string.");
           mediasource_test(function(test, mediaElement, mediaSource)
           {
               assert_throws("NotSupportedError",
+                          function() { mediaSource.addSourceBuffer(null); },
+                          "addSourceBuffer() threw an exception when passed null.");
+              test.done();
+          }, "Test addSourceBuffer() with null");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              assert_throws("NotSupportedError",
                           function() { mediaSource.addSourceBuffer("invalidType"); },
                           "addSourceBuffer() threw an exception for an unsupported type.");
               test.done();
 
           mediasource_test(function(test, mediaElement, mediaSource)
           {
+              var mimetype = MediaSourceUtil.VIDEO_ONLY_TYPE;
+
+              assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is supported");
+
+              var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
+              assert_true(sourceBuffer != null, "New SourceBuffer returned");
+              assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceBuffer is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBuffer is in mediaSource.activeSourceBuffers");
+              test.done();
+          }, "Test addSourceBuffer() video only");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var mimetype = MediaSourceUtil.AUDIO_ONLY_TYPE;
+
+              assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is supported");
+
+              var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
+              assert_true(sourceBuffer != null, "New SourceBuffer returned");
+              assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceBuffer is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBuffer is in mediaSource.activeSourceBuffers");
+              test.done();
+          }, "Test addSourceBuffer() audio only");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
               var mimetype = 'video/mp4;codecs="avc1.4D4001,mp4a.40.2"';
 
               assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is supported");
               assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBufferB is not in mediaSource.activeSourceBuffers");
               test.done();
           }, "Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var reachedLimit = false;
+
+             // The 20 here is an arbitrary upper limit to make sure the test terminates. This test
+             // assumes that implementations won't support more than 20 SourceBuffers simultaneously.
+             for (var i = 0; i < 20; ++i) {
+                 try {
+                     mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE);
+                 } catch(e) {
+                     assert_equals(e.name, "QuotaExceededError");
+                     reachedLimit = true;
+                     break;
+                 }
+             }
+             assert_true(reachedLimit, "Reached SourceBuffer limit.");
+             test.done();
+          }, "Test addSourceBuffer() QuotaExceededError.");
+
         </script>
     </body>
 </html>
@@ -1,13 +1,23 @@
+
 PASS Test SourceBuffer.appendBuffer() event dispatching. 
 PASS Test SourceBuffer.appendBuffer() call during a pending appendBuffer(). 
 PASS Test SourceBuffer.abort() call during a pending appendBuffer(). 
 PASS Test SourceBuffer.appendBuffer() triggering an 'ended' to 'open' transition. 
+PASS Test zero byte SourceBuffer.appendBuffer() call triggering an 'ended' to 'open' transition. 
 PASS Test MediaSource.removeSourceBuffer() call during a pending appendBuffer(). 
 PASS Test set MediaSource.duration during a pending appendBuffer() for one of its SourceBuffers. 
 PASS Test MediaSource.endOfStream() during a pending appendBuffer() for one of its SourceBuffers. 
 PASS Test set SourceBuffer.timestampOffset during a pending appendBuffer(). 
 PASS Test appending an empty ArrayBufferView. 
+PASS Test appending a neutered ArrayBufferView. 
 PASS Test appending an empty ArrayBuffer. 
-PASS Test passing null or undefined to some MediaSource and SourceBuffer API methods. 
+PASS Test appending a neutered ArrayBuffer. 
+PASS Test appendBuffer with partial init segments. 
+PASS Test appendBuffer with partial media segments. 
+PASS Test abort in the middle of an initialization segment. 
+PASS Test abort after removing sourcebuffer. 
+PASS Test abort after readyState is ended following init segment and media segment. 
+PASS Test abort after appendBuffer update ends. 
+PASS Test appending null. 
+PASS Test appending after removeSourceBuffer(). 
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-append-buffer.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-append-buffer.html
new file mode 100644 (file)
index 0000000..cd8d827
--- /dev/null
@@ -0,0 +1,539 @@
+<!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
+<html>
+    <head>
+        <title>SourceBuffer.appendBuffer() 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)
+          {
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+              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");
+
+              test.waitForExpectedEvents(function()
+              {
+                 assert_false(sourceBuffer.updating, "updating attribute is false");
+                 test.done();
+              });
+          }, "Test SourceBuffer.appendBuffer() event dispatching.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+              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_throws("InvalidStateError",
+                  function() { sourceBuffer.appendBuffer(mediaData); },
+                  "appendBuffer() throws an exception 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.appendBuffer() call during a pending appendBuffer().");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+              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");
+
+              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 appendBuffer().");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+              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");
+
+              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");
+                  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");
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  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.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              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");
+
+              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");
+                  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");
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  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.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+              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_equals(mediaSource.activeSourceBuffers.length, 0, "activeSourceBuffers.length");
+
+              test.expectEvent(mediaSource.sourceBuffers, "removesourcebuffer", "sourceBuffers");
+              mediaSource.removeSourceBuffer(sourceBuffer);
+
+              assert_false(sourceBuffer.updating, "updating attribute is false");
+
+              assert_throws("InvalidStateError",
+                  function() { sourceBuffer.appendBuffer(mediaData); },
+                  "appendBuffer() 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 appendBuffer().");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              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 set MediaSource.duration during a pending appendBuffer() for one of its SourceBuffers.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+              mediaSource.addEventListener("sourceended", test.unreached_func("Unexpected event 'sourceended'"));
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              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 appendBuffer() for one of its SourceBuffers.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              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 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.");
+              sourceBuffer.appendBuffer(new Uint8Array(0));
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test appending an empty ArrayBufferView.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              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.");
+
+              // Send the buffer as in a message so it gets neutered.
+              window.postMessage( "test", "*", [arrayBufferView.buffer]);
+
+              assert_equals(arrayBufferView.length, 0, "arrayBufferView.length after transfer.");
+
+              sourceBuffer.appendBuffer(arrayBufferView);
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                 assert_false(sourceBuffer.updating, "updating attribute is false");
+                 test.done();
+              });
+          }, "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.");
+              sourceBuffer.appendBuffer(new ArrayBuffer(0));
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test appending an empty ArrayBuffer.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "update", "Append success.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+
+              var arrayBuffer = mediaData.buffer.slice(0);
+
+              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]);
+
+              assert_equals(arrayBuffer.byteLength, 0, "arrayBuffer.byteLength after transfer.");
+
+              sourceBuffer.appendBuffer(arrayBuffer);
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                 assert_false(sourceBuffer.updating, "updating attribute is false");
+                 test.done();
+              });
+          }, "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]);
+
+              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);
+                  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.duration);
+                  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_equals(mediaSource.readyState, "open");
+                  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.duration);
+                  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.");
+                  sourceBuffer.appendBuffer(remainingMediaSegment);
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_greater_than_equal(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA);
+                  assert_equals(mediaSource.readyState, "open");
+                  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.");
+              sourceBuffer.appendBuffer(partialInitSegment);
+
+              test.waitForExpectedEvents(function()
+              {
+                  // Call abort to reset the parser.
+                  sourceBuffer.abort();
+
+                  // Append the full intiialization segment.
+                  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.");
+                  sourceBuffer.appendBuffer(mediaSegment);
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  test.done();
+              });
+          }, "Test abort in the middle of an initialization 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 after removing sourcebuffer.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+              var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
+
+              test.expectEvent(sourceBuffer, "updateend", "initSegment append ended.");
+              sourceBuffer.appendBuffer(initSegment);
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(mediaSource.readyState, "open", "readyState is open after init segment appended.");
+                  test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended.");
+                  sourceBuffer.appendBuffer(mediaSegment);
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(sourceBuffer.buffered.length, 1, "sourceBuffer has a buffered range");
+                  assert_equals(mediaSource.readyState, "open", "readyState is open after media segment appended.");
+                  test.expectEvent(mediaSource, "sourceended", "source ended");
+                  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 following init segment and media segment.");
+
+          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.");
+
+              assert_throws( { name: "TypeError"} ,
+                  function() { sourceBuffer.appendBuffer(null); },
+                  "appendBuffer(null) throws an exception.");
+              test.done();
+          }, "Test appending null.");
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              mediaSource.removeSourceBuffer(sourceBuffer);
+
+              assert_throws( { name: "InvalidStateError"} ,
+                  function() { sourceBuffer.appendBuffer(mediaData); },
+                  "appendBuffer() throws an exception when called after removeSourceBuffer().");
+              test.done();
+          }, "Test appending after removeSourceBuffer().");
+
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded-expected.txt
new file mode 100644 (file)
index 0000000..4a82f97
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Appending data repeatedly should fill up the buffer and throw a QuotaExceededError when buffer is full. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded.html
new file mode 100644 (file)
index 0000000..8c4a237
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="mediasource-util.js"></script>
+<script>
+    // Fill up a given SourceBuffer by appending data repeatedly via doAppendDataFunc until
+    // an exception is thrown. The thrown exception is passed to onCaughtExceptionCallback.
+    function fillUpSourceBuffer(test, sourceBuffer, doAppendDataFunc, onCaughtExceptionCallback) {
+        // We are appending data repeatedly in sequence mode, there should be no gaps.
+        assert_false(sourceBuffer.buffered.length > 1, "unexpected gap in buffered ranges.");
+        try {
+            doAppendDataFunc();
+        } catch(ex) {
+            onCaughtExceptionCallback(ex);
+        }
+        test.expectEvent(sourceBuffer, 'updateend', 'append ended.');
+        test.waitForExpectedEvents(function() { fillUpSourceBuffer(test, sourceBuffer, doAppendDataFunc, onCaughtExceptionCallback); });
+    }
+
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        sourceBuffer.mode = 'sequence';
+        fillUpSourceBuffer(test, sourceBuffer,
+            function () { // doAppendDataFunc
+                sourceBuffer.appendBuffer(mediaData);
+            },
+            function (ex) { // onCaughtExceptionCallback
+                assert_equals(ex.name, 'QuotaExceededError');
+                test.done();
+            });
+    }, 'Appending data repeatedly should fill up the buffer and throw a QuotaExceededError when buffer is full.');
+</script>
@@ -1,7 +1,9 @@
+
 PASS Test correctly reset appendWindowStart and appendWindowEnd values 
 PASS Test set wrong values to appendWindowStart and appendWindowEnd. 
+PASS Test set correct values to appendWindowStart and appendWindowEnd. 
 PASS Test appendwindow throw error when mediasource object is not associated with a sourebuffer. 
 PASS Test set appendWindowStart and appendWindowEnd when source buffer updating. 
 PASS Test appendWindowStart and appendWindowEnd value after a sourceBuffer.abort(). 
+PASS Test read appendWindowStart and appendWindowEnd initial values. 
 
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>SourceBuffer.appendWindowStart and SourceBuffer.appendWindowEnd test cases.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
     </head>
     <body>
                   function() { sourceBuffer.appendWindowStart = Number.NaN; },
                   "set appendWindowStart throws an exception for Number.NaN.");
 
-              assert_throws("InvalidAccessError",
+              assert_throws(new TypeError(),
                   function() { sourceBuffer.appendWindowStart = 600.0; },
                   "set appendWindowStart throws an exception when greater than appendWindowEnd.");
 
-              assert_throws("InvalidAccessError",
+              assert_throws(new TypeError(),
+                  function() { sourceBuffer.appendWindowStart = sourceBuffer.appendWindowEnd; },
+                  "set appendWindowStart throws an exception when equal to appendWindowEnd.");
+
+              assert_throws(new TypeError(),
+                  function() { sourceBuffer.appendWindowEnd = sourceBuffer.appendWindowStart; },
+                  "set appendWindowEnd throws an exception when equal to appendWindowStart.");
+
+              assert_throws(new TypeError(),
+                  function() { sourceBuffer.appendWindowEnd = sourceBuffer.appendWindowStart - 1; },
+                  "set appendWindowEnd throws an exception if less than appendWindowStart.");
+
+              assert_throws(new TypeError(),
                   function() { sourceBuffer.appendWindowStart = -100.0; },
                   "set appendWindowStart throws an exception when less than 0.");
 
-              assert_throws("InvalidAccessError",
+              assert_throws(new TypeError(),
+                  function() { sourceBuffer.appendWindowEnd = -100.0; },
+                  "set appendWindowEnd throws an exception when less than 0.");
+
+              assert_throws(new TypeError(),
                   function() { sourceBuffer.appendWindowEnd = Number.NaN; },
                   "set appendWindowEnd throws an exception if NaN.");
+
+              assert_throws(new TypeError(),
+                  function() { sourceBuffer.appendWindowEnd = undefined; },
+                  "set appendWindowEnd throws an exception if undefined.");
+
+              assert_throws({name: "TypeError"},
+                  function() { sourceBuffer.appendWindowStart = undefined; },
+                  "set appendWindowStart throws an exception if undefined.");
+
               test.done();
           }, "Test set wrong values to appendWindowStart and appendWindowEnd.");
 
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE);
+              assert_true(sourceBuffer != null, "New SourceBuffer returned");
+
+              sourceBuffer.appendWindowStart = "";
+              assert_true(sourceBuffer.appendWindowStart == 0, "appendWindowStart is 0");
+
+              sourceBuffer.appendWindowStart = "10";
+              assert_true(sourceBuffer.appendWindowStart == 10, "appendWindowStart is 10");
+
+              sourceBuffer.appendWindowStart = null;
+              assert_true(sourceBuffer.appendWindowStart == 0, "appendWindowStart is 0");
+
+              sourceBuffer.appendWindowStart = true;
+              assert_true(sourceBuffer.appendWindowStart == 1, "appendWindowStart is 1");
+
+              sourceBuffer.appendWindowStart = false;
+              assert_true(sourceBuffer.appendWindowStart == 0, "appendWindowStart is 0");
+
+              sourceBuffer.appendWindowEnd = "100";
+              assert_true(sourceBuffer.appendWindowEnd == 100, "appendWindowEnd is 100");
+
+              test.done();
+
+          }, "Test set correct values to appendWindowStart and appendWindowEnd.");
+
           mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
           {
               mediaSource.removeSourceBuffer(sourceBuffer);
 
               sourceBuffer.abort();
               assert_equals(sourceBuffer.appendWindowStart, 0, "appendWindowStart is 0 after an abort'");
-              assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY, 
+              assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY,
                             "appendWindowStart is POSITIVE_INFINITY after an abort");
               test.waitForExpectedEvents(function()
               {
               });
           }, "Test appendWindowStart and appendWindowEnd value after a sourceBuffer.abort().");
 
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+               assert_equals(sourceBuffer.appendWindowStart, 0, "appendWindowStart is 0 initially");
+               assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY,
+                            "appendWindowStart is POSITIVE_INFINITY initially");
+               test.done();
+          }, "Test read appendWindowStart and appendWindowEnd initial values.");
+
        </script>
     </body>
 </html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-avtracks.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-avtracks.html
new file mode 100644 (file)
index 0000000..26ae5bc
--- /dev/null
@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="mediasource-util.js"></script>
+<script>
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+        sourceBuffer.appendBuffer(initSegment);
+        test.expectEvent(sourceBuffer.audioTracks, "addtrack", "sourceBuffer.audioTracks addtrack event");
+        test.expectEvent(sourceBuffer.videoTracks, "addtrack", "sourceBuffer.videoTracks addtrack event");
+        test.expectEvent(mediaElement.audioTracks, "addtrack", "mediaElement.audioTracks addtrack event");
+        test.expectEvent(mediaElement.videoTracks, "addtrack", "mediaElement.videoTracks addtrack event");
+        test.expectEvent(mediaElement, "loadedmetadata", "loadedmetadata done.");
+        test.expectEvent(sourceBuffer, "updateend", "initSegment append ended.");
+        test.waitForExpectedEvents(function()
+        {
+            assert_equals(sourceBuffer.videoTracks.length, 1, "videoTracks.length");
+            assert_equals(sourceBuffer.videoTracks[0].kind, "main", "videoTrack.kind");
+            assert_equals(sourceBuffer.videoTracks[0].label, "", "videoTrack.label");
+            assert_equals(sourceBuffer.videoTracks[0].language, "eng", "videoTrack.language");
+            assert_equals(sourceBuffer.videoTracks[0].sourceBuffer, sourceBuffer, "videoTrack.sourceBuffer");
+            // The first video track is selected by default.
+            assert_true(sourceBuffer.videoTracks[0].selected, "sourceBuffer.videoTracks[0].selected");
+
+            assert_equals(sourceBuffer.audioTracks.length, 1, "audioTracks.length");
+            assert_equals(sourceBuffer.audioTracks[0].kind, "main", "audioTrack.kind");
+            assert_equals(sourceBuffer.audioTracks[0].label, "", "audioTrack.label");
+            assert_equals(sourceBuffer.audioTracks[0].language, "eng", "audioTrack.language");
+            assert_equals(sourceBuffer.audioTracks[0].sourceBuffer, sourceBuffer, "audioTrack.sourceBuffer");
+            // The first audio track is enabled by default.
+            assert_true(sourceBuffer.audioTracks[0].enabled, "sourceBuffer.audioTracks[0].enabled");
+
+            assert_not_equals(sourceBuffer.audioTracks[0].id, sourceBuffer.videoTracks[0].id, "track ids must be unique");
+
+            assert_equals(mediaElement.videoTracks.length, 1, "videoTracks.length");
+            assert_equals(mediaElement.videoTracks[0], sourceBuffer.videoTracks[0], "mediaElement.videoTrack == sourceBuffer.videoTrack");
+
+            assert_equals(mediaElement.audioTracks.length, 1, "audioTracks.length");
+            assert_equals(mediaElement.audioTracks[0], sourceBuffer.audioTracks[0], "mediaElement.audioTrack == sourceBuffer.audioTrack");
+
+            test.done();
+        });
+    }, "Check that media tracks and their properties are populated properly");
+
+    function verifyTrackRemoval(test, mediaElement, mediaSource, sourceBuffer, trackRemovalAction, successCallback) {
+        assert_equals(sourceBuffer.audioTracks.length, 1, "audioTracks.length");
+        assert_true(sourceBuffer.audioTracks[0].enabled, "sourceBuffer.audioTracks[0].enabled");
+        assert_equals(sourceBuffer.videoTracks.length, 1, "videoTracks.length");
+        assert_true(sourceBuffer.videoTracks[0].selected, "sourceBuffer.videoTracks[0].selected");
+
+        var audioTrack = sourceBuffer.audioTracks[0];
+        var videoTrack = sourceBuffer.videoTracks[0];
+
+        // Verify removetrack events.
+        test.expectEvent(sourceBuffer.audioTracks, "removetrack", "sourceBuffer.audioTracks removetrack event");
+        test.expectEvent(sourceBuffer.videoTracks, "removetrack", "sourceBuffer.videoTracks removetrack event");
+        test.expectEvent(mediaElement.audioTracks, "removetrack", "mediaElement.audioTracks removetrack event");
+        test.expectEvent(mediaElement.videoTracks, "removetrack", "mediaElement.videoTracks removetrack event");
+
+        // Removing enabled audio track and selected video track should fire "change" events on mediaElement track lists.
+        test.expectEvent(mediaElement.audioTracks, "change", "mediaElement.audioTracks changed.");
+        test.expectEvent(mediaElement.videoTracks, "change", "mediaElement.videoTracks changed.");
+
+        trackRemovalAction();
+
+        test.waitForExpectedEvents(function()
+        {
+            assert_equals(mediaSource.sourceBuffers.length, 0, "mediaSource.sourceBuffers.length");
+            assert_equals(mediaElement.videoTracks.length, 0, "videoTracks.length");
+            assert_equals(mediaElement.audioTracks.length, 0, "audioTracks.length");
+            assert_equals(sourceBuffer.videoTracks.length, 0, "videoTracks.length");
+            assert_equals(sourceBuffer.audioTracks.length, 0, "audioTracks.length");
+            // Since audio and video tracks have been removed, their .sourceBuffer property should be null now.
+            assert_equals(audioTrack.sourceBuffer, null, "audioTrack.sourceBuffer");
+            assert_equals(videoTrack.sourceBuffer, null, "videoTrack.sourceBuffer");
+            test.done();
+        });
+    }
+
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+        sourceBuffer.appendBuffer(initSegment);
+        test.expectEvent(sourceBuffer, "updateend", "initSegment append ended.");
+        test.waitForExpectedEvents(function()
+        {
+            verifyTrackRemoval(test, mediaElement, mediaSource, sourceBuffer, test.step_func(function ()
+            {
+                mediaSource.removeSourceBuffer(sourceBuffer);
+            }));
+        });
+    }, "Media tracks must be removed when the SourceBuffer is removed from the MediaSource");
+
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+        sourceBuffer.appendBuffer(initSegment);
+        test.expectEvent(sourceBuffer, "updateend", "initSegment append ended.");
+        test.waitForExpectedEvents(function()
+        {
+            verifyTrackRemoval(test, mediaElement, mediaSource, sourceBuffer, test.step_func(function ()
+            {
+                mediaElement.src = "";
+            }));
+        });
+    }, "Media tracks must be removed when the HTMLMediaElement.src is changed");
+
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+        sourceBuffer.appendBuffer(initSegment);
+        test.expectEvent(sourceBuffer, "updateend", "initSegment append ended.");
+        test.waitForExpectedEvents(function()
+        {
+            verifyTrackRemoval(test, mediaElement, mediaSource, sourceBuffer, test.step_func(function ()
+            {
+                mediaElement.load();
+            }));
+        });
+    }, "Media tracks must be removed when HTMLMediaElement.load() is called");
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-buffered-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-buffered-expected.txt
new file mode 100644 (file)
index 0000000..59d8eac
--- /dev/null
@@ -0,0 +1,9 @@
+
+PASS Demuxed content with different lengths 
+PASS Muxed content with different lengths 
+PASS Demuxed content with an empty buffered range on one SourceBuffer 
+PASS Muxed content empty buffered ranges. 
+PASS Get buffered range when sourcebuffer is empty. 
+PASS Get buffered range when only init segment is appended. 
+PASS Get buffered range after removing sourcebuffer. 
+
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>SourceBuffer.buffered test cases.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
     </head>
     <body>
             var manifestFilenameA = subType + "/test-a-128k-44100Hz-1ch-manifest.json";
             var manifestFilenameB = subType + "/test-v-128k-320x240-30fps-10kfr-manifest.json";
 
+            // Audio track expectations
             var expectationsA = {
-              webm: "{ [0.000, 2.022) }",
+              webm: "{ [0.000, 2.023) }",
               mp4: "{ [0.000, 2.043) }",
             };
 
+            // Video track expectations
             var expectationsB = {
-              webm: "{ [0.000, 2.000) }",
-              mp4: "{ [0.000, 2.000) }",
+              webm: "{ [0.000, 2.001) }",
+              mp4: "{ [0.067, 2.067) }",
+            };
+
+            // Audio and Video intersection expectations.
+            // https://w3c.github.io/media-source/index.html#dom-sourcebuffer-buffered
+            // When mediaSource.readyState is "ended", then set the end time on the last range in track ranges to highest end time.
+            var expectationsC = {
+              webm: ["{ [0.000, 2.001) }", "{ [0.000, 2.023) }"],
+              mp4: ["{ [0.067, 2.043) }", "{ [0.067, 2.067) }"]
             };
 
             function mediaSourceDemuxedTest(callback, description)
@@ -28,8 +40,8 @@
                 mediasource_test(function(test, mediaElement, mediaSource)
                 {
                     mediaElement.pause();
-                    test.failOnEvent(mediaElement, 'error');
-                    test.endOnEvent(mediaElement, 'ended');
+                    mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+                    mediaElement.addEventListener("ended", test.step_func_done());
 
                     MediaSourceUtil.fetchManifestAndData(test, manifestFilenameA, function(typeA, dataA)
                     {
             }
 
             mediaSourceDemuxedTest(function(test, mediaElement, mediaSource, dataA, dataB) {
+                test.expectEvent(mediaElement, "loadedmetadata");
                 appendData(test, mediaSource, dataA, dataB, function()
                 {
+                    var expectedBeforeEndOfStreamIntersection = expectationsC[subType][0];
+                    var expectedAfterEndOfStreamIntersection = expectationsC[subType][1];
+
                     assertBufferedEquals(mediaSource.activeSourceBuffers[0], expectationsA[subType], "mediaSource.activeSourceBuffers[0]");
                     assertBufferedEquals(mediaSource.activeSourceBuffers[1], expectationsB[subType], "mediaSource.activeSourceBuffers[1]");
-                    assertBufferedEquals(mediaElement, expectationsB[subType], "mediaElement.buffered");
+                    assertBufferedEquals(mediaElement, expectedBeforeEndOfStreamIntersection, "mediaElement.buffered");
 
                     mediaSource.endOfStream();
 
                     assertBufferedEquals(mediaSource.activeSourceBuffers[0], expectationsA[subType], "mediaSource.activeSourceBuffers[0]");
                     assertBufferedEquals(mediaSource.activeSourceBuffers[1], expectationsB[subType], "mediaSource.activeSourceBuffers[1]");
-                    assertBufferedEquals(mediaElement, expectationsA[subType], "mediaElement.buffered");
+                    assertBufferedEquals(mediaElement, expectedAfterEndOfStreamIntersection, "mediaElement.buffered");
 
                     test.done();
                 });
             mediasource_test(function(test, mediaElement, mediaSource)
             {
                 mediaElement.pause();
-                test.failOnEvent(mediaElement, 'error');
-                test.endOnEvent(mediaElement, 'ended');
+                mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+                mediaElement.addEventListener("ended", test.step_func_done());
 
                 MediaSourceUtil.fetchManifestAndData(test, subType + "/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json", function(type, data)
                 {
                     test.waitForExpectedEvents(function()
                     {
                         var expectationsAV = {
-                            webm: ["{ [0.000, 2.003) }", "{ [0.000, 2.022) }"],
-                            mp4: ["{ [0.000, 2.000) }", "{ [0.000, 2.043) }"],
+                            webm: ["{ [0.003, 2.004) }", "{ [0.003, 2.023) }"],
+                            mp4: ["{ [0.067, 2.043) }", "{ [0.067, 2.067) }"],
                         };
 
                         var expectedBeforeEndOfStream = expectationsAV[subType][0];
                         test.done();
                     });
                 });
-            }, "Muxed tracks with different lengths");
+            }, "Muxed content with different lengths");
 
             mediaSourceDemuxedTest(function(test, mediaElement, mediaSource, dataA, dataB) {
                 var dataBSize = {
                     webm: 318,
-                    mp4: 856,
+                    mp4: 835,
                 };
+                test.expectEvent(mediaElement, "loadedmetadata");
                 appendData(test, mediaSource, dataA, dataB.subarray(0, dataBSize[subType]), function()
                 {
                     assertBufferedEquals(mediaSource.activeSourceBuffers[0], expectationsA[subType], "mediaSource.activeSourceBuffers[0]");
             mediasource_test(function(test, mediaElement, mediaSource)
             {
                 mediaElement.pause();
-                test.failOnEvent(mediaElement, 'error');
-                test.endOnEvent(mediaElement, 'ended');
+                mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+                mediaElement.addEventListener("ended", test.step_func_done());
 
                 MediaSourceUtil.fetchManifestAndData(test, subType + "/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json", function(type, data)
                 {
                     var sourceBuffer = mediaSource.addSourceBuffer(type);
+                    test.expectEvent(mediaElement, "loadedmetadata");
                     test.expectEvent(sourceBuffer, "update");
                     test.expectEvent(sourceBuffer, "updateend");
                     sourceBuffer.appendBuffer(data.subarray(0, 4052));
                 });
             }, "Muxed content empty buffered ranges.");
 
+            mediasource_test(function(test, mediaElement, mediaSource)
+            {
+                mediaElement.pause();
+                mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'"));
+                mediaElement.addEventListener("ended", test.step_func_done());
+
+                var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
+
+                assertBufferedEquals(mediaSource.sourceBuffers[0], "{ }", "mediaSource.sourceBuffers[0]");
+                assertBufferedEquals(mediaElement, "{ }", "mediaElement.buffered");
+                test.done();
+
+            }, "Get buffered range when sourcebuffer is empty.");
+
+            mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+            {
+                var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+
+                test.expectEvent(mediaElement, "loadedmetadata");
+                test.expectEvent(sourceBuffer, "updateend", "initSegment append ended.");
+                sourceBuffer.appendBuffer(initSegment);
+                test.waitForExpectedEvents(function()
+                {
+                    assertBufferedEquals(mediaSource.sourceBuffers[0], "{ }", "mediaSource.sourceBuffers[0]");
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ }", "mediaSource.activeSourceBuffers[0]");
+                    assertBufferedEquals(mediaElement, "{ }", "mediaElement.buffered");
+                    test.done();
+                });
+
+            }, "Get buffered range when only init segment is appended.");
+
+            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.buffered; },
+                        "get sourceBuffer.buffered throws an exception for InvalidStateError.");
+                    test.done();
+                });
+            }, "Get buffered range after removing sourcebuffer.");
         </script>
     </body>
 </html>
@@ -1,7 +1,12 @@
+
 PASS Test attribute values on a closed MediaSource object. 
 PASS Test addSourceBuffer() while closed. 
 PASS Test removeSourceBuffer() while closed. 
 PASS Test endOfStream() while closed. 
+PASS Test endOfStream(decode) while closed. 
+PASS Test endOfStream(network) while closed. 
 PASS Test setting duration while closed. 
+PASS Test setting duration while open->closed. 
+PASS Test getting duration while open->closed. 
+PASS Test sourcebuffer.abort when closed. 
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-closed.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-closed.html
new file mode 100644 (file)
index 0000000..77ba395
--- /dev/null
@@ -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>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MP4 audio-only bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MP4 muxed audio &amp; video with an audio bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MP4 muxed audio &amp; video with a video frame size change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MP4 muxed audio &amp; video with a video bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MP4 video-only bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MP4 video-only frame rate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MP4 video-only frame size change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>WebM audio-only bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>WebM muxed audio &amp; video with an audio bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>WebM muxed audio &amp; video with a video frame size change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>WebM muxed audio &amp; video with a video bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>WebM video-only bitrate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>WebM video-only frame rate change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>WebM video-only frame size change.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
         <script src="mediasource-config-changes.js"></script>
     </head>
@@ -1,3 +1,5 @@
+// Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).
+
 // Extract & return the resolution string from a filename, if any.
 function resolutionFromFilename(filename)
 {
@@ -22,7 +24,7 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
     mediasource_test(function(test, mediaElement, mediaSource)
     {
         mediaElement.pause();
-        test.failOnEvent(mediaElement, 'error');
+        mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
         var expectResizeEvents = resolutionFromFilename(manifestFilenameA) != resolutionFromFilename(manifestFilenameB);
         var expectedResizeEventCount = 0;
 
@@ -64,18 +66,28 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
                 test.waitForExpectedEvents(function()
                 {
                     assert_false(sourceBuffer.updating, "updating");
-                    assert_greater_than(mediaSource.duration, 2, "duration");
 
                     // Truncate the presentation to a duration of 2 seconds.
-                    mediaSource.duration = 2;
+                    sourceBuffer.remove(2, Infinity);
 
                     assert_true(sourceBuffer.updating, "updating");
                     test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
                     test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
                     test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
-               });
+                });
 
-               test.waitForExpectedEvents(function()
+                test.waitForExpectedEvents(function()
+                {
+                    assert_false(sourceBuffer.updating, "updating");
+                    assert_greater_than(mediaSource.duration, 2, "duration");
+
+                    // Truncate the presentation to a duration of 2 seconds.
+                    mediaSource.duration = 2;
+
+                    test.expectEvent(mediaElement, "durationchange");
+                });
+
+                test.waitForExpectedEvents(function()
                 {
                     assert_false(sourceBuffer.updating, "updating");
 
@@ -97,5 +109,5 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
                 });
             });
         });
-    }, description, { timeout: 10000 } );
+    }, description);
 };
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-detach-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-detach-expected.txt
new file mode 100644 (file)
index 0000000..d3a9647
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS Test media.load() before appending data will trigger MediaSource detaching from a media element. 
+PASS Test media.load() after appending data will trigger MediaSource detaching from a media element. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-detach.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-detach.html
new file mode 100644 (file)
index 0000000..b25b5c6
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="mediasource-util.js"></script>
+<script>
+    function mediasource_detach_test(testFunction, description)
+    {
+        mediasource_test(function(test, mediaElement, mediaSource)
+        {
+            var segmentInfo = MediaSourceUtil.SEGMENT_INFO;
+            var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type);
+
+            assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
+            assert_equals(mediaSource.readyState, 'open');
+
+            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_true(Number.isNaN(mediaSource.duration), 'duration is NaN');
+                test.done();
+            }));
+
+            MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(mediaData)
+            {
+                testFunction(test, mediaElement, mediaSource, sourceBuffer, mediaData);
+            });
+        }, description);
+    }
+
+    mediasource_detach_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+    {
+        mediaElement.load();
+    }, 'Test media.load() before appending data will trigger MediaSource detaching from a media element.');
+
+    mediasource_detach_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+    {
+        sourceBuffer.addEventListener('updateend', test.step_func(function (event)
+        {
+            assert_greater_than(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING, 'media readyState is greater than "HAVE_NOTHING"')
+            assert_false(sourceBuffer.updating, 'updating attribute is false');
+            mediaElement.load();
+        }));
+
+        sourceBuffer.appendBuffer(mediaData);
+    }, 'Test media.load() after appending data will trigger MediaSource detaching from a media element.');
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt
new file mode 100644 (file)
index 0000000..42e0c97
--- /dev/null
@@ -0,0 +1,15 @@
+
+PASS Set duration to 2^31 - 1 
+PASS Set duration to 1 
+PASS Set duration to Number.MAX_VALUE 
+PASS Set duration to Number.MIN_VALUE 
+PASS Set duration to Number.MAX_VALUE - 1 
+PASS Set duration to Number.MIN_VALUE - 1 
+PASS Set duration to Number.POSITIVE_INFINITY 
+PASS Set duration to Number.NEGATIVE_INFINITY 
+PASS Set duration to lowest value. 
+PASS Set duration to a negative double. 
+PASS Set duration to a positive double. 
+PASS Set duration to zero 
+PASS Set duration to NaN 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html
new file mode 100644 (file)
index 0000000..c2d7e2b
--- /dev/null
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
+<html>
+    <head>
+        <title>MediaSource.duration boundary condition 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>
+          function DurationBoundaryConditionTest(testDurationValue, expectedError, description)
+          {
+              return mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+              {
+                  // Append initialization segment.
+                  test.expectEvent(sourceBuffer, "updateend", "sourceBuffer");
+                  test.expectEvent(mediaElement, "loadedmetadata", "mediaElement");
+                  sourceBuffer.appendBuffer(MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init));
+                  test.waitForExpectedEvents(function()
+                  {
+                      if (expectedError) {
+                          assert_throws(expectedError,
+                              function() { mediaSource.duration = testDurationValue; },
+                              "mediaSource.duration assignment throws an exception for " + testDurationValue);
+                          test.done();
+                          return;
+                      }
+
+                      mediaSource.duration = testDurationValue;
+
+                      assert_equals(mediaSource.duration, testDurationValue, "mediaSource.duration");
+                      assert_equals(mediaElement.duration, testDurationValue, "mediaElement.duration");
+
+                      test.expectEvent(mediaElement, "durationchange", "mediaElement");
+                      test.waitForExpectedEvents(function()
+                      {
+                          assert_equals(mediaSource.duration, testDurationValue, "mediaSource.duration");
+                          assert_equals(mediaElement.duration, testDurationValue, "mediaElement.duration");
+                          test.done();
+                      });
+                  });
+
+              }, description);
+          }
+
+          DurationBoundaryConditionTest(Math.pow(2, 31) - 1, null, "Set duration to 2^31 - 1");
+          DurationBoundaryConditionTest(1, null, "Set duration to 1");
+          DurationBoundaryConditionTest(Number.MAX_VALUE, null, "Set duration to Number.MAX_VALUE");
+          DurationBoundaryConditionTest(Number.MIN_VALUE, null, "Set duration to Number.MIN_VALUE");
+          DurationBoundaryConditionTest(Number.MAX_VALUE - 1, null, "Set duration to Number.MAX_VALUE - 1");
+          DurationBoundaryConditionTest(Number.MIN_VALUE - 1, new TypeError(), "Set duration to Number.MIN_VALUE - 1");
+          DurationBoundaryConditionTest(Number.POSITIVE_INFINITY, null, "Set duration to Number.POSITIVE_INFINITY");
+          DurationBoundaryConditionTest(Number.NEGATIVE_INFINITY, new TypeError(), "Set duration to Number.NEGATIVE_INFINITY");
+          DurationBoundaryConditionTest(-1 * Number.MAX_VALUE, new TypeError(), "Set duration to lowest value.");
+          DurationBoundaryConditionTest(-101.9, new TypeError(), "Set duration to a negative double.");
+          DurationBoundaryConditionTest(101.9, null, "Set duration to a positive double.");
+          DurationBoundaryConditionTest(0, null, "Set duration to zero");
+          DurationBoundaryConditionTest(NaN, new TypeError(), "Set duration to NaN");
+        </script>
+    </body>
+</html>
@@ -1,6 +1,6 @@
+
 PASS Test seek starts on duration truncation below currentTime 
 PASS Test appendBuffer completes previous seek to truncated duration 
 PASS Test endOfStream completes previous seek to truncated duration 
 PASS Test setting same duration multiple times does not fire duplicate durationchange 
-
+PASS Test setting the duration to less than the highest starting presentation timestamp will throw 
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>MediaSource.duration &amp; HTMLMediaElement.duration test cases.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
     </head>
     <body>
                   var seekTo = fullDuration / 2.0;
                   var truncatedDuration = seekTo / 2.0;
 
+                  mediaElement.play();
+
                   // Append all the segments
                   test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+                  test.expectEvent(mediaElement, 'playing', 'Playing triggered');
                   sourceBuffer.appendBuffer(mediaData);
 
                   test.waitForExpectedEvents(function()
                   {
-                      assert_equals(mediaElement.duration, fullDuration, 'mediaElement fullDuration');
-                      assert_equals(mediaSource.duration, fullDuration, 'mediaSource fullDuration');
-
                       test.expectEvent(mediaElement, 'seeking', 'seeking to seekTo');
                       test.expectEvent(mediaElement, 'timeupdate', 'timeupdate while seeking to seekTo');
                       test.expectEvent(mediaElement, 'seeked', 'seeked to seekTo');
                   test.waitForExpectedEvents(function()
                   {
                       assert_greater_than_equal(mediaElement.currentTime, seekTo, 'Playback time has reached seekTo');
-                      assert_equals(mediaElement.duration, fullDuration, 'mediaElement fullDuration after seekTo');
-                      assert_equals(mediaSource.duration, fullDuration, 'mediaSource fullDuration after seekTo');
                       assert_false(mediaElement.seeking, 'mediaElement.seeking after seeked to seekTo');
 
-                      test.expectEvent(mediaElement, 'seeking', 'Seeking to truncated duration');
-
                       assert_false(sourceBuffer.updating, 'sourceBuffer.updating');
 
-                      mediaSource.duration = truncatedDuration;
+                      sourceBuffer.remove(truncatedDuration, Infinity);
 
                       assert_true(sourceBuffer.updating, 'sourceBuffer.updating');
                       test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
                       test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
                       test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+                  });
+
+                  test.waitForExpectedEvents(function()
+                  {
+                      // remove will not remove partial frames. The truncated duration is as such the highest end time.
+                      truncatedDuration = sourceBuffer.buffered.end(sourceBuffer.buffered.length-1);
+                      assert_greater_than_equal(mediaElement.currentTime, seekTo, 'Playback time has reached seekTo');
+                      test.expectEvent(mediaElement, 'seeking', 'Seeking to truncated duration');
+
+                      assert_false(sourceBuffer.updating, 'sourceBuffer.updating');
+
+                      mediaSource.duration = truncatedDuration;
 
                       assert_true(mediaElement.seeking, 'Seeking after setting truncatedDuration');
                   });
 
               test.waitForExpectedEvents(function()
               {
-                  assert_approx_equals(mediaElement.currentTime, truncatedDuration, 0.05,
+                  assert_greater_than_equal(mediaElement.currentTime, truncatedDuration,
                                 'Playback time has reached truncatedDuration');
-                  assert_approx_equals(mediaElement.duration, truncatedDuration, 0.05,
+                  // The mediaSource.readyState is "ended". Buffered ranges have been adjusted to the longest track.
+                  truncatedDuration = sourceBuffer.buffered.end(sourceBuffer.buffered.length-1);
+                  assert_equals(mediaElement.duration, truncatedDuration,
                                 'mediaElement truncatedDuration after seek to it');
-                  assert_approx_equals(mediaSource.duration, truncatedDuration, 0.05,
+                  assert_equals(mediaSource.duration, truncatedDuration,
                                 'mediaSource truncatedDuration after seek to it');
                   assert_false(mediaElement.seeking, 'mediaElement.seeking after seeked to truncatedDuration');
 
               var durationchangeEventCounter = 0;
               var durationchangeEventHandler = test.step_func(function(event)
               {
-                  assert_equals(mediaElement.duration, newDuration, 'mediaElement newDuration');
-                  assert_equals(mediaSource.duration, newDuration, 'mediaSource newDuration');
+                  assert_equals(mediaElement.duration, mediaSource.duration, 'mediaElement newDuration');
+                  // Final duration may be greater than originally set as per MSE's 2.4.6 Duration change
+                  // Adjust newDuration accordingly.
+                  assert_less_than_equal(newDuration, mediaSource.duration, 'mediaSource newDuration');
                   durationchangeEventCounter++;
               });
 
+              mediaElement.play();
+
               // Append all the segments
               test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+              test.expectEvent(mediaElement, 'playing', 'Playing triggered');
               sourceBuffer.appendBuffer(mediaData);
 
               test.waitForExpectedEvents(function()
               {
-                  assert_equals(mediaElement.duration, fullDuration, 'mediaElement fullDuration');
-                  assert_equals(mediaSource.duration, fullDuration, 'mediaSource fullDuration');
                   assert_less_than(mediaElement.currentTime, newDuration / 2, 'mediaElement currentTime');
 
-                  // Media load also fires 'durationchange' event, so only start counting them now.
-                  mediaElement.addEventListener('durationchange', durationchangeEventHandler);
-
                   assert_false(sourceBuffer.updating, "updating");
 
                   // Truncate duration. This should result in one 'durationchange' fired.
-                  mediaSource.duration = newDuration;
+                  sourceBuffer.remove(newDuration, Infinity);
 
                   assert_true(sourceBuffer.updating, "updating");
                   test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
 
               test.waitForExpectedEvents(function()
               {
+                  // Media load also fires 'durationchange' event, so only start counting them now.
+                  mediaElement.addEventListener('durationchange', durationchangeEventHandler);
+
                   assert_false(sourceBuffer.updating, "updating");
 
+                  // Truncate duration. This should result in one 'durationchange' fired.
+                  mediaSource.duration = newDuration;
+
+                  // Final duration may be greater than originally set as per MSE's 2.4.6 Duration change
+                  // Adjust newDuration accordingly.
+                  assert_true(newDuration <= mediaSource.duration, 'adjusted duration');
+                  newDuration = mediaSource.duration;
+
                   // Set duration again to make sure it does not trigger another 'durationchange' event.
                   mediaSource.duration = newDuration;
 
                   test.expectEvent(mediaSource, 'sourceended', 'endOfStream acknowledged');
                   mediaSource.endOfStream();
 
-                  // endOfStream can change duration downwards slightly.
+                  // endOfStream can change duration slightly.
                   // Allow for one more 'durationchange' event only in this case.
                   var currentDuration = mediaSource.duration;
                   if (currentDuration != newDuration) {
-                      assert_true(currentDuration > 0 && currentDuration < newDuration, 'adjusted duration');
                       newDuration = currentDuration;
                       ++expectedDurationChangeEventCount;
                   }
 
-                  mediaElement.play();
-
                   // Allow media to play to end while counting 'durationchange' events.
-                  test.expectEvent(mediaElement, 'playing', 'Playing triggered');
                   test.expectEvent(mediaElement, 'ended', 'Playback ended');
                   test.waitForExpectedEvents(function()
                   {
                       test.done();
                   });
               });
-          }, 'Test setting same duration multiple times does not fire duplicate durationchange', {timeout: 2500});
+          }, 'Test setting same duration multiple times does not fire duplicate durationchange');
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              assert_greater_than(segmentInfo.duration, 2, 'Sufficient test media duration');
+
+              var fullDuration = segmentInfo.duration;
+              var newDuration = fullDuration / 2;
+
+              // Append all the segments
+              test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+              test.expectEvent(mediaElement, 'loadedmetadata', 'mediaElement');
+              sourceBuffer.appendBuffer(mediaData);
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating");
+
+                  assert_throws("InvalidStateError", function()
+                  {
+                      mediaSource.duration = newDuration;
+                  }, "duration");
+
+                  test.done();
+              });
+          }, 'Test setting the duration to less than the highest starting presentation timestamp will throw');
 
         </script>
     </body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream-expected.txt
new file mode 100644 (file)
index 0000000..0aaa23c
--- /dev/null
@@ -0,0 +1,6 @@
+
+PASS MediaSource.endOfStream(): duration truncated to 0 when there are no buffered coded frames 
+PASS MediaSource.endOfStream(): media element notified that it now has all of the media data 
+PASS MediaSource.endOfStream(): buffered data not modified when endOfStream is called 
+PASS MediaSource.endOfStream(): duration set to the highest end time reported by the buffered attribute 
+
@@ -1,8 +1,10 @@
 <!DOCTYPE html>
+<!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
 <html>
     <head>
-        <script src="/w3c/resources/testharness.js"></script>
-        <script src="/w3c/resources/testharnessreport.js"></script>
+        <title>Invalid MediaSource.endOfStream() parameter test cases.</title>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
         <script src="mediasource-util.js"></script>
     </head>
     <body>
@@ -10,7 +12,7 @@
         <script>
           mediasource_test(function(test, mediaElement, mediaSource)
           {
-              test.failOnEvent(mediaElement, 'error');
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
               assert_equals(mediaSource.readyState, 'open');
 
               assert_throws(new TypeError(),
@@ -23,7 +25,7 @@
 
           mediasource_test(function(test, mediaElement, mediaSource)
           {
-              test.failOnEvent(mediaElement, 'error');
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
               assert_equals(mediaSource.readyState, 'open');
 
               assert_throws(new TypeError(),
@@ -36,7 +38,7 @@
 
           mediasource_test(function(test, mediaElement, mediaSource)
           {
-              test.failOnEvent(mediaElement, 'error');
+              mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
               assert_equals(mediaSource.readyState, 'open');
 
               assert_throws(new TypeError(),
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-endofstream.html
new file mode 100644 (file)
index 0000000..9430257
--- /dev/null
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Calls to MediaSource.endOfStream() without error</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="mediasource-util.js"></script>
+<script>
+    mediasource_test(function(test, mediaElement, mediaSource)
+    {
+        mediaSource.duration = 2;
+        mediaSource.endOfStream();
+        assert_equals(mediaSource.duration, 0);
+        test.done();
+    }, 'MediaSource.endOfStream(): duration truncated to 0 when there are no buffered coded frames');
+
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        sourceBuffer.appendBuffer(mediaData);
+        test.expectEvent(sourceBuffer, 'updateend',
+          'Media buffer appended to SourceBuffer');
+        test.waitForExpectedEvents(function()
+        {
+            mediaSource.endOfStream();
+            test.expectEvent(mediaElement, 'canplaythrough',
+              'Media element may render the media content until the end');
+            test.waitForExpectedEvents(function()
+            {
+                assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA,
+                  'Media element has enough data to render the content');
+                test.done();
+            });
+        });
+    }, 'MediaSource.endOfStream(): media element notified that it now has all of the media data');
+
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        sourceBuffer.appendBuffer(mediaData);
+        test.expectEvent(sourceBuffer, 'updateend',
+          'Media buffer appended to SourceBuffer');
+        test.waitForExpectedEvents(function()
+        {
+            assert_equals(sourceBuffer.buffered.length, 1,
+              'Media data properly buffered');
+            var highestEndTime = sourceBuffer.buffered.end(0);
+
+            mediaSource.endOfStream();
+
+            assert_equals(sourceBuffer.buffered.end(0), highestEndTime,
+              'Ending the stream does not affect buffered data');
+            test.done();
+        });
+    }, 'MediaSource.endOfStream(): buffered data not modified when endOfStream is called');
+
+    mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        assert_less_than(segmentInfo.duration, 60, 'Sufficient test media duration');
+        sourceBuffer.appendBuffer(mediaData);
+        test.expectEvent(sourceBuffer, 'updateend',
+          'Media buffer appended to SourceBuffer');
+        test.waitForExpectedEvents(function()
+        {
+            assert_equals(sourceBuffer.buffered.length, 1,
+              'Media data properly buffered');
+
+            mediaSource.duration = 60;
+            mediaSource.endOfStream();
+
+            assert_equals(mediaSource.duration, sourceBuffer.buffered.end(0),
+              'Duration set to the higest end time');
+            test.done();
+        });
+    }, 'MediaSource.endOfStream(): duration set to the highest end time reported by the buffered attribute');
+</script>
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-errors-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-errors-expected.txt
new file mode 100644 (file)
index 0000000..e3070a2
--- /dev/null
@@ -0,0 +1,8 @@
+
+PASS Appending media segment before the first initialization segment. 
+PASS Signaling 'decode' error via endOfStream() before initialization segment has been appended. 
+PASS Signaling 'network' error via endOfStream() before initialization segment has been appended. 
+PASS Signaling 'decode' error via endOfStream() after initialization segment has been appended and the HTMLMediaElement has reached HAVE_METADATA. 
+PASS Signaling 'network' error via endOfStream() after initialization segment has been appended and the HTMLMediaElement has reached HAVE_METADATA. 
+PASS Signaling 'decode' error via segment parser loop algorithm after initialization segment and partial media segment has been appended. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-errors.html b/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-errors.html
new file mode 100644 (file)
index 0000000..c019ebc
--- /dev/null
@@ -0,0 +1,197 @@
+<!DOCTYPE html>
+<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="mediasource-util.js"></script>
+<script>
+    function ErrorTest(testFunction, description)
+    {
+        mediasource_test(function(test, mediaElement, mediaSource)
+        {
+            var segmentInfo = MediaSourceUtil.SEGMENT_INFO;
+
+            if (!segmentInfo) {
+                assert_unreached("No segment info compatible with this MediaSource implementation.");
+                return;
+            }
+
+            var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type);
+            MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(mediaData)
+            {
+                testFunction(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData);
+            });
+        }, description);
+    }
+
+    ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
+
+        test.expectEvent(sourceBuffer, "error", "sourceBuffer error.");
+        test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended.");
+        test.expectEvent(mediaElement, "error", "mediaElement error.");
+        test.expectEvent(mediaSource, "sourceended", "mediaSource ended.");
+        test.expectEvent(mediaSource, "sourceclose", "mediaSource closed.");
+        sourceBuffer.appendBuffer(mediaSegment);
+
+        test.waitForExpectedEvents(function()
+        {
+            assert_true(mediaElement.error != null);
+            assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
+
+            assert_equals(mediaSource.sourceBuffers.length, 0);
+            assert_equals(mediaSource.readyState, "closed");
+            test.done();
+        });
+    }, "Appending media segment before the first initialization segment.");
+
+    ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
+
+        // Fail if the append error algorithm occurs, since the decode
+        // error will be provided by us directly via endOfStream().
+        sourceBuffer.addEventListener("error", test.unreached_func("'error' should not be fired on sourceBuffer"));
+
+        test.expectEvent(mediaElement, "error", "mediaElement error.");
+        test.expectEvent(mediaSource, "sourceended", "mediaSource ended.");
+        test.expectEvent(mediaSource, "sourceclose", "mediaSource closed.");
+
+        mediaSource.endOfStream("decode");
+
+        test.waitForExpectedEvents(function()
+        {
+            assert_true(mediaElement.error != null);
+            assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
+
+            assert_equals(mediaSource.sourceBuffers.length, 0);
+            assert_equals(mediaSource.readyState, "closed");
+
+            // Give a short time for a broken implementation to errantly fire
+            // "error" on sourceBuffer.
+            test.step_timeout(test.step_func_done(), 0);
+        });
+    }, "Signaling 'decode' error via endOfStream() before initialization segment has been appended.");
+
+    ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+    {
+        assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);