OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Set MediaKeys multiple times in parallel</title> | 4 <title>Set MediaKeys multiple times in parallel</title> |
5 <script src="encrypted-media-utils.js"></script> | 5 <script src="encrypted-media-utils.js"></script> |
6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <video id="video"></video> | 10 <video></video> |
11 <div id="log"></div> | |
12 <script> | 11 <script> |
13 // Wait for an 'encrypted' event as a promise. | 12 // Wait for an 'encrypted' event as a promise. |
14 function wait_for_encrypted_event(video) | 13 function wait_for_encrypted_event(video) |
15 { | 14 { |
16 return new Promise(function(resolve) { | 15 return new Promise(function(resolve) { |
17 video.addEventListener('encrypted', function listener(e) { | 16 video.addEventListener('encrypted', function listener(e) { |
18 video.removeEventListener('encrypted', listener); | 17 video.removeEventListener('encrypted', listener); |
19 resolve(); | 18 resolve(); |
20 }); | 19 }); |
21 }); | 20 }); |
(...skipping 25 matching lines...) Expand all Loading... |
47 }).then(function(i) { | 46 }).then(function(i) { |
48 count += i; | 47 count += i; |
49 }); | 48 }); |
50 }); | 49 }); |
51 | 50 |
52 return result.then(function() { return count; }); | 51 return result.then(function() { return count; }); |
53 }; | 52 }; |
54 | 53 |
55 promise_test(function(test) | 54 promise_test(function(test) |
56 { | 55 { |
57 var video = document.getElementById('video'); | 56 var video = document.querySelector('video'); |
58 var content = '../content/test-encrypted.webm'; | 57 var content = '../content/test-encrypted.webm'; |
59 var access; | 58 var access; |
60 var mediaKeys1; | 59 var mediaKeys1; |
61 var mediaKeys2; | 60 var mediaKeys2; |
62 var mediaKeys3; | 61 var mediaKeys3; |
63 var mediaKeys4; | 62 var mediaKeys4; |
64 var mediaKeys5; | 63 var mediaKeys5; |
65 | 64 |
66 // Start a video now so that it is waiting for MediaKeys | 65 // Start a video now so that it is waiting for MediaKeys |
67 // in order to continue. | 66 // in order to continue. |
(...skipping 28 matching lines...) Expand all Loading... |
96 return count_promise_results([p1, p2, p3, p4, p5]); | 95 return count_promise_results([p1, p2, p3, p4, p5]); |
97 }).then(function(count) { | 96 }).then(function(count) { |
98 // At least one of the setMediaKeys() calls should have | 97 // At least one of the setMediaKeys() calls should have |
99 // succeeded. | 98 // succeeded. |
100 assert_greater_than(count, 0); | 99 assert_greater_than(count, 0); |
101 }); | 100 }); |
102 }, 'Set MediaKeys multiple times in parallel.'); | 101 }, 'Set MediaKeys multiple times in parallel.'); |
103 </script> | 102 </script> |
104 </body> | 103 </body> |
105 </html> | 104 </html> |
OLD | NEW |