[MSE] Failures on W3C media-source tests regarding MIME types
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jul 2015 15:54:41 +0000 (15:54 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jul 2015 15:54:41 +0000 (15:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146499

Reviewed by Eric Carlson.

Source/WebCore:

Tests: http/tests/media/media-source/SourceBuffer-abort-readyState.html
       http/tests/media/media-source/SourceBuffer-abort-removed.html
       http/tests/media/media-source/SourceBuffer-abort-updating.html
       http/tests/media/media-source/SourceBuffer-abort.html

Multiple failures in the W3C media-source test suite due to two failures in isTypeSupported MIME type handling:
- MIME types without codec strings were being rejected.
- MIME types with codec strings which are rejected by the system are being reported as supported.

For the first, stop rejecting MIME types with non-existent codec strings. For MIME types which do have non-empty
codec strings, treat a "Maybe" response as unsupported.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::isTypeSupported):

LayoutTests:

Import four new tests from the w3c test suite <https://github.com/w3c/web-platform-tests.git>.

* http/tests/media/media-source/SourceBuffer-abort-readyState.html: Added.
* http/tests/media/media-source/SourceBuffer-abort-removed.html: Added.
* http/tests/media/media-source/SourceBuffer-abort-updating.html: Added.
* http/tests/media/media-source/SourceBuffer-abort.html: Added.
* http/tests/media/white.mp4: Added.
* http/tests/media/white.webm: Added.
* platform/mac/TestExpectations:
* platform/mac/http/tests/media/media-source/SourceBuffer-abort-expected.txt: Added.
* platform/mac/http/tests/media/media-source/SourceBuffer-abort-readyState-expected.txt: Added.
* platform/mac/http/tests/media/media-source/SourceBuffer-abort-removed-expected.txt: Added.
* platform/mac/http/tests/media/media-source/SourceBuffer-abort-updating-expected.txt: Added.
* platform/mac/http/tests/media/media-source/mediasource-is-type-supported-expected.txt: Added.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/media/media-source/SourceBuffer-abort-readyState.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/SourceBuffer-abort-removed.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/SourceBuffer-abort-updating.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/SourceBuffer-abort.html [new file with mode: 0644]
LayoutTests/http/tests/media/white.mp4 [new file with mode: 0644]
LayoutTests/http/tests/media/white.webm [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-readyState-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-removed-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-updating-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/http/tests/media/media-source/mediasource-is-type-supported-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/MediaSource.cpp

index fcc1b16..d9d83b4 100644 (file)
@@ -1,3 +1,25 @@
+2015-07-01  Jer Noble  <jer.noble@apple.com>
+
+        [MSE] Failures on W3C media-source tests regarding MIME types
+        https://bugs.webkit.org/show_bug.cgi?id=146499
+
+        Reviewed by Eric Carlson.
+
+        Import four new tests from the w3c test suite <https://github.com/w3c/web-platform-tests.git>.
+
+        * http/tests/media/media-source/SourceBuffer-abort-readyState.html: Added.
+        * http/tests/media/media-source/SourceBuffer-abort-removed.html: Added.
+        * http/tests/media/media-source/SourceBuffer-abort-updating.html: Added.
+        * http/tests/media/media-source/SourceBuffer-abort.html: Added.
+        * http/tests/media/white.mp4: Added.
+        * http/tests/media/white.webm: Added.
+        * platform/mac/TestExpectations:
+        * platform/mac/http/tests/media/media-source/SourceBuffer-abort-expected.txt: Added.
+        * platform/mac/http/tests/media/media-source/SourceBuffer-abort-readyState-expected.txt: Added.
+        * platform/mac/http/tests/media/media-source/SourceBuffer-abort-removed-expected.txt: Added.
+        * platform/mac/http/tests/media/media-source/SourceBuffer-abort-updating-expected.txt: Added.
+        * platform/mac/http/tests/media/media-source/mediasource-is-type-supported-expected.txt: Added.
+
 2015-06-30  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         [EFL] Unreviewed gardening.
diff --git a/LayoutTests/http/tests/media/media-source/SourceBuffer-abort-readyState.html b/LayoutTests/http/tests/media/media-source/SourceBuffer-abort-readyState.html
new file mode 100644 (file)
index 0000000..3a6617b
--- /dev/null
@@ -0,0 +1,71 @@
+<!doctype html>
+<html>
+<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>
+</head>
+<body>
+<div id="log"></div>
+
+<script>
+var contents = {'/media/white.webm': 'video/webm; codecs="vorbis,vp8"',
+                '/media/white.mp4' : 'video/mp4'};
+
+//check the browser supports the MIME used in this test
+function isTypeSupported(mime) {
+    if(!MediaSource.isTypeSupported(mime)) {
+        this.step(function() {
+            assert_unreached("Browser doesn't support the MIME used in this test: " + mime);
+        });
+        this.done();
+        return false;
+    }
+    return true;
+}
+function GET(url, processBody) {
+    var xhr = new XMLHttpRequest();
+    xhr.open('GET', url, true);
+    xhr.responseType = 'arraybuffer';
+    xhr.send();
+    xhr.onload = function(e) {
+        if (xhr.status != 200) {
+            alert("Unexpected status code " + xhr.status + " for " + url);
+            return false;
+        }
+        processBody(new Uint8Array(xhr.response));
+    };
+}
+function mediaTest(file, mime) {
+    async_test(function(t) {
+        if(!isTypeSupported.bind(t)(mime)) {
+            return;
+        }
+        GET(file, function(data) {
+            var mediaSource = new MediaSource();
+            var sourceBuffer = null;
+            mediaSource.addEventListener('sourceopen', function(e) {
+                sourceBuffer = mediaSource.addSourceBuffer(mime);
+                mediaSource.endOfStream();
+                assert_equals(mediaSource.readyState, 'ended',
+                              'mediaSource.readyState is "ended" after endOfStream()');
+            });
+            mediaSource.addEventListener('sourceended', t.step_func_done(function(e) {
+                assert_throws({name: 'InvalidStateError'}, function() {
+                    sourceBuffer.abort();
+                });
+            }));
+            var video = document.createElement('video');
+            video.src = window.URL.createObjectURL(mediaSource);
+        });
+    }, 'SourceBuffer#abort() (' + mime + ') : 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.');
+}
+for(var file in contents) {
+    mediaTest(file, contents[file]);
+}
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/SourceBuffer-abort-removed.html b/LayoutTests/http/tests/media/media-source/SourceBuffer-abort-removed.html
new file mode 100644 (file)
index 0000000..ee54661
--- /dev/null
@@ -0,0 +1,52 @@
+<!doctype html>
+<html>
+<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>
+</head>
+<body>
+<div id="log"></div>
+
+<script>
+var mimes = ['video/webm; codecs="vorbis,vp8"', 'video/mp4'];
+
+//check the browser supports the MIME used in this test
+function isTypeSupported(mime) {
+    if(!MediaSource.isTypeSupported(mime)) {
+        this.step(function() {
+            assert_unreached("Browser doesn't support the MIME used in this test: " + mime);
+        });
+        this.done();
+        return false;
+    }
+    return true;
+}
+function mediaTest(mime) {
+    async_test(function(t) {
+        if(!isTypeSupported.bind(t)(mime)) {
+            return;
+        }
+        var mediaSource = new MediaSource();
+        mediaSource.addEventListener('sourceopen', t.step_func_done(function(e) {
+            var sourceBuffer = mediaSource.addSourceBuffer(mime);
+            mediaSource.removeSourceBuffer(sourceBuffer);
+            assert_throws({name: 'InvalidStateError'},
+                          function() {
+                              sourceBuffer.abort();
+                          },
+                          'SourceBuffer#abort() after removing the SourceBuffer object');
+        }), false);
+        var video = document.createElement('video');
+        video.src = window.URL.createObjectURL(mediaSource);
+    }, 'SourceBuffer#abort (' + mime + ') : ' +
+       '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.');
+}
+mimes.forEach(function(mime) {
+    mediaTest(mime);
+});
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/SourceBuffer-abort-updating.html b/LayoutTests/http/tests/media/media-source/SourceBuffer-abort-updating.html
new file mode 100644 (file)
index 0000000..0930eef
--- /dev/null
@@ -0,0 +1,92 @@
+<!doctype html>
+<html>
+<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>
+</head>
+<body>
+<div id="log"></div>
+
+<script>
+var contents = {'/media/white.webm': 'video/webm; codecs="vorbis,vp8"',
+                '/media/white.mp4' : 'video/mp4'};
+
+function GET(url, processBody) {
+    var xhr = new XMLHttpRequest();
+    xhr.open('GET', url, true);
+    xhr.responseType = 'arraybuffer';
+    xhr.send();
+    xhr.onload = function(e) {
+        if (xhr.status != 200) {
+            alert("Unexpected status code " + xhr.status + " for " + url);
+            return false;
+        }
+        processBody(new Uint8Array(xhr.response));
+    };
+}
+//check the browser supports the MIME used in this test
+function isTypeSupported(mime) {
+    if(!MediaSource.isTypeSupported(mime)) {
+        this.step(function() {
+            assert_unreached("Browser doesn't support the MIME used in this test: " + mime);
+        });
+        this.done();
+        return false;
+    }
+    return true;
+}
+function mediaTest(file, mime) {
+    async_test(function(t) {
+        if(!isTypeSupported.bind(t)(mime)) {
+            return;
+        }
+        GET(file, function(data) {
+            var mediaSource = new MediaSource();
+            var num_updateend = 0;
+            var events = [];
+            mediaSource.addEventListener('sourceopen', t.step_func(function(e) {
+                var sourceBuffer = mediaSource.addSourceBuffer(mime);
+                assert_equals(sourceBuffer.updating, false);
+                sourceBuffer.addEventListener('updatestart', t.step_func(function(e) {
+                    events.push('updatestart');
+                    //abort when sourceBuffer#updating is true
+                    sourceBuffer.abort();
+
+                    assert_equals(sourceBuffer.updating, false,
+                                  'Check updating value after calling abort.');
+                    assert_equals(sourceBuffer.appendWindowStart, 0);
+                    assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY);
+                }));
+                sourceBuffer.addEventListener('update', t.step_func(function(e) {
+                    assert_unreached("Can't touch this");
+                }));
+                sourceBuffer.addEventListener('updateend', function(e) {
+                    events.push('updateend');
+                    mediaSource.endOfStream();
+                });
+                sourceBuffer.addEventListener('abort', function(e) {
+                    events.push('abort');
+                });
+                sourceBuffer.addEventListener('error', t.step_func(function(e) {
+                    assert_unreached("Can't touch this");
+                }));
+                sourceBuffer.appendBuffer(data);
+            }));
+            mediaSource.addEventListener('sourceended', t.step_func_done(function(e) {
+                assert_array_equals(events,
+                                    ['updatestart', 'abort', 'updateend'],
+                                    'Check the sequence of fired events.');
+            }));
+            var video = document.createElement('video');
+            video.src = window.URL.createObjectURL(mediaSource);
+        });
+    }, 'SourceBuffer#abort() (' + mime + ') : Check the algorithm when the updating attribute is true.');
+}
+for(var file in contents) {
+    mediaTest(file, contents[file]);
+}
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/SourceBuffer-abort.html b/LayoutTests/http/tests/media/media-source/SourceBuffer-abort.html
new file mode 100644 (file)
index 0000000..a2c6f21
--- /dev/null
@@ -0,0 +1,34 @@
+<!doctype html>
+<html>
+<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>
+</head>
+<body>
+<div id="log"></div>
+
+<script>
+var mimes = ['video/webm; codecs="vorbis,vp8"', 'video/mp4'];
+
+mimes.forEach(function(mime) {
+    async_test(function() {
+        assert_true(MediaSource.isTypeSupported(mime),
+                    "Browser doesn't support the MIME used in this test: " + mime);
+
+        var mediaSource = new MediaSource();
+        mediaSource.addEventListener('sourceopen', this.step_func_done(function(e) {
+            var sourceBuffer = mediaSource.addSourceBuffer(mime);
+            sourceBuffer.abort();
+            assert_equals(sourceBuffer.appendWindowStart, 0);
+            assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY);
+        }));
+
+        var video = document.createElement('video');
+        video.src = window.URL.createObjectURL(mediaSource);
+    }, 'SourceBuffer#abort() (' + mime + '): Check the values of appendWindowStart and appendWindowEnd.');
+});
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/media/white.mp4 b/LayoutTests/http/tests/media/white.mp4
new file mode 100644 (file)
index 0000000..ef609e4
Binary files /dev/null and b/LayoutTests/http/tests/media/white.mp4 differ
diff --git a/LayoutTests/http/tests/media/white.webm b/LayoutTests/http/tests/media/white.webm
new file mode 100644 (file)
index 0000000..ef609e4
Binary files /dev/null and b/LayoutTests/http/tests/media/white.webm differ
index 8ee8f5f..f3de6f4 100644 (file)
@@ -1115,12 +1115,17 @@ webkit.org/b/137505 media/track/track-forced-subtitles-in-band.html [ Failure Pa
 
 # Passing Media Source tests
 [ Yosemite+ ] http/tests/media/media-source/ [ Skip ]
+[ Yosemite+ ] http/tests/media/media-source/SourceBuffer-abort-readyState.html [ Pass ]
+[ Yosemite+ ] http/tests/media/media-source/SourceBuffer-abort-removed.html [ Pass ]
+[ Yosemite+ ] http/tests/media/media-source/SourceBuffer-abort-updating.html [ Pass ]
+[ Yosemite+ ] http/tests/media/media-source/SourceBuffer-abort.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-addsourcebuffer.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-append-buffer.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-closed.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-endofstream-invaliderror.html [ Pass ]
+[ Yosemite+ ] http/tests/media/media-source/mediasource-is-type-supported.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-multiple-attach.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-play.html [ Pass ]
 [ Yosemite+ ] http/tests/media/media-source/mediasource-remove.html [ Pass ]
diff --git a/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-expected.txt b/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-expected.txt
new file mode 100644 (file)
index 0000000..f97b79c
--- /dev/null
@@ -0,0 +1,11 @@
+
+FAIL SourceBuffer#abort() (video/webm; codecs="vorbis,vp8"): Check the values of appendWindowStart and appendWindowEnd. assert_true: Browser doesn't support the MIME used in this test: video/webm; codecs="vorbis,vp8" expected true got false(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_true@http://127.0.0.1:8000/w3c/resources/testharness.js:663:15
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort.html:17:20
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+async_test@http://127.0.0.1:8000/w3c/resources/testharness.js:460:26
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort.html:16:15
+forEach@[native code]
+global code@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort.html:15:14)
+PASS SourceBuffer#abort() (video/mp4): Check the values of appendWindowStart and appendWindowEnd. 
+
diff --git a/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-readyState-expected.txt b/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-readyState-expected.txt
new file mode 100644 (file)
index 0000000..60c761f
--- /dev/null
@@ -0,0 +1,14 @@
+
+FAIL 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. assert_unreached: Browser doesn't support the MIME used in this test: video/webm; codecs="vorbis,vp8" Reached unreachable code(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_unreached@http://127.0.0.1:8000/w3c/resources/testharness.js:1056:16
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-readyState.html:20:29
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+isTypeSupported@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-readyState.html:19:18
+isTypeSupported@[native code]
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-readyState.html:42:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+async_test@http://127.0.0.1:8000/w3c/resources/testharness.js:460:26
+mediaTest@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-readyState.html:41:15
+global code@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-readyState.html:67:14)
+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. 
+
diff --git a/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-removed-expected.txt b/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-removed-expected.txt
new file mode 100644 (file)
index 0000000..3f1eb40
--- /dev/null
@@ -0,0 +1,16 @@
+
+FAIL 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. assert_unreached: Browser doesn't support the MIME used in this test: video/webm; codecs="vorbis,vp8" Reached unreachable code(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_unreached@http://127.0.0.1:8000/w3c/resources/testharness.js:1056:16
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-removed.html:19:29
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+isTypeSupported@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-removed.html:18:18
+isTypeSupported@[native code]
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-removed.html:28:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+async_test@http://127.0.0.1:8000/w3c/resources/testharness.js:460:26
+mediaTest@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-removed.html:27:15
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-removed.html:48:14
+forEach@[native code]
+global code@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-removed.html:47:14)
+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. 
+
diff --git a/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-updating-expected.txt b/LayoutTests/platform/mac/http/tests/media/media-source/SourceBuffer-abort-updating-expected.txt
new file mode 100644 (file)
index 0000000..e4b7923
--- /dev/null
@@ -0,0 +1,14 @@
+
+FAIL SourceBuffer#abort() (video/webm; codecs="vorbis,vp8") : Check the algorithm when the updating attribute is true. assert_unreached: Browser doesn't support the MIME used in this test: video/webm; codecs="vorbis,vp8" Reached unreachable code(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_unreached@http://127.0.0.1:8000/w3c/resources/testharness.js:1056:16
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-updating.html:33:29
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+isTypeSupported@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-updating.html:32:18
+isTypeSupported@[native code]
+http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-updating.html:42:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+async_test@http://127.0.0.1:8000/w3c/resources/testharness.js:460:26
+mediaTest@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-updating.html:41:15
+global code@http://127.0.0.1:8000/media/media-source/SourceBuffer-abort-updating.html:88:14)
+PASS SourceBuffer#abort() (video/mp4) : Check the algorithm when the updating attribute is true. 
+
diff --git a/LayoutTests/platform/mac/http/tests/media/media-source/mediasource-is-type-supported-expected.txt b/LayoutTests/platform/mac/http/tests/media/media-source/mediasource-is-type-supported-expected.txt
new file mode 100644 (file)
index 0000000..7a3387a
--- /dev/null
@@ -0,0 +1,85 @@
+
+PASS Test invalid MIME format "video" 
+PASS Test invalid MIME format "video/" 
+PASS Test invalid MIME format "video/webm" 
+PASS Test invalid MIME format "video/webm;" 
+PASS Test invalid MIME format "video/webm;codecs" 
+PASS Test invalid MIME format "video/webm;codecs=" 
+PASS Test invalid MIME format "video/webm;codecs="" 
+PASS Test invalid MIME format "video/webm;codecs=""" 
+PASS Test invalid MIME format "video/webm;codecs=","" 
+PASS Test invalid mismatch between major type and codec ID "audio/webm;codecs="vp8"" 
+FAIL Test invalid mismatch between major type and codec ID "audio/mp4;codecs="avc1.4d001e"" assert_equals: supported expected false but got true(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:34:28)
+PASS Test invalid mismatch between minor type and codec ID "audio/mp4;codecs="vorbis"" 
+PASS Test invalid mismatch between minor type and codec ID "audio/webm;codecs="mp4a.40.2"" 
+PASS Test invalid mismatch between minor type and codec ID "video/mp4;codecs="vp8"" 
+PASS Test invalid mismatch between minor type and codec ID "video/webm;codecs="mp4a.40.2"" 
+PASS Test invalid mismatch between minor type and codec ID "video/mp4;codecs="vorbis"" 
+PASS Test invalid mismatch between minor type and codec ID "video/webm;codecs="mp4a.40.2"" 
+PASS Test invalid codec ID "audio/mp4;codecs="mp4a"" 
+FAIL Test invalid codec ID "audio/mp4;codecs="mp4a.40"" assert_equals: supported expected false but got true(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:48:28)
+FAIL Test invalid codec ID "audio/mp4;codecs="mp4a.40."" assert_equals: supported expected false but got true(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:48:28)
+PASS Test invalid codec ID "audio/mp4;codecs="mp4a.67.3"" 
+FAIL Test valid WebM type "video/webm;codecs="vp8"" assert_equals: supported expected true but got false(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:55:28)
+FAIL Test valid WebM type "video/webm;codecs="vorbis"" assert_equals: supported expected true but got false(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:55:28)
+FAIL Test valid WebM type "video/webm;codecs="vp8,vorbis"" assert_equals: supported expected true but got false(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:55:28)
+FAIL Test valid WebM type "video/webm;codecs="vorbis, vp8"" assert_equals: supported expected true but got false(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:55:28)
+FAIL Test valid WebM type "audio/webm;codecs="vorbis"" assert_equals: supported expected true but got false(stack: assert@http://127.0.0.1:8000/w3c/resources/testharness.js:2060:37
+assert_equals@http://127.0.0.1:8000/w3c/resources/testharness.js:699:15
+http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:16:36
+step@http://127.0.0.1:8000/w3c/resources/testharness.js:1160:30
+test@http://127.0.0.1:8000/w3c/resources/testharness.js:443:22
+test_type_support@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:14:23
+global code@http://127.0.0.1:8000/media/media-source/mediasource-is-type-supported.html:55:28)
+PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e"" 
+PASS Test valid MP4 type "video/mp4;codecs="avc1.42001e"" 
+PASS Test valid MP4 type "audio/mp4;codecs="mp4a.40.2"" 
+PASS Test valid MP4 type "audio/mp4;codecs="mp4a.40.5"" 
+PASS Test valid MP4 type "audio/mp4;codecs="mp4a.67"" 
+PASS Test valid MP4 type "video/mp4;codecs="mp4a.40.2"" 
+PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.2"" 
+PASS Test valid MP4 type "video/mp4;codecs="mp4a.40.2 , avc1.4d001e "" 
+PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.5"" 
+
index c000354..79c1a01 100644 (file)
@@ -1,3 +1,25 @@
+2015-07-01  Jer Noble  <jer.noble@apple.com>
+
+        [MSE] Failures on W3C media-source tests regarding MIME types
+        https://bugs.webkit.org/show_bug.cgi?id=146499
+
+        Reviewed by Eric Carlson.
+
+        Tests: http/tests/media/media-source/SourceBuffer-abort-readyState.html
+               http/tests/media/media-source/SourceBuffer-abort-removed.html
+               http/tests/media/media-source/SourceBuffer-abort-updating.html
+               http/tests/media/media-source/SourceBuffer-abort.html
+
+        Multiple failures in the W3C media-source test suite due to two failures in isTypeSupported MIME type handling:
+        - MIME types without codec strings were being rejected.
+        - MIME types with codec strings which are rejected by the system are being reported as supported.
+
+        For the first, stop rejecting MIME types with non-existent codec strings. For MIME types which do have non-empty
+        codec strings, treat a "Maybe" response as unsupported.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::isTypeSupported):
+
 2015-06-30  Alex Christensen  <achristensen@webkit.org>
 
         Update ANGLE to b11e2483742db884bd0af41f78f528240577356b.
index dec59c4..91170aa 100644 (file)
@@ -736,7 +736,7 @@ bool MediaSource::isTypeSupported(const String& type)
     String codecs = contentType.parameter("codecs");
 
     // 2. If type does not contain a valid MIME type string, then return false.
-    if (contentType.type().isEmpty() || codecs.isEmpty())
+    if (contentType.type().isEmpty())
         return false;
 
     // 3. If type contains a media type or media subtype that the MediaSource does not support, then return false.
@@ -747,7 +747,12 @@ bool MediaSource::isTypeSupported(const String& type)
     parameters.type = contentType.type();
     parameters.codecs = codecs;
     parameters.isMediaSource = true;
-    return MediaPlayer::supportsType(parameters, 0) != MediaPlayer::IsNotSupported;
+    MediaPlayer::SupportsType supported = MediaPlayer::supportsType(parameters, 0);
+
+    if (codecs.isEmpty())
+        return supported != MediaPlayer::IsNotSupported;
+
+    return supported == MediaPlayer::IsSupported;
 }
 
 bool MediaSource::isOpen() const