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 id="video"></video> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 count += i; | 48 count += i; |
49 }); | 49 }); |
50 }); | 50 }); |
51 | 51 |
52 return result.then(function() { return count; }); | 52 return result.then(function() { return count; }); |
53 }; | 53 }; |
54 | 54 |
55 promise_test(function(test) | 55 promise_test(function(test) |
56 { | 56 { |
57 var video = document.getElementById('video'); | 57 var video = document.getElementById('video'); |
| 58 var content = '../content/test-encrypted.webm'; |
58 var access; | 59 var access; |
59 var mediaKeys1; | 60 var mediaKeys1; |
60 var mediaKeys2; | 61 var mediaKeys2; |
61 var mediaKeys3; | 62 var mediaKeys3; |
62 var mediaKeys4; | 63 var mediaKeys4; |
63 var mediaKeys5; | 64 var mediaKeys5; |
64 | 65 |
65 // Start a video now so that it is waiting for MediaKeys | 66 // Start a video now so that it is waiting for MediaKeys |
66 // in order to continue. | 67 // in order to continue. |
67 video.src = '../content/test-encrypted.webm'; | 68 video.src = content; |
68 video.play(); | 69 video.play(); |
69 return wait_for_encrypted_event(video).then(function() { | 70 return wait_for_encrypted_event(video).then(function() { |
70 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); | 71 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', getConfigurationForFile(content)); |
71 }).then(function(result) { | 72 }).then(function(result) { |
72 access = result; | 73 access = result; |
73 return access.createMediaKeys(); | 74 return access.createMediaKeys(); |
74 }).then(function(result) { | 75 }).then(function(result) { |
75 mediaKeys1 = result; | 76 mediaKeys1 = result; |
76 return access.createMediaKeys(); | 77 return access.createMediaKeys(); |
77 }).then(function(result) { | 78 }).then(function(result) { |
78 mediaKeys2 = result; | 79 mediaKeys2 = result; |
79 return access.createMediaKeys(); | 80 return access.createMediaKeys(); |
80 }).then(function(result) { | 81 }).then(function(result) { |
(...skipping 14 matching lines...) Expand all Loading... |
95 return count_promise_results([p1, p2, p3, p4, p5]); | 96 return count_promise_results([p1, p2, p3, p4, p5]); |
96 }).then(function(count) { | 97 }).then(function(count) { |
97 // At least one of the setMediaKeys() calls should have | 98 // At least one of the setMediaKeys() calls should have |
98 // succeeded. | 99 // succeeded. |
99 assert_greater_than(count, 0); | 100 assert_greater_than(count, 0); |
100 }); | 101 }); |
101 }, 'Set MediaKeys multiple times in parallel.'); | 102 }, 'Set MediaKeys multiple times in parallel.'); |
102 </script> | 103 </script> |
103 </body> | 104 </body> |
104 </html> | 105 </html> |
OLD | NEW |