Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <script src="../../resources/js-test.js"></script> | |
| 4 <body> | |
| 5 <script type="text/javascript"> | |
| 6 description("Test EME permission callbacks in WebView"); | |
| 7 | |
|
timvolodine
2016/04/08 11:15:02
add 'window.jsTestIsAsync = true;'
Yoland Yan(Google)
2016/04/11 18:15:05
The problem was that when I have jsTestIsAsync set
timvolodine
2016/04/12 14:50:45
maybe that's because you didn't have finishJSTest(
Yoland Yan(Google)
2016/04/13 04:39:19
Done.
| |
| 8 function eme() { | |
| 9 // https://w3c.github.io/encrypted-media/#requestMediaKeySystemAccess | |
|
timvolodine
2016/04/08 11:15:02
please indent the body of the function and also ma
Yoland Yan(Google)
2016/04/11 18:15:05
Done.
| |
| 10 // Tries multiple configuration per key system. The configurations are in | |
| 11 // descending order of privileges such that a supported permission-requiri ng | |
| 12 // configuration should be attempted before a configuration that does not | |
| 13 // require permissions. | |
| 14 | |
| 15 var knownKeySystems = [ | |
| 16 "com.example.somesystem", // Ensure no real system is the first tried. | |
| 17 "com.widevine.alpha", | |
| 18 "com.microsoft.playready", | |
| 19 "com.adobe.primetime", | |
| 20 "com.apple.fps.2_0", | |
| 21 "com.apple.fps", | |
| 22 "com.apple.fps.1_0", | |
| 23 "com.example.somesystem" // Ensure no real system is the last tried. | |
|
timvolodine
2016/04/08 11:15:02
nit: why does the last need to be 'somesystem' as
Yoland Yan(Google)
2016/04/11 18:15:05
I actually have no clue, the reason why it has so
timvolodine
2016/04/12 14:50:45
generally speaking it's a good idea to understand
Yoland Yan(Google)
2016/04/13 04:39:19
Got it, my apologies!
Done.
| |
| 24 ]; | |
| 25 var tryKeySystem = function(keySystem) { | |
| 26 navigator.requestMediaKeySystemAccess( | |
| 27 keySystem, | |
| 28 [ | |
| 29 { distinctiveIdentifier: "required", | |
| 30 persistentState: "required", | |
| 31 label: "'distinctiveIdentifier' and 'persistentState' required" | |
| 32 }, | |
| 33 { distinctiveIdentifier: "required", | |
| 34 label: "'distinctiveIdentifier' required" | |
| 35 }, | |
| 36 { persistentState: "required", | |
| 37 label: "'persistentState' required" | |
| 38 }, | |
| 39 { label: "empty" } | |
| 40 ] | |
| 41 ).then( | |
| 42 function (mediaKeySystemAccess) { | |
| 43 console.log("eme success"); | |
|
timvolodine
2016/04/08 11:15:02
better to use 'debug' here as well
timvolodine
2016/04/08 11:15:02
also finishJSTest() here?
Yoland Yan(Google)
2016/04/11 18:15:05
Done.
| |
| 44 }, | |
| 45 function (error) { | |
| 46 if (knownKeySystems.length > 0) | |
| 47 return tryKeySystem(knownKeySystems.shift()); | |
|
timvolodine
2016/04/08 11:15:02
slightly confused: what does this test actually te
Yoland Yan(Google)
2016/04/11 18:15:05
Ya, at least one. In this case it's "com.widevine.
timvolodine
2016/04/12 14:50:45
see my other comment
Yoland Yan(Google)
2016/04/13 04:39:19
Done.
| |
| 48 debug("onError: code" + error.code + ", message=" + error.message); | |
|
timvolodine
2016/04/08 11:15:02
testFailed(..) instead of debug?
Yoland Yan(Google)
2016/04/11 18:15:05
Done.
| |
| 49 finishJSTest(); | |
| 50 } | |
|
timvolodine
2016/04/08 11:15:03
indentation
Yoland Yan(Google)
2016/04/11 18:15:05
Done.
| |
| 51 ); | |
| 52 }; | |
| 53 tryKeySystem(knownKeySystems.shift()); | |
| 54 } | |
| 55 eme(); | |
| 56 </script> | |
| 57 </body> | |
| 58 </html> | |
| OLD | NEW |