Index: android_webview/tools/system_webview_shell/test/data/blink-apis/eme/eme.html |
diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/eme/eme.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/eme/eme.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a8dc21f0cf621f68f247cb8895ee1b1b59497ca5 |
--- /dev/null |
+++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/eme/eme.html |
@@ -0,0 +1,58 @@ |
+<!DOCTYPE html> |
+<html> |
+ <script src="../../resources/js-test.js"></script> |
+ <body> |
+ <script type="text/javascript"> |
+ description("Test EME permission callbacks in WebView"); |
+ |
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.
|
+ function eme() { |
+ // 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.
|
+ // Tries multiple configuration per key system. The configurations are in |
+ // descending order of privileges such that a supported permission-requiring |
+ // configuration should be attempted before a configuration that does not |
+ // require permissions. |
+ |
+ var knownKeySystems = [ |
+ "com.example.somesystem", // Ensure no real system is the first tried. |
+ "com.widevine.alpha", |
+ "com.microsoft.playready", |
+ "com.adobe.primetime", |
+ "com.apple.fps.2_0", |
+ "com.apple.fps", |
+ "com.apple.fps.1_0", |
+ "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.
|
+ ]; |
+ var tryKeySystem = function(keySystem) { |
+ navigator.requestMediaKeySystemAccess( |
+ keySystem, |
+ [ |
+ { distinctiveIdentifier: "required", |
+ persistentState: "required", |
+ label: "'distinctiveIdentifier' and 'persistentState' required" |
+ }, |
+ { distinctiveIdentifier: "required", |
+ label: "'distinctiveIdentifier' required" |
+ }, |
+ { persistentState: "required", |
+ label: "'persistentState' required" |
+ }, |
+ { label: "empty" } |
+ ] |
+ ).then( |
+ function (mediaKeySystemAccess) { |
+ 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.
|
+ }, |
+ function (error) { |
+ if (knownKeySystems.length > 0) |
+ 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.
|
+ 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.
|
+ finishJSTest(); |
+ } |
timvolodine
2016/04/08 11:15:03
indentation
Yoland Yan(Google)
2016/04/11 18:15:05
Done.
|
+ ); |
+ }; |
+ tryKeySystem(knownKeySystems.shift()); |
+ } |
+ eme(); |
+ </script> |
+ </body> |
+</html> |