[EME] Add layout test for InitData and InitDataType in WebM encrypted event
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2018 10:27:20 +0000 (10:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2018 10:27:20 +0000 (10:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189196

Patch by Yacine Bandou <yacine.bandou@softathome.com> on 2018-09-04
Reviewed by Xabier Rodriguez-Calvar.

This commit adds a new layoutTest in order to test the reception of the encrypted WebM
event with an expected initData and initDataType fields.

* media/content/encrypted/VideoClearKeyWebM.webm: Added.
    This is a simple encrypted video.
    It has been encrypted with webm_crypt see https://github.com/webmproject/webm-tools.
    #webm_crypt  -i VideoWebM.webm -audio false -video true -video_options base_file=bear.key,content_id="0123456789012345" -o VideoClearKeyWebM.webm
* media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse-expected.txt: Added.
* media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html: Added.
* media/encrypted-media/medias-enc.js:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/wpe/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/media/content/encrypted/VideoClearKeyWebM.webm [new file with mode: 0644]
LayoutTests/media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse-expected.txt [new file with mode: 0644]
LayoutTests/media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html [new file with mode: 0644]
LayoutTests/media/encrypted-media/medias-enc.js
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/wpe/TestExpectations

index 68e3ad2..a17ca93 100644 (file)
@@ -1,3 +1,24 @@
+2018-09-04  Yacine Bandou  <yacine.bandou@softathome.com>
+
+        [EME] Add layout test for InitData and InitDataType in WebM encrypted event
+        https://bugs.webkit.org/show_bug.cgi?id=189196
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        This commit adds a new layoutTest in order to test the reception of the encrypted WebM
+        event with an expected initData and initDataType fields.
+
+        * media/content/encrypted/VideoClearKeyWebM.webm: Added.
+            This is a simple encrypted video.
+            It has been encrypted with webm_crypt see https://github.com/webmproject/webm-tools.
+            #webm_crypt  -i VideoWebM.webm -audio false -video true -video_options base_file=bear.key,content_id="0123456789012345" -o VideoClearKeyWebM.webm
+        * media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse-expected.txt: Added.
+        * media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html: Added.
+        * media/encrypted-media/medias-enc.js:
+        * platform/gtk/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/wpe/TestExpectations:
+
 2018-09-03  Andy Estes  <aestes@apple.com>
 
         [Payment Request] Remove PaymentAddress.languageCode
diff --git a/LayoutTests/media/content/encrypted/VideoClearKeyWebM.webm b/LayoutTests/media/content/encrypted/VideoClearKeyWebM.webm
new file mode 100644 (file)
index 0000000..2ca98d0
Binary files /dev/null and b/LayoutTests/media/content/encrypted/VideoClearKeyWebM.webm differ
diff --git a/LayoutTests/media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse-expected.txt b/LayoutTests/media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse-expected.txt
new file mode 100644 (file)
index 0000000..e7136a8
--- /dev/null
@@ -0,0 +1,10 @@
+
+EME API is supported OK
+Media source is opened OK
+EVENT(encrypted)
+EXPECTED (onEncryptedEvent.target == '[object HTMLVideoElement]') OK
+EXPECTED (onEncryptedEvent instanceof 'function MediaEncryptedEvent() { [native code] }') OK
+EXPECTED (onEncryptedEvent.initDataType.toLowerCase() == 'webm') OK
+EXPECTED (onEncryptedEvent.initData != 'null') OK
+END OF TEST
+
diff --git a/LayoutTests/media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html b/LayoutTests/media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html
new file mode 100644 (file)
index 0000000..00b17ab
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Encrypted ClearKey WebM Event</title>
+    <script src="../medias-enc.js"></script>
+    <script src="../../video-test.js"></script>
+    <script src="../../media-source/media-source-loader-simple.js"></script>
+    <script>
+    var onEncryptedEvent;
+
+    function runTest() {
+        if (!navigator.requestMediaKeySystemAccess) {
+            logResult(false, "EME API is not supported");
+            return;
+        } else {
+            logResult(true, "EME API is supported");
+        }
+
+        findMediaElement();
+
+        waitForEventOn(video, "encrypted", encrypted);
+
+        function encrypted(event) {
+            onEncryptedEvent = event;
+            testExpected("onEncryptedEvent.target", video);
+            testExpected("onEncryptedEvent", window.MediaEncryptedEvent, "instanceof");
+            testExpected("onEncryptedEvent.initDataType.toLowerCase()", "webm");
+            testExpected("onEncryptedEvent.initData", null, "!=");
+            endTest();
+        }
+
+        var ms = new MediaSourceLoaderSimple(video);
+
+        ms.onready = function() {
+            logResult(true, "Media source is opened");
+            ms.createSourceBuffer(streamMedias["simpleClearKeyWebMMSE"].video, 1);
+        };
+    }
+    </script>
+</head>
+<body onload="runTest()">
+    <video></video>
+</body>
+</html>
index 6758fdb..4ebad4c 100644 (file)
@@ -23,5 +23,11 @@ const streamMedias = {
                                             path         : "../../content/encrypted/VideoClearKeyCenc.mp4",
                                             keys         : {    "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf" : "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf" }
                                        }
+                          },
+    "simpleClearKeyWebMMSE": { video : {    initDataType : "webm",
+                                            mimeType     : 'video/webm; codecs="vp9"',
+                                            segments     : [ "../../content/encrypted/VideoClearKeyWebM.webm" ],
+                                            keys         : {    "30313233343536373839303132333435" : "4d24cb6b0de1abe880e4d5983df03c93" }
+                                       }
                           }
                    };
index 308ef65..741673b 100644 (file)
@@ -1383,6 +1383,7 @@ webkit.org/b/104809 media/track/track-cues-pause-on-exit.html [ Timeout Pass ]
 
 webkit.org/b/180430 media/encrypted-media/clearKey/clearKey-encrypted-cenc-event.html [ Skip ]
 webkit.org/b/180430 media/encrypted-media/clearKey/clearKey-encrypted-cenc-event-mse.html [ Skip ]
+webkit.org/b/189196 media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html [ Skip ]
 webkit.org/b/180928 media/encrypted-media/clearKey/clearKey-message-cenc-event.html [ Skip ]
 webkit.org/b/180928 media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html [ Skip ]
 webkit.org/b/181594 media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html [ Skip ]
index 878c31c..de80996 100644 (file)
@@ -1325,6 +1325,7 @@ media/encrypted-media/mock-MediaKeySession-update.html [ Skip ]
 
 webkit.org/b/180430 media/encrypted-media/clearKey/clearKey-encrypted-cenc-event.html [ Skip ]
 webkit.org/b/180430 media/encrypted-media/clearKey/clearKey-encrypted-cenc-event-mse.html [ Skip ]
+webkit.org/b/189196 media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html [ Skip ]
 webkit.org/b/180928 media/encrypted-media/clearKey/clearKey-message-cenc-event.html [ Skip ]
 webkit.org/b/180928 media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html [ Skip ]
 webkit.org/b/181594 media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html [ Skip ]
index 2941dc6..702a6ed 100644 (file)
@@ -332,6 +332,9 @@ imported/w3c/web-platform-tests/encrypted-media/drm-mp4-waiting-for-a-key.https.
 imported/w3c/web-platform-tests/encrypted-media/drm-not-callable-after-createsession.https.html [ Skip ]
 imported/w3c/web-platform-tests/encrypted-media/drm-temporary-license-type.https.html [ Skip ]
 
+# Encrypted WebM is not supported yet.
+webkit.org/b/189196 media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html [ Skip ]
+
 # This port doesn't support detecting slow unload handlers.
 Bug(GTK) fast/dom/Window/slow-unload-handler.html [ WontFix Timeout Failure ]
 Bug(GTK) fast/dom/Window/slow-unload-handler-only-frame-is-stopped.html [ WontFix Timeout Failure ]