Commit 9313e351 authored by yolandyan's avatar yolandyan Committed by Commit bot

Add EME permission test to WebViewLayoutTest

BUG=490795

Review URL: https://codereview.chromium.org/1865383002

Cr-Commit-Position: refs/heads/master@{#389817}
parent 2d26a030
...@@ -243,6 +243,14 @@ public class WebViewLayoutTest ...@@ -243,6 +243,14 @@ public class WebViewLayoutTest
"blink-apis/battery-status/battery-callback-expected.txt"); "blink-apis/battery-status/battery-callback-expected.txt");
} }
@MediumTest
public void testEMEPermission() throws Exception {
mTestActivity.setGrantPermission(true);
runWebViewLayoutTest("blink-apis/eme/eme.html", "blink-apis/eme/eme-expected.txt");
mTestActivity.setGrantPermission(false);
}
// test helper methods // test helper methods
private void runWebViewLayoutTest(final String fileName, final String fileNameExpected) private void runWebViewLayoutTest(final String fileName, final String fileNameExpected)
......
Test EME callbacks in WebView
keySystem is com.widevine.alpha
onPermissionRequest: android.webkit.resource.PROTECTED_MEDIA_ID
request granted: android.webkit.resource.PROTECTED_MEDIA_ID
EME success
TEST FINISHED
<!DOCTYPE html>
<html>
<script src="../../resources/js-test.js"></script>
<body>
<script type="text/javascript">
description("Test EME callbacks in WebView");
window.jsTestIsAsync = true;
// TODO(yolandyan) Look into whether more key system need to be added
var chromeKeySystem = "com.widevine.alpha"
var tryKeySystem = function(keySystem) {
debug("keySystem is " + 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) {
debug("onError: code" + error.code + ", message=" + error.message);
finishJSTest();
}
);
};
tryKeySystem(chromeKeySystem);
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment