Skip to content

Commit

Permalink
[eme] Check if HDCP policy is supported (#14384)
Browse files Browse the repository at this point in the history
In [1] there is a proposal to add the ability to know before fetching content
if HDCP (and what version) can be enforced. This adds a test to check if it
is supported.

[1] https://github.com/WICG/hdcp-detection/blob/master/explainer.md
  • Loading branch information
jrummell-chromium authored and foolip committed Jan 24, 2019
1 parent 01e59d3 commit 2cc428d
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
32 changes: 32 additions & 0 deletions encrypted-media/clearkey-check-status-for-hdcp.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: Check HDCP status with Clear Key</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">

<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>

<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/utf8.js></script>

<!-- Content metadata -->
<!--<script src=/encrypted-media/content/content-metadata.js></script>-->

<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/check-status-for-hdcp.js></script>

</head>
<body>
<div id='log'></div>

<script>
var config = { keysystem: 'org.w3.clearkey' }

runTest(config);
</script>
</body>
</html>
32 changes: 32 additions & 0 deletions encrypted-media/drm-check-status-for-hdcp.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: Check HDCP status with DRM</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">

<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>

<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/utf8.js></script>

<!-- Content metadata -->
<!--<script src=/encrypted-media/content/content-metadata.js></script>-->

<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/check-status-for-hdcp.js></script>

</head>
<body>
<div id='log'></div>

<script>
var config = { keysystem: getSupportedKeySystem() }

runTest(config);
</script>
</body>
</html>
26 changes: 26 additions & 0 deletions encrypted-media/scripts/check-status-for-hdcp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function runTest(config, qualifier)
{
function checkStatusForMinHdcpVersionPolicy(hdcpVersion)
{
return navigator.requestMediaKeySystemAccess(config.keysystem, getSimpleConfiguration())
.then(function(access) {
return access.createMediaKeys();
})
.then(function(mediaKeys) {
// As HDCP policy depends on the hardware running this test,
// don't bother checking the result returned as it may or
// may not be supported. This simply verifies that
// getStatusForPolicy() exists and doesn't blow up.
return mediaKeys.getStatusForPolicy({minHdcpVersion: hdcpVersion});
});
}

promise_test(
() => checkStatusForMinHdcpVersionPolicy(''),
testnamePrefix(qualifier, config.keysystem) +
' support for empty HDCP version.');

promise_test(
() => checkStatusForMinHdcpVersionPolicy('1.0'),
testnamePrefix(qualifier, config.keysystem) + ' support for HDCP 1.0.');
}

0 comments on commit 2cc428d

Please sign in to comment.