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..1f80642c554011da99938712cadb76d6a1479b69 |
--- /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"); |
+ function eme() { |
+ // https://w3c.github.io/encrypted-media/#requestMediaKeySystemAccess |
+ // 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. |
+ ]; |
+ 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) { |
+ debug("eme success"); |
+ finishJSTest(); |
+ }, |
+ function (error) { |
+ if (knownKeySystems.length > 0) |
+ return tryKeySystem(knownKeySystems.shift()); |
+ testFailed("onError: code" + error.code + ", message=" + error.message); |
+ finishJSTest(); |
+ } |
+ ); |
+ }; |
+ tryKeySystem(knownKeySystems.shift()); |
+ } |
+ eme(); |
+ </script> |
+ </body> |
+</html> |