summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/encrypted-media/Google/migrated_to_root_disabled/encrypted-media-setmediakeys-multiple-times-with-the-same-mediakeys.html
blob: 64ed315e0c9c2e6743ee9b68e146d433f5fafeec (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
45
46
47
48
49
50
<!DOCTYPE html>
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
<html>
    <head>
        <title>setMediaKeys() multiple times with the same MediaKeys.</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="video"></video>
        <div id="log"></div>
        <script>
            promise_test(function(test)
            {
                var video = document.getElementById('video');
                var content = 'webm/test-encrypted.webm';
                var mediaKeys;

                assert_equals(video.mediaKeys, null);

                return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
                    return access.createMediaKeys();
                }).then(function(result) {
                    mediaKeys = result;
                    assert_not_equals(mediaKeys, null);
                    // Set mediaKeys on video should work.
                    return video.setMediaKeys(mediaKeys);
                }).then(function() {
                    assert_true(video.mediaKeys === mediaKeys);
                    // Set mediaKeys on video again should return a resolved
                    // promise.
                    return video.setMediaKeys(mediaKeys);
                }).then(function() {
                    assert_true(video.mediaKeys === mediaKeys);
                    // Load the media element to create the WebMediaPlayer.
                    video.src = content;
                    // Set mediaKeys again on video should still return a
                    // resolved promise.
                    return video.setMediaKeys(mediaKeys);
                }).then(function() {
                    assert_true(video.mediaKeys === mediaKeys);
                });
            }, 'setMediaKeys() multiple times with the same MediaKeys.');
        </script>
    </body>
</html>