OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Verify MediaKeySession.keyStatuses with multiple updates</title> | 4 <title>Verify MediaKeySession.keyStatuses with multiple updates</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> |
11 <script> | 11 <script> |
12 var initDataType; | |
sandersd (OOO until July 31)
2015/03/17 22:23:17
Now that I'm thinking about it, this should all be
jrummell
2015/03/17 23:49:12
Moved inside the test.
| |
13 var initData; | |
12 var mediaKeySession; | 14 var mediaKeySession; |
13 var firstEvent; | 15 var firstEvent; |
14 | 16 |
15 // Even though key ids are uint8, using printable values so that | 17 // Even though key ids are uint8, using printable values so that |
16 // they can be verified easily. | 18 // they can be verified easily. |
17 var key1 = stringToUint8Array('123'); | 19 var key1 = stringToUint8Array('123'); |
18 var key2 = stringToUint8Array('4567890'); | 20 var key2 = stringToUint8Array('4567890'); |
19 var rawKey1 = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0x d2, 0x7b, | 21 var rawKey1 = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0x d2, 0x7b, |
20 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0x ae, 0x3c]); | 22 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0x ae, 0x3c]); |
21 var rawKey2 = new Uint8Array([0x3c, 0xae, 0xe4, 0xfc, 0x2a, 0x12, 0x ef, 0x68, | 23 var rawKey2 = new Uint8Array([0x3c, 0xae, 0xe4, 0xfc, 0x2a, 0x12, 0x ef, 0x68, |
(...skipping 29 matching lines...) Expand all Loading... | |
51 }); | 53 }); |
52 } else { | 54 } else { |
53 // Verify that the session now contains key1 and key2. | 55 // Verify that the session now contains key1 and key2. |
54 dumpKeyStatuses(mediaKeySession.keyStatuses); | 56 dumpKeyStatuses(mediaKeySession.keyStatuses); |
55 verifyKeyStatuses(mediaKeySession.keyStatuses, { expecte d: [key1, key2] }); | 57 verifyKeyStatuses(mediaKeySession.keyStatuses, { expecte d: [key1, key2] }); |
56 | 58 |
57 test.done(); | 59 test.done(); |
58 } | 60 } |
59 } | 61 } |
60 | 62 |
61 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t hen(function(access) { | 63 getSupportedInitDataType().then(function(type) { |
64 initDataType = type; | |
65 initData = getInitData(initDataType); | |
66 return navigator.requestMediaKeySystemAccess('org.w3.clearke y', [{}]); | |
67 }).then(function(access) { | |
62 return access.createMediaKeys(); | 68 return access.createMediaKeys(); |
63 }).then(function(mediaKeys) { | 69 }).then(function(mediaKeys) { |
64 var initDataType = getInitDataType(); | |
65 mediaKeySession = mediaKeys.createSession(); | 70 mediaKeySession = mediaKeys.createSession(); |
66 | 71 |
67 // There should be no keys defined yet. | 72 // There should be no keys defined yet. |
68 assert_equals(mediaKeySession.keyStatuses.size, 0); | 73 assert_equals(mediaKeySession.keyStatuses.size, 0); |
69 | 74 |
70 waitForEventAndRunStep('message', mediaKeySession, processMe ssage, test); | 75 waitForEventAndRunStep('message', mediaKeySession, processMe ssage, test); |
71 waitForEventAndRunStep('keystatuseschange', mediaKeySession, processKeyStatusesChange, test); | 76 waitForEventAndRunStep('keystatuseschange', mediaKeySession, processKeyStatusesChange, test); |
72 | 77 |
73 return mediaKeySession.generateRequest(initDataType, getInit Data(initDataType)); | 78 return mediaKeySession.generateRequest(initDataType, initDat a); |
74 }).catch(function(error) { | 79 }).catch(function(error) { |
75 forceTestFailureFromPromise(test, error); | 80 forceTestFailureFromPromise(test, error); |
76 }); | 81 }); |
77 }, 'Verify MediaKeySession.keyStatuses with multiple updates.'); | 82 }, 'Verify MediaKeySession.keyStatuses with multiple updates.'); |
78 </script> | 83 </script> |
79 </body> | 84 </body> |
80 </html> | 85 </html> |
OLD | NEW |