Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / encrypted-media / encrypted-media-set-src-twice-after-mediakeys.html
blob8c626fb304f1cfefbe75f6830cada347f092e176
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Setting src twice after MediaKeys set</title>
5 <script src="encrypted-media-utils.js"></script>
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10 <video id="testVideo"></video>
11 <div id="log"></div>
12 <script>
13 async_test(function(test)
15 var mediaKeys;
16 var encryptedEventIndex = 0;
17 var video = document.getElementById('testVideo');
18 assert_not_equals(video, null);
20 var onEncrypted = function(event)
22 ++encryptedEventIndex;
23 assert_not_equals(video.mediaKeys, null);
24 assert_true(video.mediaKeys === mediaKeys);
26 // This event is fired once for the audio stream and once
27 // for the video stream each time .src is set.
28 if (encryptedEventIndex == 2) {
29 // Finished first video, set src a second time.
30 video.src = '../content/test-encrypted.webm';
31 } else if (encryptedEventIndex == 4) {
32 // Finished second video.
33 test.done();
37 // Create a MediaKeys object and assign it to video.
38 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}])
39 .then(function(access) {
40 assert_equals(access.keySystem, 'org.w3.clearkey');
41 return access.createMediaKeys();
42 }).then(function(result) {
43 mediaKeys = result;
44 assert_not_equals(mediaKeys, null);
45 return video.setMediaKeys(mediaKeys);
46 }).then(function(result) {
47 assert_not_equals(video.mediaKeys, null, 'not set initially');
48 assert_true(video.mediaKeys === mediaKeys);
50 // Set src to a video.
51 waitForEventAndRunStep('encrypted', video, onEncrypted, test);
52 video.src = '../content/test-encrypted.webm';
53 }).catch(function(error) {
54 forceTestFailureFromPromise(test, error);
55 });
56 }, 'Setting src twice after MediaKeys set.');
57 </script>
58 </body>
59 </html>