Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2231)

Unified Diff: android_webview/tools/system_webview_shell/test/data/blink-apis/eme/eme.html

Issue 1865383002: Add EME permission test to WebViewLayoutTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698