OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Verify MediaKeySession.keyStatuses with multiple sessions</title> | 4 <title>Verify MediaKeySession.keyStatuses with multiple sessions</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 <div id="log"></div> | 10 <div id="log"></div> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Check that keyStatuses contains the expected key2 only. | 81 // Check that keyStatuses contains the expected key2 only. |
82 dumpKeyStatuses(mediaKeySession2.keyStatuses); | 82 dumpKeyStatuses(mediaKeySession2.keyStatuses); |
83 verifyKeyStatuses(mediaKeySession2.keyStatuses, { expected:
[key2], unexpected: [key1] }); | 83 verifyKeyStatuses(mediaKeySession2.keyStatuses, { expected:
[key2], unexpected: [key1] }); |
84 | 84 |
85 // session1 should still have 1 key. | 85 // session1 should still have 1 key. |
86 verifyKeyStatuses(mediaKeySession1.keyStatuses, { expected:
[key1], unexpected: [key2] }); | 86 verifyKeyStatuses(mediaKeySession1.keyStatuses, { expected:
[key1], unexpected: [key2] }); |
87 | 87 |
88 test.done(); | 88 test.done(); |
89 } | 89 } |
90 | 90 |
91 getSupportedInitDataType().then(function(type) { | 91 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { |
92 initDataType = type; | 92 initDataType = access.getConfiguration().initDataTypes[0]; |
93 initData = getInitData(initDataType); | 93 initData = getInitData(initDataType); |
94 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); | |
95 }).then(function(access) { | |
96 return access.createMediaKeys(); | 94 return access.createMediaKeys(); |
97 }).then(function(mediaKeys) { | 95 }).then(function(mediaKeys) { |
98 mediaKeySession1 = mediaKeys.createSession(); | 96 mediaKeySession1 = mediaKeys.createSession(); |
99 mediaKeySession2 = mediaKeys.createSession(); | 97 mediaKeySession2 = mediaKeys.createSession(); |
100 | 98 |
101 // There should be no keys defined on either session. | 99 // There should be no keys defined on either session. |
102 verifyKeyStatuses(mediaKeySession1.keyStatuses, { expected:
[], unexpected: [key1, key2] }); | 100 verifyKeyStatuses(mediaKeySession1.keyStatuses, { expected:
[], unexpected: [key1, key2] }); |
103 verifyKeyStatuses(mediaKeySession2.keyStatuses, { expected:
[], unexpected: [key1, key2] }); | 101 verifyKeyStatuses(mediaKeySession2.keyStatuses, { expected:
[], unexpected: [key1, key2] }); |
104 | 102 |
105 // Bind all the event handlers now. | 103 // Bind all the event handlers now. |
106 waitForEventAndRunStep('message', mediaKeySession1, processM
essage1, test); | 104 waitForEventAndRunStep('message', mediaKeySession1, processM
essage1, test); |
107 waitForEventAndRunStep('message', mediaKeySession2, processM
essage2, test); | 105 waitForEventAndRunStep('message', mediaKeySession2, processM
essage2, test); |
108 waitForEventAndRunStep('keystatuseschange', mediaKeySession1
, processKeyStatusesChange1, test); | 106 waitForEventAndRunStep('keystatuseschange', mediaKeySession1
, processKeyStatusesChange1, test); |
109 waitForEventAndRunStep('keystatuseschange', mediaKeySession2
, processKeyStatusesChange2, test); | 107 waitForEventAndRunStep('keystatuseschange', mediaKeySession2
, processKeyStatusesChange2, test); |
110 | 108 |
111 // Generate a request on session1. | 109 // Generate a request on session1. |
112 return mediaKeySession1.generateRequest(initDataType, initDa
ta); | 110 return mediaKeySession1.generateRequest(initDataType, initDa
ta); |
113 }).catch(function(error) { | 111 }).catch(function(error) { |
114 forceTestFailureFromPromise(test, error); | 112 forceTestFailureFromPromise(test, error); |
115 }); | 113 }); |
116 }, 'Verify MediaKeySession.keyStatuses with multiple sessions.'); | 114 }, 'Verify MediaKeySession.keyStatuses with multiple sessions.'); |
117 </script> | 115 </script> |
118 </body> | 116 </body> |
119 </html> | 117 </html> |
OLD | NEW |