summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/encrypted-media/Google/migrated_to_root_disabled/encrypted-media-onencrypted.html
blob: ad408f0f313f1fa57841cbb18b77b31e54f7304b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
<html>
    <head>
        <title>onencrypted</title>
        <script src="encrypted-media-utils.js"></script>
<!--
        Test has been migrated to the root directory and is being disabled here.
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>
-->
    </head>
    <body>
        <video id="testVideo" controls></video>
        <div id="log"></div>
        <script>
            var expectedInitData = stringToUint8Array('0123456789012345');

            // Will get 2 identical events, one for audio, one for video.
            var expectedEvents = 2;

            async_test(function(test)
            {
                var video = document.getElementById('testVideo');
                var content = 'webm/test-encrypted.webm';

                var onEncrypted = function(event)
                {
                    assert_equals(event.target, video);
                    assert_true(event instanceof window.MediaEncryptedEvent);
                    assert_equals(event.type, 'encrypted');
                    assert_equals(event.initDataType, 'webm');
                    assert_array_equals(new Uint8Array(event.initData), expectedInitData);

                    if (--expectedEvents == 0)
                        test.done();
                };

                waitForEventAndRunStep('encrypted', video, onEncrypted, test);
                video.src = content;
            }, 'encrypted fired on encrypted media file.');
        </script>
    </body>
</html>