Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0

This commit is contained in:
Ms2ger 2016-09-09 09:40:35 +02:00
parent 1d40075f03
commit 079092dfea
2381 changed files with 90360 additions and 17722 deletions

View file

@ -0,0 +1,118 @@
// Encrypted Media Extensions WebIDL
//
// NOTE: Please update the link below to the specification version from
// which this IDL was extracted.
//
// https://www.w3.org/TR/2016/WD-encrypted-media-20160610/
//
partial interface Navigator {
Promise<MediaKeySystemAccess> requestMediaKeySystemAccess (DOMString keySystem, sequence<MediaKeySystemConfiguration> supportedConfigurations);
};
enum MediaKeysRequirement {
"required",
"optional",
"not-allowed"
};
dictionary MediaKeySystemConfiguration {
DOMString label = "";
sequence<DOMString> initDataTypes = [];
sequence<MediaKeySystemMediaCapability> audioCapabilities = [];
sequence<MediaKeySystemMediaCapability> videoCapabilities = [];
MediaKeysRequirement distinctiveIdentifier = "optional";
MediaKeysRequirement persistentState = "optional";
sequence<DOMString> sessionTypes;
};
dictionary MediaKeySystemMediaCapability {
DOMString contentType = "";
DOMString robustness = "";
};
interface MediaKeySystemAccess {
readonly attribute DOMString keySystem;
MediaKeySystemConfiguration getConfiguration ();
Promise<MediaKeys> createMediaKeys ();
};
enum MediaKeySessionType {
"temporary",
"persistent-usage-record",
"persistent-license"
};
interface MediaKeys {
MediaKeySession createSession (optional MediaKeySessionType sessionType = "temporary");
Promise<boolean> setServerCertificate (BufferSource serverCertificate);
};
interface MediaKeySession : EventTarget {
readonly attribute DOMString sessionId;
readonly attribute unrestricted double expiration;
readonly attribute Promise<void> closed;
readonly attribute MediaKeyStatusMap keyStatuses;
attribute EventHandler onkeystatuseschange;
attribute EventHandler onmessage;
Promise<void> generateRequest (DOMString initDataType, BufferSource initData);
Promise<boolean> load (DOMString sessionId);
Promise<void> update (BufferSource response);
Promise<void> close ();
Promise<void> remove ();
};
interface MediaKeyStatusMap {
iterable<BufferSource,MediaKeyStatus>;
readonly attribute unsigned long size;
boolean has (BufferSource keyId);
any get (BufferSource keyId);
};
enum MediaKeyStatus {
"usable",
"expired",
"released",
"output-restricted",
"output-downscaled",
"status-pending",
"internal-error"
};
enum MediaKeyMessageType {
"license-request",
"license-renewal",
"license-release",
"individualization-request"
};
[ Constructor (DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
interface MediaKeyMessageEvent : Event {
readonly attribute MediaKeyMessageType messageType;
readonly attribute ArrayBuffer message;
};
dictionary MediaKeyMessageEventInit : EventInit {
MediaKeyMessageType messageType = "license-request";
ArrayBuffer message;
};
// partial interface HTMLMediaElement : EventTarget {
partial interface HTMLMediaElement {
readonly attribute MediaKeys? mediaKeys;
attribute EventHandler onencrypted;
attribute EventHandler onwaitingforkey;
Promise<void> setMediaKeys (MediaKeys? mediaKeys);
};
[ Constructor (DOMString type, optional MediaEncryptedEventInit eventInitDict)]
interface MediaEncryptedEvent : Event {
readonly attribute DOMString initDataType;
readonly attribute ArrayBuffer? initData;
};
dictionary MediaEncryptedEventInit : EventInit {
DOMString initDataType = "";
ArrayBuffer? initData = null;
};

View file

@ -4,8 +4,11 @@
<head>
<title>Test asynchronous creation of MediaKeys and MediaKeySession while running garbage collection</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -18,11 +21,9 @@
var initDataType;
var initData;
var mediaKeySession;
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

View file

@ -4,8 +4,11 @@
<head>
<title>Test asynchronous setServerCertificate while running garbage collection</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -15,7 +18,7 @@
promise_test(function(test)
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var cert = new Uint8Array(200);

View file

@ -4,8 +4,11 @@
<head>
<title>Test MediaKeys lifetime when adding a session</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -32,12 +35,9 @@
}
// Create a MediaKeys object with a session.
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

View file

@ -4,8 +4,11 @@
<head>
<title>Test MediaKeys lifetime</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -13,7 +16,7 @@
async_test(function(test)
{
// Create a MediaKeys object and free immediately.
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
// Do nothing with the created object
@ -31,7 +34,7 @@
async_test(function(test)
{
var mediaKeys;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

View file

@ -4,8 +4,11 @@
<head>
<title>Test MediaKeySession lifetime without release()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -32,12 +35,9 @@
return window.internals.activeDOMObjectCount(document) - startingActiveDOMObjectCount;
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

View file

@ -4,8 +4,11 @@
<head>
<title>Test MediaKeySession lifetime after release() without references</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -31,11 +34,10 @@
var mediaKeys;
var mediaKeySession1;
var mediaKeySession2;
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

View file

@ -4,8 +4,11 @@
<head>
<title>MediaKeySession lifetime after release()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -31,11 +34,9 @@
}
// Create 2 sessions.
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

View file

@ -4,8 +4,11 @@
<head>
<title>Test multiple MediaKeys lifetimes</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -25,9 +28,7 @@
// with the new MediaKeys object.
function createMediaKeys()
{
return getSupportedInitDataType().then(function(type) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
return mediaKeys;

View file

@ -4,8 +4,11 @@
<head>
<title>Reloading during encrypted media playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test requires Chromium specific content and is being disabled.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +17,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var mediaKeySession = null;
var hasSessionUpdateSucceeded = false;
var encryptedEventCount = 0;
@ -81,12 +85,12 @@
location.reload();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
waitForEventAndRunStep('playing', video, onPlaying, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.play();

View file

@ -4,8 +4,8 @@
<head>
<title>Invalid Clear Key License.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -27,11 +27,9 @@
});
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var keySession = mediaKeys.createSession();

View file

@ -4,8 +4,8 @@
<head>
<title>Test Clear Key handling of non-ASCII responses for update().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -16,6 +16,7 @@
async_test(function(test)
{
var initDataType;
var initData;
var mediaKeySession;
function processMessage(event)
@ -34,15 +35,14 @@
});
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();
waitForEventAndRunStep('message', mediaKeySession, processMessage, test);
return mediaKeySession.generateRequest(initDataType, getInitData(initDataType));
return mediaKeySession.generateRequest(initDataType, initData);
});
}, 'Clear Key update() with non-ASCII response.');
</script>

View file

@ -4,8 +4,8 @@
<head>
<title>Verify MediaKeySession.keyStatuses with multiple sessions</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -89,11 +89,9 @@
test.done();
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession1 = mediaKeys.createSession();

View file

@ -4,8 +4,8 @@
<head>
<title>Verify MediaKeySession.keyStatuses with multiple updates</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -61,11 +61,9 @@
}
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

View file

@ -4,8 +4,8 @@
<head>
<title>onencrypted</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo" controls></video>
@ -19,6 +19,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var onEncrypted = function(event)
{
@ -33,7 +34,7 @@
};
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
}, 'encrypted fired on encrypted media file.');
</script>
</body>

View file

@ -4,8 +4,8 @@
<head>
<title>Multiple playbacks alternating between encrypted and clear sources.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -18,6 +18,10 @@
var encryptedEventCount = 0;
var playbackCount = 0;
// Content to be played. These files must be the same format.
var encryptedContent = 'webm/test-encrypted.webm';
var unencryptedContent = 'webm/test.webm';
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
@ -93,18 +97,20 @@
}
function startPlayback() {
// Alternate between encrypted and unencrypted files.
if (playbackCount % 2) {
video.src = '../content/test-vp8-vorbis-webvtt.webm';
// Unencrypted files don't require MediaKeys.
video.src = unencryptedContent;
video.play();
return;
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(encryptedContent)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.src = '../content/test-encrypted.webm';
video.src = encryptedContent;
assert_false(video.mediaKeys === null, "video.mediaKeys is null.");
video.play();
}).catch(function(error) {

View file

@ -4,8 +4,8 @@
<head>
<title>Clear Key Playback with Multiple Sessions</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +14,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted-different-av-keys.webm';
var audioMediaKeySession = null;
var videoMediaKeySession = null;
var audioInitDataType = null;
@ -121,12 +122,12 @@
test.done();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
waitForEventAndRunStep('playing', video, onPlaying, test);
video.src = '../content/test-encrypted-different-av-keys.webm';
video.src = content;
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.play();

View file

@ -4,8 +4,8 @@
<head>
<title>Test navigator.requestMediaKeySystemAccess()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -4,8 +4,8 @@
<head>
<title>Reset src after setMediaKeys()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -18,6 +18,10 @@
var video = document.getElementById('testVideo');
assert_not_equals(video, null);
// Content to be played. These files must be the same format.
var content = 'webm/test-encrypted.webm';
var alternateContent = 'webm/test-encrypted-different-av-keys.webm';
var onEncrypted = function(event)
{
++encryptedEventIndex;
@ -28,7 +32,7 @@
// for the video stream each time .src is set.
if (encryptedEventIndex == 2) {
// Finished first video; set src to a different video.
video.src = '../content/test-encrypted-different-av-keys.webm';
video.src = alternateContent;
} else if (encryptedEventIndex == 4) {
// Finished second video.
test.done();
@ -36,7 +40,7 @@
};
// Create a MediaKeys object and assign it to video.
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}])
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content))
.then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();
@ -50,7 +54,7 @@
// Set src to a video.
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
}).catch(function(error) {
forceTestFailureFromPromise(test, error);
});

View file

@ -4,8 +4,8 @@
<head>
<title>Test MediaKeySession closed event</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -15,11 +15,10 @@
var initDataType;
var initData;
var mediaKeySession;
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

View file

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() again after playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -17,7 +17,7 @@
var keyId = stringToUint8Array('0123456789012345');
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
var content = '../content/test-encrypted.webm';
var content = 'webm/test-encrypted.webm';
var duration = 0.2;
return createMediaKeys(keyId, rawKey).then(function(mediaKeys) {

View file

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() again after resetting src</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -17,7 +17,7 @@
var keyId = stringToUint8Array('0123456789012345');
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
var content = '../content/test-encrypted.webm';
var content = 'webm/test-encrypted.webm';
var duration = 0.2;
return createMediaKeys(keyId, rawKey).then(function(mediaKeys) {

View file

@ -4,8 +4,8 @@
<head>
<title>Set MediaKeys multiple times in parallel</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -56,6 +56,7 @@
promise_test(function(test)
{
var video = document.getElementById('video');
var content = 'webm/test-encrypted.webm';
var access;
var mediaKeys1;
var mediaKeys2;
@ -65,10 +66,10 @@
// Start a video now so that it is waiting for MediaKeys
// in order to continue.
video.src = '../content/test-encrypted.webm';
video.src = content;
video.play();
return wait_for_encrypted_event(video).then(function() {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content));
}).then(function(result) {
access = result;
return access.createMediaKeys();

View file

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() multiple times with different MediaKeys.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -14,13 +14,14 @@
promise_test(function(test)
{
var video = document.getElementById('video');
var content = 'webm/test-encrypted.webm';
var keySystemAccess;
var mediaKeys1;
var mediaKeys2;
assert_equals(video.mediaKeys, null);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
keySystemAccess = access;
// Create a mediaKeys.
return keySystemAccess.createMediaKeys();
@ -49,7 +50,7 @@
}).then(function() {
assert_true(video.mediaKeys === mediaKeys1);
// Load the media element to create the WebMediaPlayer.
video.src = '../content/test-encrypted.webm';
video.src = content;
// Set mediaKeys2 on video (switching MediaKeys) not
// supported after WebMediaPlayer is created.
return video.setMediaKeys(mediaKeys2);

View file

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() multiple times with the same MediaKeys.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -14,11 +14,12 @@
promise_test(function(test)
{
var video = document.getElementById('video');
var content = 'webm/test-encrypted.webm';
var mediaKeys;
assert_equals(video.mediaKeys, null);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;
@ -33,7 +34,7 @@
}).then(function() {
assert_true(video.mediaKeys === mediaKeys);
// Load the media element to create the WebMediaPlayer.
video.src = '../content/test-encrypted.webm';
video.src = content;
// Set mediaKeys again on video should still return a
// resolved promise.
return video.setMediaKeys(mediaKeys);

View file

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() on multiple video elements.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video1"></video>
@ -18,7 +18,7 @@
var video2 = document.getElementById('video2');
var mediaKeys;
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

View file

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -34,7 +34,7 @@
assert_equals(error.name, 'TypeError');
// Create a MediaKeys object and assign it to video.
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration());
}).then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();

View file

@ -4,8 +4,8 @@
<head>
<title>Test EME syntax</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -3,8 +3,8 @@
<html>
<head>
<title>Unique origin is unable to create MediaKeys</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -36,7 +36,13 @@
var script = 'data:text/html,' +
'<script>' +
' window.onmessage = function(e) {' +
' navigator.requestMediaKeySystemAccess(\'org.w3.clearkey\', [{}]).then(function(access) {' +
' navigator.requestMediaKeySystemAccess(\'org.w3.clearkey\', [{' +
' initDataTypes: [ \'keyids\' ],' +
' audioCapabilities: [' +
' { contentType: \'audio/mp4; codecs="mp4a.40.2"\' },' +
' { contentType: \'audio/webm; codecs="opus"\' }' +
' ]' +
' }]).then(function(access) {' +
' return access.createMediaKeys();' +
' }).then(function(mediaKeys) {' +
' window.parent.postMessage({result: \'allowed\'}, \'*\');' +
@ -47,7 +53,13 @@
'<\/script>';
// Verify that this page can create a MediaKeys first.
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{
initDataTypes: [ 'keyids' ],
audioCapabilities: [
{ contentType: 'audio/mp4; codecs="mp4a.40.2"' },
{ contentType: 'audio/webm; codecs="opus"' }
]
}]).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
// Success, so now create the iframe and try there.

View file

@ -4,8 +4,8 @@
<head>
<title>Test handling of invalid responses for update().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -16,6 +16,7 @@
async_test(function(test)
{
var initDataType;
var initData;
var mediaKeySession;
function repeat(pattern, count) {
@ -54,15 +55,14 @@
});
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();
waitForEventAndRunStep('message', mediaKeySession, processMessage, test);
return mediaKeySession.generateRequest(initDataType, getInitData(initDataType));
return mediaKeySession.generateRequest(initDataType, initData);
});
}, 'update() with response longer than 64Kb characters.');
</script>

View file

@ -19,23 +19,8 @@ function consoleWrite(text)
function isInitDataTypeSupported(initDataType)
{
return navigator.requestMediaKeySystemAccess(
"org.w3.clearkey", [{ initDataTypes : [initDataType] }])
.then(function() { return(true); }, function() { return(false); });
}
// Returns a promise that is fulfilled with an initDataType that is supported,
// rejected if none are supported.
function getSupportedInitDataType()
{
var configuration = [{ initDataTypes : [ 'webm', 'cenc', 'keyids' ] }];
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', configuration)
.then(function(access) {
var initDataTypes = access.getConfiguration().initDataTypes;
assert_greater_than(initDataTypes.length, 0);
return Promise.resolve(initDataTypes[0]);
}, function(error) {
return Promise.reject('No supported initDataType.');
});
"org.w3.clearkey", getSimpleConfigurationForInitDataType(initDataType))
.then(function() { return true; }, function() { return false; });
}
function getInitData(initDataType)
@ -49,7 +34,7 @@ function getInitData(initDataType)
if (initDataType == 'cenc') {
return new Uint8Array([
0x00, 0x00, 0x00, 0x00, // size = 0
0x00, 0x00, 0x00, 0x34, // size = 52
0x70, 0x73, 0x73, 0x68, // 'pssh'
0x01, // version = 1
0x00, 0x00, 0x00, // flags
@ -73,6 +58,54 @@ function getInitData(initDataType)
throw 'initDataType ' + initDataType + ' not supported.';
}
// Returns an array of audioCapabilities that includes entries for a set of
// codecs that should cover all user agents.
function getPossibleAudioCapabilities()
{
return [
{ contentType: 'audio/mp4; codecs="mp4a.40.2"' },
{ contentType: 'audio/webm; codecs="opus"' },
];
}
// Returns a trivial MediaKeySystemConfiguration that should be accepted,
// possibly as a subset of the specified capabilities, by all user agents.
function getSimpleConfiguration()
{
return [ {
initDataTypes : [ 'webm', 'cenc', 'keyids' ],
audioCapabilities: getPossibleAudioCapabilities()
} ];
}
// Returns a MediaKeySystemConfiguration for |initDataType| that should be
// accepted, possibly as a subset of the specified capabilities, by all
// user agents.
function getSimpleConfigurationForInitDataType(initDataType)
{
return [ {
initDataTypes: [ initDataType ],
audioCapabilities: getPossibleAudioCapabilities()
} ];
}
// Returns a MediaKeySystemConfiguration for |mediaFile| that specifies
// both audio and video capabilities for the specified file..
function getConfigurationForFile(mediaFile)
{
if (mediaFile.toLowerCase().endsWith('webm')) {
return [ {
initDataTypes: [ 'webm' ],
audioCapabilities: [ { contentType: 'audio/webm; codecs="opus"' } ],
videoCapabilities: [ { contentType: 'video/webm; codecs="vp8"' } ]
} ];
}
// NOTE: Supporting other mediaFormats is not currently implemented as
// Chromium only tests with WebM files.
throw 'mediaFile ' + mediaFile + ' not supported.';
}
function waitForEventAndRunStep(eventName, element, func, stepTest)
{
var eventCallback = function(event) {
@ -130,23 +163,23 @@ function dumpKeyStatuses(keyStatuses)
{
consoleWrite("for (var entry of keyStatuses)");
for (var entry of keyStatuses) {
consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]);
consoleWrite(arrayBufferAsString(entry[0]) + ": " + entry[1]);
}
consoleWrite("for (var key of keyStatuses.keys())");
for (var key of keyStatuses.keys()) {
consoleWrite(arrayBufferAsString(key));
consoleWrite("for (var keyId of keyStatuses.keys())");
for (var keyId of keyStatuses.keys()) {
consoleWrite(arrayBufferAsString(keyId));
}
consoleWrite("for (var value of keyStatuses.values())");
for (var value of keyStatuses.values()) {
consoleWrite(value);
consoleWrite("for (var status of keyStatuses.values())");
for (var status of keyStatuses.values()) {
consoleWrite(status);
}
consoleWrite("for (var entry of keyStatuses.entries())");
for (var entry of keyStatuses.entries()) {
consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]);
consoleWrite(arrayBufferAsString(entry[0]) + ": " + entry[1]);
}
consoleWrite("keyStatuses.forEach()");
keyStatuses.forEach(function(value, key, map) {
consoleWrite(arrayBufferAsString(key) + ", " + value);
keyStatuses.forEach(function(status, keyId) {
consoleWrite(arrayBufferAsString(keyId) + ": " + status);
});
}
@ -270,7 +303,7 @@ function createMediaKeys(keyId, key)
var request = stringToUint8Array(createKeyIDs(keyId));
var jwkSet = stringToUint8Array(createJWKSet(createJWK(keyId, key)));
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfigurationForInitDataType('keyids')).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

View file

@ -4,8 +4,8 @@
<head>
<title>Waiting for a key.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -21,6 +21,7 @@
promise_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var initData;
var initDataType;
var mediaKeySession;
@ -44,14 +45,14 @@
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
debugMessage = 'createMediaKeys()';
return access.createMediaKeys();
}).then(function(mediaKeys) {
debugMessage = 'setMediaKeys()';
return video.setMediaKeys(mediaKeys);
}).then(function() {
video.src = '../content/test-encrypted.webm';
video.src = content;
video.play();
debugMessage = 'wait_for_encrypted_event()';
return wait_for_encrypted_event(video);

View file

@ -4,8 +4,11 @@
<head>
<title>Test support of different initDataTypes.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -17,8 +20,7 @@
if (!result)
return Promise.resolve('Not supported');
var options = [ { initDataTypes: [initDataType] } ];
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', options)
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfigurationForInitDataType(initDataType))
.then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {

View file

@ -4,8 +4,11 @@
<head>
<title>Verify v2 events</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -45,11 +48,9 @@
test.done();
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(test.step_func(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

View file

@ -4,8 +4,11 @@
<head>
<title>Test handling of invalid initData for generateRequest().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -21,7 +24,7 @@
if (!result)
return Promise.resolve('Not supported');
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfigurationForInitDataType(initDataType)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
@ -67,13 +70,13 @@
0x00, 0x00, 0x00, 0x00 // datasize
]);
return test_session('cenc', initData);
}, 'generateRequest() with invalid pssh data.');
}, 'generateRequest() with invalid pssh box size.');
promise_test(function()
{
// Invalid data as type = 'psss'.
var initData = new Uint8Array([
0x00, 0x00, 0x00, 0x00, // size = 0
0x00, 0x00, 0x00, 0x20, // size = 32
0x70, 0x73, 0x73, 0x73, // 'psss'
0x00, // version = 0
0x00, 0x00, 0x00, // flags

View file

@ -4,8 +4,11 @@
<head>
<title>Verify MediaKeySession.keyStatuses</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -15,6 +18,7 @@
var mediaKeySession;
var initDataType;
var initData;
var closed = false;
// Even though key ids are uint8, using printable values so that
// they can be verified easily.
@ -40,7 +44,7 @@
});
}
function processKeyStatusesChange(event)
function checkKeyStatusFor2Keys()
{
// Two keys added, so both should show up in |keyStatuses|.
assert_equals(mediaKeySession.keyStatuses.size, 2);
@ -48,8 +52,8 @@
// Check |keyStatuses| for 2 entries.
var result = [];
for (var entry of mediaKeySession.keyStatuses) {
result.push({ key: arrayBufferAsString(entry[0]), value: entry[1] });
for (let [keyId, status] of mediaKeySession.keyStatuses) {
result.push({ key: arrayBufferAsString(keyId), value: status });
}
assert_object_equals(result,
[{ key: key1String, value: 'usable'}, { key: key2String, value: 'usable'}],
@ -84,28 +88,74 @@
// forEach() should return both entries.
result = [];
mediaKeySession.keyStatuses.forEach(function(value, key, map) {
result.push({ key: arrayBufferAsString(key), value: value });
mediaKeySession.keyStatuses.forEach(function(status, keyId) {
result.push({ key: arrayBufferAsString(keyId), value: status });
});
assert_object_equals(result,
[{ key: key1String, value: 'usable'}, { key: key2String, value: 'usable'}],
'keyStatuses.forEach() fails');
// has() and get() should return the expected values.
assert_true(mediaKeySession.keyStatuses.has(key1));
assert_true(mediaKeySession.keyStatuses.has(key2));
assert_false(mediaKeySession.keyStatuses.has(stringToUint8Array('123456')));
assert_equals(mediaKeySession.keyStatuses.get(key1), 'usable');
assert_equals(mediaKeySession.keyStatuses.get(key2), 'usable');
assert_equals(mediaKeySession.keyStatuses.get(stringToUint8Array('123456')), undefined);
test.done();
// Try some invalid keyIds.
var invalid1 = key1.subarray(0, key1.length - 1);
assert_false(mediaKeySession.keyStatuses.has(invalid1));
assert_equals(mediaKeySession.keyStatuses.get(invalid1), undefined);
var invalid2 = key1.subarray(1);
assert_false(mediaKeySession.keyStatuses.has(invalid2));
assert_equals(mediaKeySession.keyStatuses.get(invalid2), undefined);
var invalid3 = new Uint8Array(key1);
invalid3[0] += 1;
assert_false(mediaKeySession.keyStatuses.has(invalid3));
assert_equals(mediaKeySession.keyStatuses.get(invalid3), undefined);
var invalid4 = new Uint8Array(key1);
invalid4[invalid4.length - 1] -= 1;
assert_false(mediaKeySession.keyStatuses.has(invalid4));
assert_equals(mediaKeySession.keyStatuses.get(invalid4), undefined);
var invalid5 = new Uint8Array(key1.length + 1);
invalid5.set(key1, 1); // First element will be 0.
assert_false(mediaKeySession.keyStatuses.has(invalid5));
assert_equals(mediaKeySession.keyStatuses.get(invalid5), undefined);
var invalid6 = new Uint8Array(key1.length + 1);
invalid6.set(key1, 0); // Last element will be 0.
assert_false(mediaKeySession.keyStatuses.has(invalid6));
assert_equals(mediaKeySession.keyStatuses.get(invalid6), undefined);
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
function processKeyStatusesChange(event)
{
if ( !closed )
{
// The first keystatuseschange (caused by update())
// should include both keys.
checkKeyStatusFor2Keys();
mediaKeySession.close().catch(function(error) {
forceTestFailureFromPromise(test, error);
});
closed = true;
}
else
{
// The second keystatuseschange (caused by close())
// should not have any keys.
assert_equals(mediaKeySession.keyStatuses.size, 0);
test.done();
}
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

View file

@ -4,8 +4,11 @@
<head>
<title>Test MediaKeySession not callable immediately after CreateSession().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
@ -15,7 +18,7 @@
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
@ -31,7 +34,7 @@
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
@ -46,7 +49,7 @@
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();

View file

@ -4,8 +4,11 @@
<head>
<title>Clear Key Playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +17,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var isUpdatePromiseResolved = false;
var encryptedEventCount = 0;
@ -72,14 +76,14 @@
test.done();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
waitForEventAndRunStep('playing', video, onPlaying, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.play();

View file

@ -4,8 +4,11 @@
<head>
<title>Clear Key Playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +17,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var isUpdatePromiseResolved = false;
var encryptedEventCount = 0;
@ -72,7 +76,7 @@
test.done();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
@ -81,7 +85,7 @@
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.src = '../content/test-encrypted.webm';
video.src = content;
video.play();
}).catch(function(error) {
forceTestFailureFromPromise(test, error);

View file

@ -4,8 +4,11 @@
<head>
<title>Clear Key Play Two Videos At Same Time</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<video id="testVideo"></video>
@ -18,19 +21,20 @@
var keyId = stringToUint8Array('0123456789012345');
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
var content = 'webm/test-encrypted.webm';
promise_test(function(test)
{
var promises = [
play_video_as_promise(document.getElementById('testVideo'), '../content/test-encrypted.webm'),
play_video_as_promise(document.getElementById('secondVideo'), '../content/test-encrypted.webm')
play_video_as_promise(document.getElementById('testVideo'), content),
play_video_as_promise(document.getElementById('secondVideo'), content)
];
return Promise.all(promises);
}, 'Play two videos at the same time.');
function play_video_as_promise(video, content)
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
return video.setMediaKeys(mediaKeys);

View file

@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</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-initdata-type.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: 'org.w3.clearkey' }
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,44 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Events 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>
<script src=/encrypted-media/util/fetch.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/events.js></script>
</head>
<body>
<div id='log'></div>
<script>
getSupportedContent( 'org.w3.clearkey' )
.then( function( contents )
{
var handler = new MessageHandler( 'org.w3.clearkey', contents[ 0 ] );
runTest( { keysystem: 'org.w3.clearkey',
content: contents[ 0 ],
messagehandler: handler.messagehandler,
} );
} );
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Test handling of invalid initData for generateRequest()</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>
<script src=/encrypted-media/util/fetch.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/generate-request-disallowed-input.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: 'org.w3.clearkey'
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Verify MediaKeySession.keyStatuses with multiple sessions, 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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/keystatuses-multiple-sessions.js></script>
</head>
<body>
<div id='log'></div>
<script>
getSupportedContent( 'org.w3.clearkey' )
.then( function( contents ) {
// Select a content item with multiple keys
var contentitem = contents.filter( function( item ) { return item.keys.length > 1; } )[ 0 ],
handler = new MessageHandler( 'org.w3.clearkey', contentitem );
var config = { keysystem: 'org.w3.clearkey',
content: contentitem,
messagehandler: handler.messagehandler,
initDataType: 'keyids',
initData: getMultikeyInitDatas(contentitem,'keyids'),
};
runTest(config);
} );
</script>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Verify MediaKeySession.keyStatuses with multiple sessions, 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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/keystatuses.js></script>
</head>
<body>
<div id='log'></div>
<script>
getSupportedContent( 'org.w3.clearkey' )
.then( function( contents ) {
// Select a content item with multiple keys
var contentitem = contents.filter( function( item ) { return item.keys.length > 1; } )[ 0 ];
var handler = new MessageHandler( 'org.w3.clearkey', contentitem );
var config = { keysystem: 'org.w3.clearkey',
content: contentitem,
messagehandler: handler.messagehandler,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
};
runTest(config);
} );
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: persistent-license, playback, destroy license with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-destroy-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: Successful Playback, persistent-license session with Clear Key, mp4, event sequence</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-license-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids')
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: Successful Playback, persistent-license session with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-usage-record session with Clear Key, mp4, event sequence</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-usage-record-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-usage-record session with Clear Key, mp4, event sequence</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-usage-record.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: persistent-license, playback, retrieve, playback and destroy with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-retrieve-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
windowscript: 'resources/clearkey-retrieve-destroy-persistent-license.html',
testcase: 'playback, retrieve, playback and destroy' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: persistent-license playback, retrieve and playback with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-retrieve-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
windowscript: 'resources/clearkey-retrieve-persistent-license.html',
testcase: 'playback, retrieve and playback' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: persistent-usage-record, playback and retrieve record in new window, Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-retrieve-persistent-usage-record.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
windowscript: 'resources/retrieve-persistent-usage-record.html' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful playback, Temporary session with Clear Key, mp4, validating events</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, multiple keys in sequence</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-multikey-multisession.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-multikey'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getMultikeyInitDatas(contentitem,'keyids'),
duration: 5,
testcase: 'sequential' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, multiple keys for audio/video</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-multikey.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-av-multikey'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
testcase: 'audio/video' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
testcase: SETMEDIAKEYS_AFTER_SRC };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
testcase: SETMEDIAKEYS_AFTER_UPDATE };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
testcase: SETMEDIAKEYS_IMMEDIATELY };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
testcase: SETMEDIAKEYS_ONENCRYPTED };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,55 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, two videos</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-two-videos.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement1" width="200px"></video>
<video id="videoelement2" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: [ document.getElementById( 'videoelement1' ),
document.getElementById( 'videoelement2' ) ],
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, play, wait for key, continue play</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-waitingforkey.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getMultikeyInitDatas(contentitem,'keyids'),
duration: 5 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
handler = new MessageHandler( 'org.w3.clearkey', contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Test MediaKeySession not callable immediately after CreateSession().</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>
<script src=/encrypted-media/util/fetch.js></script>
<!-- Message handler for Clear Key -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/not-callable-after-createsession.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: 'org.w3.clearkey'
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,199 @@
content = addMemberListToObject( {
'mp4-basic' : { initDataType: 'cenc',
audio : { type: 'audio/mp4;codecs="mp4a.40.2"',
path: '/encrypted-media/content/audio_aac-lc_128k_dashinit.mp4' },
video : { type: 'video/mp4;codecs="avc1.4d401e"',
path: '/encrypted-media/content/video_512x288_h264-360k_enc_dashinit.mp4' },
keys : [ { kid: [ 0xad, 0x13, 0xf9, 0xea, 0x2b, 0xe6, 0x98, 0xb8, 0x75, 0xf5, 0x04, 0xa8, 0xe3, 0xcc, 0xea, 0x64 ],
key: [ 0xbe, 0x7d, 0xf8, 0xa3, 0x66, 0x7a, 0x6a, 0x8f, 0xd5, 0x64, 0xd0, 0xed, 0x81, 0x33, 0x9a, 0x95 ],
initDataType: 'cenc',
initData: 'AAAAcXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAFEIARIQrRP56ivmmLh19QSo48zqZBoIY2FzdGxhYnMiKGV5SmhjM05sZEVsa0lqb2laVzFsTFhSbGMzUXRjMmx1WjJ4bEluMD0yB2RlZmF1bHQAAAMacHNzaAAAAACaBPB5mEBChquS5lvgiF+VAAAC+voCAAABAAEA8AI8AFcAUgBNAEgARQBBAEQARQBSACAAeABtAGwAbgBzAD0AIgBoAHQAdABwADoALwAvAHMAYwBoAGUAbQBhAHMALgBtAGkAYwByAG8AcwBvAGYAdAAuAGMAbwBtAC8ARABSAE0ALwAyADAAMAA3AC8AMAAzAC8AUABsAGEAeQBSAGUAYQBkAHkASABlAGEAZABlAHIAIgAgAHYAZQByAHMAaQBvAG4APQAiADQALgAwAC4AMAAuADAAIgA+ADwARABBAFQAQQA+ADwAUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABLAEUAWQBMAEUATgA+ADEANgA8AC8ASwBFAFkATABFAE4APgA8AEEATABHAEkARAA+AEEARQBTAEMAVABSADwALwBBAEwARwBJAEQAPgA8AC8AUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABLAEkARAA+ADYAdgBrAFQAcgBlAFkAcgB1AEoAaAAxADkAUQBTAG8ANAA4AHoAcQBaAEEAPQA9ADwALwBLAEkARAA+ADwAQwBIAEUAQwBLAFMAVQBNAD4AagBZAEYATgBmADAAeQBmADQAaQBzAD0APAAvAEMASABFAEMASwBTAFUATQA+ADwATABBAF8AVQBSAEwAPgBoAHQAdABwADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZABpAHIAZQBjAHQAdABhAHAAcwAuAG4AZQB0AC8AcAByAC8AcwB2AGMALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA/AFAAbABhAHkAUgBpAGcAaAB0AD0AMQAmAGEAbQBwADsAVQBzAGUAUwBpAG0AcABsAGUATgBvAG4AUABlAHIAcwBpAHMAdABlAG4AdABMAGkAYwBlAG4AcwBlAD0AMQA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==' } ]
},
'mp4-av-multikey' : {
initDataType: 'cenc',
associatedInitData: true, // indicates that initData for one key causes other keys to be returned as well
audio: { type: 'audio/mp4;codecs="mp4a.40.2"',
path: '/encrypted-media/content/audio_aac-lc_128k_enc_dashinit.mp4' },
video : { type: 'video/mp4;codecs="avc1.4d401e"',
path: '/encrypted-media/content/video_512x288_h264-360k_enc_dashinit.mp4' },
keys : [ { kid: [ 0xad, 0x13, 0xf9, 0xea, 0x2b, 0xe6, 0x98, 0xb8, 0x75, 0xf5, 0x04, 0xa8, 0xe3, 0xcc, 0xea, 0x64 ],
key: [ 0xbe, 0x7d, 0xf8, 0xa3, 0x66, 0x7a, 0x6a, 0x8f, 0xd5, 0x64, 0xd0, 0xed, 0x81, 0x33, 0x9a, 0x95 ],
initDataType: 'cenc',
initData: 'AAAAcXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAFEIARIQrRP56ivmmLh19QSo48zqZBoIY2FzdGxhYnMiKGV5SmhjM05sZEVsa0lqb2laVzFsTFhSbGMzUXRjMmx1WjJ4bEluMD0yB2RlZmF1bHQAAAMacHNzaAAAAACaBPB5mEBChquS5lvgiF+VAAAC+voCAAABAAEA8AI8AFcAUgBNAEgARQBBAEQARQBSACAAeABtAGwAbgBzAD0AIgBoAHQAdABwADoALwAvAHMAYwBoAGUAbQBhAHMALgBtAGkAYwByAG8AcwBvAGYAdAAuAGMAbwBtAC8ARABSAE0ALwAyADAAMAA3AC8AMAAzAC8AUABsAGEAeQBSAGUAYQBkAHkASABlAGEAZABlAHIAIgAgAHYAZQByAHMAaQBvAG4APQAiADQALgAwAC4AMAAuADAAIgA+ADwARABBAFQAQQA+ADwAUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABLAEUAWQBMAEUATgA+ADEANgA8AC8ASwBFAFkATABFAE4APgA8AEEATABHAEkARAA+AEEARQBTAEMAVABSADwALwBBAEwARwBJAEQAPgA8AC8AUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABLAEkARAA+ADYAdgBrAFQAcgBlAFkAcgB1AEoAaAAxADkAUQBTAG8ANAA4AHoAcQBaAEEAPQA9ADwALwBLAEkARAA+ADwAQwBIAEUAQwBLAFMAVQBNAD4AagBZAEYATgBmADAAeQBmADQAaQBzAD0APAAvAEMASABFAEMASwBTAFUATQA+ADwATABBAF8AVQBSAEwAPgBoAHQAdABwADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZABpAHIAZQBjAHQAdABhAHAAcwAuAG4AZQB0AC8AcAByAC8AcwB2AGMALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA/AFAAbABhAHkAUgBpAGcAaAB0AD0AMQAmAGEAbQBwADsAVQBzAGUAUwBpAG0AcABsAGUATgBvAG4AUABlAHIAcwBpAHMAdABlAG4AdABMAGkAYwBlAG4AcwBlAD0AMQA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==' },
{ kid: [ 0x55, 0x8e, 0xe5, 0x41, 0xb9, 0x0a, 0xb2, 0xf3, 0x95, 0x0d, 0x00, 0xad, 0xe3, 0x76, 0x0d, 0x45 ],
key: [ 0x91, 0x03, 0x92, 0x63, 0x01, 0x6d, 0xa6, 0x35, 0x77, 0x0d, 0x57, 0xdb, 0x92, 0xf9, 0x8b, 0xd0 ],
initDataType : 'cenc',
initData: 'AAAAcXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAFEIARIQVY7lQbkKsvOVDQCt43YNRRoIY2FzdGxhYnMiKGV5SmhjM05sZEVsa0lqb2laVzFsTFhSbGMzUXRjMmx1WjJ4bEluMD0yB2RlZmF1bHQAAAMacHNzaAAAAACaBPB5mEBChquS5lvgiF+VAAAC+voCAAABAAEA8AI8AFcAUgBNAEgARQBBAEQARQBSACAAeABtAGwAbgBzAD0AIgBoAHQAdABwADoALwAvAHMAYwBoAGUAbQBhAHMALgBtAGkAYwByAG8AcwBvAGYAdAAuAGMAbwBtAC8ARABSAE0ALwAyADAAMAA3AC8AMAAzAC8AUABsAGEAeQBSAGUAYQBkAHkASABlAGEAZABlAHIAIgAgAHYAZQByAHMAaQBvAG4APQAiADQALgAwAC4AMAAuADAAIgA+ADwARABBAFQAQQA+ADwAUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABLAEUAWQBMAEUATgA+ADEANgA8AC8ASwBFAFkATABFAE4APgA8AEEATABHAEkARAA+AEEARQBTAEMAVABSADwALwBBAEwARwBJAEQAPgA8AC8AUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABLAEkARAA+AFEAZQBXAE8AVgBRAHEANQA4ADcASwBWAEQAUQBDAHQANAAzAFkATgBSAFEAPQA9ADwALwBLAEkARAA+ADwAQwBIAEUAQwBLAFMAVQBNAD4AWQBpAE8ALwAxADYATABzADkANgBFAD0APAAvAEMASABFAEMASwBTAFUATQA+ADwATABBAF8AVQBSAEwAPgBoAHQAdABwADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZABpAHIAZQBjAHQAdABhAHAAcwAuAG4AZQB0AC8AcAByAC8AcwB2AGMALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA/AFAAbABhAHkAUgBpAGcAaAB0AD0AMQAmAGEAbQBwADsAVQBzAGUAUwBpAG0AcABsAGUATgBvAG4AUABlAHIAcwBpAHMAdABlAG4AdABMAGkAYwBlAG4AcwBlAD0AMQA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==' } ]
},
'mp4-multikey' : { initDataType: 'cenc',
audio: { type: 'audio/mp4;codecs="mp4a.40.2"',
path: '/encrypted-media/content/audio_aac-lc_128k_2keys_2sess.mp4' },
video: { type: 'video/mp4;codecs="avc1.4d401e"',
path: '/encrypted-media/content/video_512x288_h264-360k_enc_2keys_2sess.mp4' },
keys: [ { kid: [ 0x13, 0xa7, 0x53, 0x06, 0xd1, 0x18, 0x91, 0x7b, 0x47, 0xa6, 0xc1, 0x83, 0x64, 0x42, 0x51, 0x6f ],
key: [ 0x8a, 0xaa, 0xd8, 0xc4, 0xdb, 0xde, 0xac, 0xcd, 0xad, 0x26, 0x76, 0xa1, 0xed, 0x38, 0x95, 0x2e ],
initDataType: 'cenc',
initData: 'AAAAjXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAG0IARIQE6dTBtEYkXtHpsGDZEJRbxoIY2FzdGxhYnMiRGV5SmhjM05sZEVsa0lqb2laVzFsTFhSbGMzUXRNbk5sYzNOcGIyNGlMQ0oyWVhKcFlXNTBTV1FpT2lKclpYa3hJbjA9MgdkZWZhdWx0AAADwnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAA6KiAwAAAQABAJgDPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBCAGwATwBuAEUAeABqAFIAZQA1AEYASABwAHMARwBEAFoARQBKAFIAYgB3AD0APQA8AC8ASwBJAEQAPgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAGwAaQBjAC4AcwB0AGEAZwBpAG4AZwAuAGQAcgBtAHQAbwBkAGEAeQAuAGMAbwBtAC8AbABpAGMAZQBuAHMAZQAtAHAAcgBvAHgAeQAtAGgAZQBhAGQAZQByAGEAdQB0AGgALwBkAHIAbQB0AG8AZABhAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AEwAVQBJAF8AVQBSAEwAPgBoAHQAdABwAHMAOgAvAC8AbABpAGMALgBzAHQAYQBnAGkAbgBnAC4AZAByAG0AdABvAGQAYQB5AC4AYwBvAG0ALwBsAGkAYwBlAG4AcwBlAC0AcAByAG8AeAB5AC0AaABlAGEAZABlAHIAYQB1AHQAaAAvAGQAcgBtAHQAbwBkAGEAeQAvAFIAaQBnAGgAdABzAE0AYQBuAGEAZwBlAHIALgBhAHMAbQB4ADwALwBMAFUASQBfAFUAUgBMAD4APABDAEgARQBDAEsAUwBVAE0APgBJAEQAUgB0AFAAZwBVAEkALwBiAEkAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA=' },
{ kid: [ 0xee, 0x73, 0x56, 0x4e, 0xc8, 0xa8, 0x90, 0xf0, 0x78, 0xef, 0x68, 0x71, 0xfa, 0x4b, 0xe1, 0x8b ],
key: [ 0xe4, 0x4f, 0xe1, 0x45, 0x7c, 0x5e, 0xbc, 0xd8, 0x3e, 0xad, 0xdc, 0xd6, 0x2c, 0xaf, 0x55, 0x18 ],
initDataType: 'cenc',
initData: 'AAAAjXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAG0IARIQ7nNWTsiokPB472hx+kvhixoIY2FzdGxhYnMiRGV5SmhjM05sZEVsa0lqb2laVzFsTFhSbGMzUXRNbk5sYzNOcGIyNGlMQ0oyWVhKcFlXNTBTV1FpT2lKclpYa3lJbjA9MgdkZWZhdWx0AAADwnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAA6KiAwAAAQABAJgDPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBUAGwAWgB6ADcAcQBqAEkAOABKAEIANAA3ADIAaAB4ACsAawB2AGgAaQB3AD0APQA8AC8ASwBJAEQAPgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAGwAaQBjAC4AcwB0AGEAZwBpAG4AZwAuAGQAcgBtAHQAbwBkAGEAeQAuAGMAbwBtAC8AbABpAGMAZQBuAHMAZQAtAHAAcgBvAHgAeQAtAGgAZQBhAGQAZQByAGEAdQB0AGgALwBkAHIAbQB0AG8AZABhAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AEwAVQBJAF8AVQBSAEwAPgBoAHQAdABwAHMAOgAvAC8AbABpAGMALgBzAHQAYQBnAGkAbgBnAC4AZAByAG0AdABvAGQAYQB5AC4AYwBvAG0ALwBsAGkAYwBlAG4AcwBlAC0AcAByAG8AeAB5AC0AaABlAGEAZABlAHIAYQB1AHQAaAAvAGQAcgBtAHQAbwBkAGEAeQAvAFIAaQBnAGgAdABzAE0AYQBuAGEAZwBlAHIALgBhAHMAbQB4ADwALwBMAFUASQBfAFUAUgBMAD4APABDAEgARQBDAEsAUwBVAE0APgB4AEQASwBBAFkAMAB2AFoAaABVAFUAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA=' } ] },
'webm' : { audio : { type: 'audio/webm; codecs="opus"' },
video : { type: 'video/webm; codecs="vp8"',
path: '/encrypted-media/content/test-encrypted.webm' },
keys : [ { kid: [48,49,50,51,52,53,54,55,56,57,48,49,50,51,52,53],
key: [0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c ] } ]
},
'webm-multikey' :
{ audio : { type: 'audio/webm; codecs="opus"' },
video : { type: 'video/webm; codecs="vp8"',
path: '/encrypted-media/content/test-encrypted-different-av-keys.webm' },
keys : [ { kid: [48,49,50,51,52,53,54,55,56,57,48,49,50,51,52,53],
key: [ 0x7A, 0x7A, 0x62, 0xF1, 0x68, 0x14, 0xD2, 0x7B,
0x68, 0xEF, 0x12, 0x2A, 0xFC, 0xE4, 0xAE, 0x0A ] },
{ kid: [49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54],
key: [ 0x30, 0x30, 0x62, 0xF1, 0x68, 0x14, 0xD2, 0x7B,
0x68, 0xEF, 0x12, 0x2A, 0xFC, 0xE4, 0xAE, 0x0A ] } ]
},
} );
function addMemberListToObject( o )
{
var items = [ ];
for( var item in o )
{
if ( !o.hasOwnProperty( item ) ) continue;
o[item].name = item;
items.push( o[item] );
}
o._items = items;
return o;
}
function getInitData( contentitem, initDataType )
{
if (initDataType == 'webm') {
return new Uint8Array( contentitem.keys[ 0 ].kid ); // WebM initData supports only a single key
}
if (initDataType == 'cenc') {
var size = 36 + contentitem.keys.length * 16,
kids = contentitem.keys.map( function( k ) { return k.kid; } );
return new Uint8Array(Array.prototype.concat.call( [
0x00, 0x00, size / 256, size % 256, // size
0x70, 0x73, 0x73, 0x68, // 'pssh'
0x01, // version = 1
0x00, 0x00, 0x00, // flags
0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02, // Common SystemID
0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B,
0x00, 0x00, 0x00, kids.length ], // key count ]
Array.prototype.concat.apply( [], kids ),
[ 0x00, 0x00, 0x00, 0x00 ]// datasize
));
}
if (initDataType == 'keyids') {
return toUtf8( { kids: contentitem.keys.map( function( k ) { return base64urlEncode( new Uint8Array( k.kid ) ); } ) } );
}
throw 'initDataType ' + initDataType + ' not supported.';
}
function getSingleKeyInitData( kid, initDataType )
{
if (initDataType == 'webm') {
return new Uint8Array( kid );
}
if (initDataType == 'cenc') {
var size = 52;
return new Uint8Array(Array.prototype.concat.call( [
0x00, 0x00, size / 256, size % 256, // size
0x70, 0x73, 0x73, 0x68, // 'pssh'
0x01, // version = 1
0x00, 0x00, 0x00, // flags
0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02, // Common SystemID
0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B,
0x00, 0x00, 0x00, 0x01 ], // key count ]
kid,
[ 0x00, 0x00, 0x00, 0x00 ]// datasize
));
}
if (initDataType == 'keyids') {
return toUtf8( { kids: [ base64urlEncode( new Uint8Array( kid ) ) ] } );
}
throw 'initDataType ' + initDataType + ' not supported.';
}
function getMultikeyInitDatas( contentitem, initDataType )
{
return contentitem.keys.map( function( k ) { return getSingleKeyInitData( k.kid, initDataType ); } );
}
function getProprietaryInitDatas( contentitem )
{
return { initDataType: contentitem.initDataType,
initDatas : contentitem.keys.filter( function( k ) { return k.initData; } )
.map( function( k ) { return k.initData; } ) };
}
// Returns a promise that resolves to true or false depending on whether the content is supported with the key system and one of the initDataTypes
function isContentSupportedForInitDataTypes( keysystem, intiDataTypes, contentitem )
{
var configuration = { initDataTypes : intiDataTypes,
audioCapabilities: [ { contentType: contentitem.audio.type } ],
videoCapabilities: [ { contentType: contentitem.video.type } ]
};
return navigator.requestMediaKeySystemAccess( keysystem, [ configuration ] )
.then( function( access ) {
return { content: contentitem, supported: true, initDataTypes: access.getConfiguration().initDataTyes };
},
function() {
return { content: contentitem, supported: false };
} );
}
// Returns a promise that resolves to { content:, supported:, initDataTypes: } object
function isContentSupported( keysystem, contentitem )
{
return isContentSupportedForInitDataTypes( keysystem, [ 'cenc', 'webm', 'keyids' ], contentitem );
}
// Returns a Promise resolving to an array of supported content for the key system
function getSupportedContent( keysystem )
{
return Promise.all( content._items.map( isContentSupported.bind( null, keysystem ) ) ).
then( function( results )
{
return results.filter( function( r ) { return r.supported; } ).map( function( r ) { return r.content; } );
} );
}
// Returns a Promise resolving to an array of { content:, initDataType: } pairs for the key system
function getSupportedContentAndInitDataTypes( keysystem )
{
return Promise.all( content._items.map( isContentSupported.bind( null, keysystem ) ) ).
then( function( results )
{
return results.filter( function( r ) { return r.supported; } );
} );
}
// gets a configuration object for provided piece of content
function getSimpleConfigurationForContent( contentitem )
{
return { initDataTypes: [ 'keyids', 'webm', 'cenc' ],
audioCapabilities: [ { contentType: contentitem.audio.type } ],
videoCapabilities: [ { contentType: contentitem.video.type } ] };
}

View file

@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4</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-initdata-type.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: getSupportedKeySystem() }
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,72 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Events 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>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/events.js></script>
</head>
<body>
<div id='log'></div>
<script>
var keysystem = getSupportedKeySystem();
getSupportedContentAndInitDataTypes( keysystem )
.then( function( supported )
{
// This test requires initData for supported content.
// We prefer explciit initData configured for the content, but
// otherwise we will generate initData for a supported initDataType
// FIXME: Move me to a utility function
var content,
initDataType,
initData;
var contentWithExplicitInitData = supported.filter( function( s ) { return s.content.initDataType; } );
if ( contentWithExplicitInitData.length > 0 )
{
content = contentWithExplicitInitData[ 0 ].content;
initDataType = content.keys[ 0 ].initDataType;
initData = base64DecodeToUnit8Array( content.keys[ 0 ].initData );
}
else
{
content = supported[ 0 ].content;
initDataType = supported[ 0 ].initDataTypes[ 0 ];
initData = getInitData( content, initDataType );
}
var handler = new MessageHandler( keysystem, content );
runTest( { keysystem: keysystem,
content: content,
messagehandler: handler.messagehandler,
initDataType: initDataType,
initData: initData
} );
} );
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Test handling of invalid initData for generateRequest()</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>
<script src=/encrypted-media/util/fetch.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/generate-request-disallowed-input.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: getSupportedKeySystem()
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,56 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, multiple keys for audio/video</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/keystatuses-multiple-sessions.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem();
getSupportedContent( keysystem )
.then( function( contents ) {
// Select a content item with multiple keys and initData
var contentitem = contents.filter( function( item ) { return item.keys.length > 1 && item.initDataType && !item.associatedInitData; } )[ 0 ],
handler = new MessageHandler( keysystem, contentitem ),
config = { keysystem: keysystem,
content: contentitem,
messagehandler: handler.messagehandler,
initDataType: contentitem.initDataType,
initData: getProprietaryInitDatas(contentitem).initDatas.map( base64DecodeToUnit8Array ),
};
runTest(config);
} );
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Verify MediaKeySession.keyStatuses with multiple sessions, 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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/keystatuses.js></script>
</head>
<body>
<div id='log'></div>
<script>
var keysystem = getSupportedKeySystem();
getSupportedContent( keysystem ).then( function( contents ) {
// Select a content item with multiple keys and initData that retrieves all keys
var contentitem = contents.filter( function( item ) {
return item.keys.length > 1 && item.initDataType && item.associatedInitData;
} )[ 0 ];
var handler = new MessageHandler( keysystem, contentitem );
var config = { keysystem: keysystem,
content: contentitem,
messagehandler: handler.messagehandler,
initDataType: contentitem.initDataType,
initData: base64DecodeToUnit8Array( getProprietaryInitDatas(contentitem).initDatas[ 0 ] ),
};
runTest(config);
} );
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: Successful Playback, persistent-license session with DRM, mp4, destroy the license</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-destroy-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem, 'persistent-license' ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: Successful Playback, persistent-license session with DRM, mp4, event sequence</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-license-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extensions: Successful Playback, persistent-license session with DRM, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem, 'persistent-license' ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-usage-record session with DRM, mp4, event sequence</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-usage-record-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem, 'persistent-usage-record' ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
servercertificate: handler.servercertificate,
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-usage-record session with DRM, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-usage-record.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem, 'persistent-usage-record' ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
servercertificate: handler.servercertificate,
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-license session with DRM, mp4, retrieve license, playback and destroy the license</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-retrieve-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem, 'persistent-license' ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
windowscript: 'resources/drm-retrieve-destroy-persistent-license.html',
testcase: 'playback, retrieve, playback and destroy' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-license session with DRM, mp4, retrieve the license, playback</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-retrieve-persistent-license.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem, 'persistent-license' ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
windowscript: 'resources/drm-retrieve-persistent-license.html',
testcase: 'playback, retrieve, playback' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,55 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: persistent-usage-record, playback and retrieve record in new window, DRM, mp4</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM server -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-retrieve-persistent-usage-record.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem, 'persistent-usage-record' ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
servercertificate: handler.servercertificate,
duration: 2,
windowscript: 'resources/drm-retrieve-persistent-usage-record.html' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful playback, temporary session with DRM, mp4, validating events</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>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,55 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Verify MediaKeySession.keyStatuses with multiple sessions, 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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-multikey-multisession.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-multikey'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
initData: getProprietaryInitDatas(contentitem).initDatas.map( base64DecodeToUnit8Array ),
duration: 5,
testcase: 'sequential' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4, multiple keys</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-multikey.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-av-multikey'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2,
testcase: 'audio/video' };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4</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>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2,
testcase: SETMEDIAKEYS_AFTER_SRC };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4</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>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2,
testcase: SETMEDIAKEYS_AFTER_UPDATE };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4</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>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2,
testcase: SETMEDIAKEYS_IMMEDIATELY };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4</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>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2,
testcase: SETMEDIAKEYS_ONENCRYPTED };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,55 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, two videos</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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-two-videos.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement1" width="200px"></video>
<video id="videoelement2" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: [ document.getElementById( 'videoelement1' ),
document.getElementById( 'videoelement2' ) ],
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Verify MediaKeySession.keyStatuses with multiple sessions, 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/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM keysystem -->
<script src=/encrypted-media/util/drmtoday-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-waitingforkey.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: document.getElementById('videoelement'),
keysystem: getSupportedKeySystem(),
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
initData: getProprietaryInitDatas(contentitem).initDatas.map( base64DecodeToUnit8Array ),
duration: 5 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4</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>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for DRM servers -->
<script src=/encrypted-media/util/drm-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var keysystem = getSupportedKeySystem(),
contentitem = content['mp4-basic'],
handler = new MessageHandler( keysystem, contentitem ),
config = { video: document.getElementById('videoelement'),
keysystem: keysystem,
messagehandler: handler.messagehandler,
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: contentitem.initDataType,
duration: 2 };
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Test MediaKeySession not callable immediately after CreateSession().</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>
<script src=/encrypted-media/util/fetch.js></script>
<!-- Message handler for Clear Key -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/not-callable-after-createsession.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: getSupportedKeySystem()
};
runTest(config);
</script>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Encrypted Media Extentions IDL test</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script src=/encrypted-media/util/fetch.js></script>
</head>
<body>
<h1 class="instructions">Description</h1>
<p class="instructions">
This test verifies that implementations of the Encrypted Media Extensions API match its WebIDL definition.
</p>
<div id='log'></div>
<script>
setup(function() {
fetch( 'EncryptedMediaExtensions.idl')
.then( function( response ) {
if ( !response.ok ) throw new Error( 'IDL fetch failed' );
return response.text();
} )
.then( function( idls ) {
var idl_array = new IdlArray();
idl_array.add_untested_idls("[PrimaryGlobal] interface Window {};");
idl_array.add_untested_idls("interface Navigator {};");
idl_array.add_untested_idls("interface ArrayBuffer {};");
idl_array.add_untested_idls("interface HTMLMediaElement {};");
idl_array.add_untested_idls("interface Event {};");
idl_array.add_untested_idls("interface EventTarget {};");
idl_array.add_idls(idls);
idl_array.test();
done();
} );
}, {explicit_done: true});
</script>
</body>
</html>

View file

@ -0,0 +1,80 @@
(function() {
if ( /CrKey\/[0-9]+\.[0-9a-z]+\.[0-9a-z]+/i.exec( navigator.userAgent ) ) {
var castscript = document.createElement('script');
castscript.type = 'text/javascript';
castscript.src = 'https://www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js'
document.head.appendChild( castscript );
var _requestMediaKeySystemAccess = navigator.requestMediaKeySystemAccess.bind( navigator ),
_setMediaKeys = HTMLMediaElement.prototype.setMediaKeys,
_load = MediaKeySession.prototype.load;
MediaKeySession.prototype.load = function load()
{
return _load.call( this ).then( function( success )
{
return success ? this.remove() : false;
}.bind( this ) );
};
function MediaKeys( mediaKeys )
{
this._mediaKeys = mediaKeys;
}
MediaKeys.prototype.setServerCertificate = function setServerCertificate( certificate )
{
return this._mediaKeys.setServerCertificate( certificate );
};
MediaKeys.prototype.createSession = function createSession( sessionType ) {
if ( sessionType === 'persistent-usage-record' )
{
return cast.receiver.eme.KeySession.createSession( this._mediaKeys, 'persistent-release-message' );
}
return this._mediaKeys.createSession( sessionType );
};
function MediaKeySystemAccess( access )
{
this._access = mediaKeySystemAccess;
}
Object.defineProperty( MediaKeySystemAccess.prototype, 'keySystem', { get: function() { return this._access.keySystem; } } );
MediaKeySystemAccess.prototype.getConfiguration = function getConfiguration() { return this._access.getConfiguration(); };
MediaKeySystemAccess.prototype.createMediaKeys = function createMediaKeys() {
return this._access.createMediaKey().then( function( mediaKeys ) { return new MediaKeys( mediaKeys ); } );
};
HTMLMediaElement.prototype.setMediaKeys = function setMediaKeys( mediaKeys )
{
if ( mediaKeys instanceof MediaKeys )
{
return _setMediaKeys.call( this, mediaKeys._mediaKeys );
}
else
{
return _setMediaKeys.call( this, mediaKeys );
}
};
navigator.requestMediaKeySystemAccess = function requestMediaKeySystemAccess( keysystem, supportedConfigurations ) {
if ( keysystem !== 'com.chromecast.playready' )
{
return _requestMediaKeySystemAccess( keysystem, supportedConfigurations );
}
return _requestMediaKeySystemAccess( keysystem, supportedConfigurations )
.then( function( access ) { return new MediaKeySystemAccess( access ); } );
};
}
})();

Some files were not shown because too many files have changed in this diff Show more