mirror of
https://github.com/servo/servo.git
synced 2025-08-22 13:55:34 +01:00
Update web-platform-tests to revision 3b3585e368841b77caea8576fa56cef91c3fbdf0
This commit is contained in:
parent
d00639c55f
commit
3b4f0ec0bb
541 changed files with 14609 additions and 3288 deletions
|
@ -4,6 +4,7 @@
|
|||
// which this IDL was extracted.
|
||||
//
|
||||
// https://www.w3.org/TR/2016/WD-encrypted-media-20160610/
|
||||
// + commit 5499821932391ae2c2e53756ae7ab9fae89d5863
|
||||
//
|
||||
|
||||
partial interface Navigator {
|
||||
|
@ -86,15 +87,15 @@ enum MediaKeyMessageType {
|
|||
"individualization-request"
|
||||
};
|
||||
|
||||
[ Constructor (DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
|
||||
[Constructor(DOMString type, MediaKeyMessageEventInit eventInitDict)]
|
||||
interface MediaKeyMessageEvent : Event {
|
||||
readonly attribute MediaKeyMessageType messageType;
|
||||
readonly attribute ArrayBuffer message;
|
||||
};
|
||||
|
||||
dictionary MediaKeyMessageEventInit : EventInit {
|
||||
MediaKeyMessageType messageType = "license-request";
|
||||
ArrayBuffer message;
|
||||
required MediaKeyMessageType messageType;
|
||||
required ArrayBuffer message;
|
||||
};
|
||||
|
||||
// partial interface HTMLMediaElement : EventTarget {
|
||||
|
@ -105,7 +106,7 @@ partial interface HTMLMediaElement {
|
|||
Promise<void> setMediaKeys (MediaKeys? mediaKeys);
|
||||
};
|
||||
|
||||
[ Constructor (DOMString type, optional MediaEncryptedEventInit eventInitDict)]
|
||||
[Constructor(DOMString type, optional MediaEncryptedEventInit eventInitDict)]
|
||||
interface MediaEncryptedEvent : Event {
|
||||
readonly attribute DOMString initDataType;
|
||||
readonly attribute ArrayBuffer? initData;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// Since promises catch any exception and convert it into a
|
||||
// rejected Promise, there is no current way to have the W3C
|
||||
|
@ -168,7 +167,7 @@
|
|||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error, 'create() tests failed');
|
||||
});
|
||||
}, 'Test MediaKeys create().');
|
||||
}, 'Test MediaKeySystemAccess createMediaKeys().');
|
||||
|
||||
var kCreateSessionExceptionsTestCases = [
|
||||
// Tests in this set use a shortened parameter name due to
|
||||
|
@ -502,20 +501,20 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME: Update this set of tests when done
|
||||
// implementing the latest spec.
|
||||
assert_equals(typeof mediaKeySession, 'object');
|
||||
assert_equals(typeof mediaKeySession.addEventListener, 'function');
|
||||
assert_equals(typeof mediaKeySession.sessionId, 'string');
|
||||
assert_equals(typeof mediaKeySession.expiration, 'number');
|
||||
assert_equals(typeof mediaKeySession.closed, 'object');
|
||||
assert_equals(typeof mediaKeySession.keyStatuses, 'object');
|
||||
assert_equals(typeof mediaKeySession.onkeystatuseschange, 'object');
|
||||
assert_equals(typeof mediaKeySession.onmessage, 'object');
|
||||
assert_equals(typeof mediaKeySession.generateRequest, 'function');
|
||||
assert_equals(typeof mediaKeySession.load, 'function');
|
||||
assert_equals(typeof mediaKeySession.update, 'function');
|
||||
assert_equals(typeof mediaKeySession.close, 'function');
|
||||
assert_equals(typeof mediaKeySession.remove, 'function');
|
||||
assert_equals(mediaKeySession.sessionId, '');
|
||||
assert_equals(typeof mediaKeySession.sessionId, 'string');
|
||||
assert_equals(typeof mediaKeySession.onopen, 'undefined');
|
||||
assert_equals(typeof mediaKeySession.onmessage, 'undefined');
|
||||
assert_equals(typeof mediaKeySession.onclose, 'undefined');
|
||||
assert_equals(typeof mediaKeySession.onerror, 'undefined');
|
||||
}
|
||||
|
||||
async_test(function(test)
|
||||
|
|
7
tests/wpt/web-platform-tests/encrypted-media/README.md
Normal file
7
tests/wpt/web-platform-tests/encrypted-media/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
## Preparing to run tests
|
||||
The following steps may be necessary when running test from a new server/origin for the first time.
|
||||
* Some implementations and/or tests may require consent.
|
||||
When running on such clients, manually run a test to trigger the consent request and choose to persist the consent.
|
||||
* Some of the tests, such as *-retrieve-*, use pop-ups.
|
||||
It may be necessary to run these tests manually and choose to always allow pop-ups on the origin.
|
||||
Related test failures may appear as: "Cannot set property 'onload' of undefined"
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -41,7 +40,7 @@
|
|||
content: contentitem,
|
||||
messagehandler: handler.messagehandler,
|
||||
initDataType: 'keyids',
|
||||
initData: getMultikeyInitDatas(contentitem,'keyids'),
|
||||
initData: getMultikeyInitDatas(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -40,7 +39,7 @@
|
|||
content: contentitem,
|
||||
messagehandler: handler.messagehandler,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
initData: getInitData(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
initData: getInitData(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
initData: getInitData(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -44,8 +43,8 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2 };
|
||||
initData: getInitData(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -44,8 +43,8 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2 };
|
||||
initData: getInitData(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2,
|
||||
windowscript: 'resources/retrieve-persistent-usage-record.html' };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -44,8 +43,8 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2 };
|
||||
initData: getInitData(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -23,7 +22,7 @@
|
|||
<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>
|
||||
<script src=/encrypted-media/scripts/playback-temporary.js></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -45,8 +44,8 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2,
|
||||
testcase: 'audio/video' };
|
||||
testcase: 'multikey audio/video' };
|
||||
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -23,7 +22,7 @@
|
|||
<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>
|
||||
<script src=/encrypted-media/scripts/playback-temporary-multisession.js></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -45,8 +44,7 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getMultikeyInitDatas(contentitem,'keyids'),
|
||||
duration: 5,
|
||||
testcase: 'sequential' };
|
||||
testcase: 'multikey video' };
|
||||
|
||||
runTest(config);
|
||||
</script>
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_AFTER_SRC };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_AFTER_UPDATE };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_IMMEDIATELY };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_ONENCRYPTED };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2 };
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -44,8 +43,8 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getMultikeyInitDatas(contentitem,'keyids'),
|
||||
duration: 5 };
|
||||
initData: getMultikeyInitDatas(contentitem,'keyids')
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,7 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
duration: 2 };
|
||||
testcase: 'single key' };
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -148,20 +148,35 @@ function getProprietaryInitDatas( contentitem )
|
|||
.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 )
|
||||
// Returns a promise that resolves to the following object
|
||||
// { supported: boolean, // whether the content is supported at all
|
||||
// content: <the content item>, // the content item description
|
||||
// initDataTypes: <list of initDataTypes>
|
||||
// }
|
||||
//
|
||||
// Note: we test initData types one at a time since some versions of Edge don't support testing several at once
|
||||
//
|
||||
function isContentSupportedForInitDataTypes( keysystem, initDataTypes, 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 };
|
||||
} );
|
||||
return Promise.all( initDataTypes.map( function( initDataType ) {
|
||||
var configuration = { initDataTypes : [ initDataType ],
|
||||
audioCapabilities: [ { contentType: contentitem.audio.type } ],
|
||||
videoCapabilities: [ { contentType: contentitem.video.type } ]
|
||||
};
|
||||
return navigator.requestMediaKeySystemAccess( keysystem, [ configuration ] ).then( function( access ) {
|
||||
return { supported: true, initDataType: access.getConfiguration().initDataTypes[ 0 ] };
|
||||
}, function() {
|
||||
return { supported: false };
|
||||
} );
|
||||
} ) ).then( function( results ) {
|
||||
|
||||
var initDataTypes = results.filter( function( result ) { return result.supported; } )
|
||||
.map( function( result ) { return result.initDataType; } );
|
||||
|
||||
return initDataTypes.length > 0 ?
|
||||
{ content: contentitem, supported: true, initDataTypes: initDataTypes }
|
||||
: { content: contentitem, supported: false };
|
||||
} );
|
||||
}
|
||||
|
||||
// Returns a promise that resolves to { content:, supported:, initDataTypes: } object
|
||||
|
@ -196,4 +211,4 @@ function getSimpleConfigurationForContent( contentitem )
|
|||
return { initDataTypes: [ 'keyids', 'webm', 'cenc' ],
|
||||
audioCapabilities: [ { contentType: contentitem.audio.type } ],
|
||||
videoCapabilities: [ { contentType: contentitem.video.type } ] };
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,7 @@
|
|||
content: contentitem,
|
||||
messagehandler: handler.messagehandler,
|
||||
initDataType: contentitem.initDataType,
|
||||
initData: getProprietaryInitDatas(contentitem).initDatas.map( base64DecodeToUnit8Array ),
|
||||
initData: getProprietaryInitDatas(contentitem).initDatas.map( base64DecodeToUnit8Array )
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -42,7 +41,7 @@
|
|||
content: contentitem,
|
||||
messagehandler: handler.messagehandler,
|
||||
initDataType: contentitem.initDataType,
|
||||
initData: base64DecodeToUnit8Array( getProprietaryInitDatas(contentitem).initDatas[ 0 ] ),
|
||||
initData: base64DecodeToUnit8Array( getProprietaryInitDatas(contentitem).initDatas[ 0 ] )
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<!-- Content metadata -->
|
||||
<script src=/encrypted-media/content/content-metadata.js></script>
|
||||
|
||||
<!-- Message handler for Clear Key keysystem -->
|
||||
<!-- Message handler for DRM keysystem -->
|
||||
<script src=/encrypted-media/util/drm-messagehandler.js></script>
|
||||
|
||||
<!-- The script for this specific test -->
|
||||
|
@ -43,8 +43,8 @@
|
|||
videoPath: contentitem.video.path,
|
||||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2 };
|
||||
initDataType: contentitem.initDataType
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<script>
|
||||
var keysystem = getSupportedKeySystem(),
|
||||
contentitem = content['mp4-basic'],
|
||||
handler = new MessageHandler( keysystem, contentitem ),
|
||||
handler = new MessageHandler( keysystem, contentitem, 'persistent-license' ),
|
||||
config = { video: document.getElementById('videoelement'),
|
||||
keysystem: keysystem,
|
||||
messagehandler: handler.messagehandler,
|
||||
|
@ -43,8 +43,7 @@
|
|||
videoPath: contentitem.video.path,
|
||||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: 'keyids',
|
||||
initData: getInitData(contentitem,'keyids'),
|
||||
initDataType: contentitem.initDataType,
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<!-- Content metadata -->
|
||||
<script src=/encrypted-media/content/content-metadata.js></script>
|
||||
|
||||
<!-- Message handler for Clear Key keysystem -->
|
||||
<!-- Message handler for DRM keysystem -->
|
||||
<script src=/encrypted-media/util/drm-messagehandler.js></script>
|
||||
|
||||
<!-- The script for this specific test -->
|
||||
|
@ -43,7 +43,7 @@
|
|||
videoPath: contentitem.video.path,
|
||||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
initDataType: contentitem.initDataType
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,8 +44,8 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
servercertificate: handler.servercertificate,
|
||||
duration: 2 };
|
||||
servercertificate: handler.servercertificate
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
servercertificate: handler.servercertificate,
|
||||
duration: 2 };
|
||||
servercertificate: handler.servercertificate
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<!-- Content metadata -->
|
||||
<script src=/encrypted-media/content/content-metadata.js></script>
|
||||
|
||||
<!-- Message handler for Clear Key keysystem -->
|
||||
<!-- Message handler for DRM keysystem -->
|
||||
<script src=/encrypted-media/util/drm-messagehandler.js></script>
|
||||
|
||||
<!-- The script for this specific test -->
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<!-- Content metadata -->
|
||||
<script src=/encrypted-media/content/content-metadata.js></script>
|
||||
|
||||
<!-- Message handler for Clear Key keysystem -->
|
||||
<!-- Message handler for DRM keysystem -->
|
||||
<script src=/encrypted-media/util/drm-messagehandler.js></script>
|
||||
|
||||
<!-- The script for this specific test -->
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -46,7 +45,6 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
servercertificate: handler.servercertificate,
|
||||
duration: 2,
|
||||
windowscript: 'resources/drm-retrieve-persistent-usage-record.html' };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
videoPath: contentitem.video.path,
|
||||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2 };
|
||||
initDataType: contentitem.initDataType
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
<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>
|
||||
<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 -->
|
||||
|
@ -23,7 +22,7 @@
|
|||
<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>
|
||||
<script src=/encrypted-media/scripts/playback-temporary.js></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -45,9 +44,8 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2,
|
||||
testcase: 'audio/video' };
|
||||
|
||||
testcase: 'multikey audio/video'
|
||||
};
|
||||
runTest(config);
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -23,7 +22,7 @@
|
|||
<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>
|
||||
<script src=/encrypted-media/scripts/playback-temporary-multisession.js></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -46,8 +45,7 @@
|
|||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
initData: getProprietaryInitDatas(contentitem).initDatas.map( base64DecodeToUnit8Array ),
|
||||
duration: 5,
|
||||
testcase: 'sequential' };
|
||||
testcase: 'multikey video' };
|
||||
|
||||
runTest(config);
|
||||
</script>
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_AFTER_SRC };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_AFTER_UPDATE };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_IMMEDIATELY };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,6 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2,
|
||||
testcase: SETMEDIAKEYS_ONENCRYPTED };
|
||||
|
||||
runTest(config);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -46,8 +45,8 @@
|
|||
videoPath: contentitem.video.path,
|
||||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2 };
|
||||
initDataType: contentitem.initDataType
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -20,7 +19,7 @@
|
|||
<script src=/encrypted-media/content/content-metadata.js></script>
|
||||
|
||||
<!-- Message handler for DRM keysystem -->
|
||||
<script src=/encrypted-media/util/drmtoday-messagehandler.js></script>
|
||||
<script src=/encrypted-media/util/drm-messagehandler.js></script>
|
||||
|
||||
<!-- The script for this specific test -->
|
||||
<script src=/encrypted-media/scripts/playback-temporary-waitingforkey.js></script>
|
||||
|
@ -35,16 +34,18 @@
|
|||
|
||||
<script>
|
||||
var contentitem = content['mp4-basic'],
|
||||
keysystem = getSupportedKeySystem(),
|
||||
handler = new MessageHandler( keysystem, contentitem ),
|
||||
config = { video: document.getElementById('videoelement'),
|
||||
keysystem: getSupportedKeySystem(),
|
||||
messagehandler: messagehandler.bind( contentitem ),
|
||||
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 };
|
||||
};
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
@ -45,7 +44,7 @@
|
|||
audioType: contentitem.audio.type,
|
||||
videoType: contentitem.video.type,
|
||||
initDataType: contentitem.initDataType,
|
||||
duration: 2 };
|
||||
testcase: 'single key' };
|
||||
|
||||
runTest(config);
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<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/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>Encrypted Media Extensions: persistent-license, retrieve and destroy, ClearKey</title>
|
||||
<link rel="help" href="https://w3c.github.io/encrypted-media/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>Encrypted Media Extensions: persistent-license, retrieve and playback, ClearKey</title>
|
||||
<link rel="help" href="https://w3c.github.io/encrypted-media/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>Encrypted Media Extensions: persistent-license, retrieve and destroy, drm</title>
|
||||
<link rel="help" href="https://w3c.github.io/encrypted-media/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>Encrypted Media Extensions: persistent-license, retrieve and playback, DRM</title>
|
||||
<link rel="help" href="https://w3c.github.io/encrypted-media/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>Encrypted Media Extensions: Retrieve stored persistent-usage-record</title>
|
||||
<link rel="help" href="https://w3c.github.io/encrypted-media/">
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>Encrypted Media Extensions: Retrieve stored persistent-usage-record</title>
|
||||
<link rel="help" href="https://w3c.github.io/encrypted-media/">
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
function runTest(config,qualifier) {
|
||||
|
||||
// Create a session and call generateRequest() temporary, |initDataType|
|
||||
// and |initData|. generateRequest() should fail temporary, an
|
||||
// InvalidAccessError. Returns a promise that resolves successfully
|
||||
// if the error happened, rejects otherwise.
|
||||
function test_session(keysystem,initDataType, initData)
|
||||
// Create a "temporary" session for |keysystem| and call generateRequest()
|
||||
// with the provided initData. generateRequest() should fail with an
|
||||
// TypeError. Returns a promise that is resolved
|
||||
// if the error occurred and rejected otherwise.
|
||||
function test_session(keysystem, initDataType, initData)
|
||||
{
|
||||
return isInitDataTypeSupported(initDataType).then(function(result) {
|
||||
// If |initDataType| is not supported, simply succeed.
|
||||
if (!result)
|
||||
return Promise.resolve('Not supported');
|
||||
|
||||
return navigator.requestMediaKeySystemAccess( keysystem, getSimpleConfigurationForInitDataType(initDataType)).then(function(access) {
|
||||
return navigator.requestMediaKeySystemAccess(keysystem, getSimpleConfigurationForInitDataType(initDataType)).then(function(access) {
|
||||
return access.createMediaKeys();
|
||||
}).then(function(mediaKeys) {
|
||||
var mediaKeySession = mediaKeys.createSession();
|
||||
var mediaKeySession = mediaKeys.createSession("temporary");
|
||||
return mediaKeySession.generateRequest(initDataType, initData);
|
||||
}).then(function() {
|
||||
assert_unreached('generateRequest() succeeded');
|
||||
assert_unreached('generateRequest() succeeded unexpectedly');
|
||||
}, function(error) {
|
||||
assert_equals(error.name, 'InvalidAccessError');
|
||||
assert_equals(error.name, 'TypeError');
|
||||
return Promise.resolve('success');
|
||||
});
|
||||
})
|
||||
|
@ -28,19 +28,19 @@ function runTest(config,qualifier) {
|
|||
promise_test(function()
|
||||
{
|
||||
var initData = new Uint8Array(70000);
|
||||
return test_session(config.keysystem,'webm', initData);
|
||||
return test_session(config.keysystem, 'webm', initData);
|
||||
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, webm, initData longer than 64Kb characters');
|
||||
|
||||
promise_test(function()
|
||||
{
|
||||
var initData = new Uint8Array(70000);
|
||||
return test_session(config.keysystem,'cenc', initData);
|
||||
return test_session(config.keysystem, 'cenc', initData);
|
||||
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, cenc, initData longer than 64Kb characters');
|
||||
|
||||
promise_test(function()
|
||||
{
|
||||
var initData = new Uint8Array(70000);
|
||||
return test_session(config.keysystem,'keyids', initData);
|
||||
return test_session(config.keysystem, 'keyids', initData);
|
||||
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, keyids, initData longer than 64Kb characters');
|
||||
|
||||
promise_test(function()
|
||||
|
@ -56,7 +56,7 @@ function runTest(config,qualifier) {
|
|||
0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B,
|
||||
0x00, 0x00, 0x00, 0x00 // datasize
|
||||
]);
|
||||
return test_session(config.keysystem,'cenc', initData);
|
||||
return test_session(config.keysystem, 'cenc', initData);
|
||||
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, cenc, invalid initdata (invalid pssh)');
|
||||
|
||||
promise_test(function()
|
||||
|
@ -71,7 +71,7 @@ function runTest(config,qualifier) {
|
|||
0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B,
|
||||
0x00, 0x00, 0x00, 0x00 // datasize
|
||||
]);
|
||||
return test_session(config.keysystem,'cenc', initData);
|
||||
return test_session(config.keysystem, 'cenc', initData);
|
||||
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, cenc, invalid initdata (not pssh)');
|
||||
|
||||
promise_test(function()
|
||||
|
@ -79,7 +79,7 @@ function runTest(config,qualifier) {
|
|||
// Valid key ID size must be at least 1 character for keyids.
|
||||
var keyId = new Uint8Array(0);
|
||||
var initData = stringToUint8Array(createKeyIDs(keyId));
|
||||
return test_session(config.keysystem,'keyids', initData);
|
||||
return test_session(config.keysystem, 'keyids', initData);
|
||||
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, keyids, invalid initdata (too short key ID)');
|
||||
|
||||
promise_test(function()
|
||||
|
@ -87,6 +87,6 @@ function runTest(config,qualifier) {
|
|||
// Valid key ID size must be less than 512 characters for keyids.
|
||||
var keyId = new Uint8Array(600);
|
||||
var initData = stringToUint8Array(createKeyIDs(keyId));
|
||||
return test_session(config.keysystem,'keyids', initData);
|
||||
return test_session(config.keysystem, 'keyids', initData);
|
||||
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, keyids, invalid initdata (too long key ID)');
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ function runTest(config,qualifier) {
|
|||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) && !_timeupdateEvent ) {
|
||||
if ( _video.currentTime > ( config.duration || 1 ) && !_timeupdateEvent ) {
|
||||
_timeupdateEvent = true;
|
||||
_video.pause();
|
||||
_mediaKeySession.remove().then( recordEventFunc('remove-done') ).catch(onFailure);
|
||||
|
|
|
@ -19,6 +19,10 @@ function runTest(config,qualifier) {
|
|||
_mediaSource,
|
||||
_releaseSequence = false;
|
||||
|
||||
function onFailure(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
assert_equals( event.target, _mediaKeySession );
|
||||
// event instance verification failing on CastTV
|
||||
|
@ -35,15 +39,13 @@ function runTest(config,qualifier) {
|
|||
}
|
||||
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
_mediaKeySession.update( response ).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}).then(function() {
|
||||
_mediaKeySession.update( response ).then(function() {
|
||||
if(event.messageType === 'license-request') {
|
||||
_video.setMediaKeys(_mediaKeys);
|
||||
return _video.setMediaKeys(_mediaKeys);
|
||||
} else if(event.messageType === 'license-release') {
|
||||
test.done();
|
||||
}
|
||||
});
|
||||
}).catch(onFailure);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -55,9 +57,7 @@ function runTest(config,qualifier) {
|
|||
waitForEventAndRunStep('message', _mediaKeySession, onMessage, test);
|
||||
_mediaKeySession.generateRequest( config.initData ? config.initDataType : event.initDataType,
|
||||
config.initData || event.initData )
|
||||
.catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
.catch(onFailure);
|
||||
}
|
||||
|
||||
function onClosed(event) {
|
||||
|
@ -66,18 +66,13 @@ function runTest(config,qualifier) {
|
|||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) && !_releaseSequence ) {
|
||||
|
||||
if ( _video.currentTime > ( config.duration || 1 ) && !_releaseSequence ) {
|
||||
_video.removeEventListener('timeupdate', onTimeupdate );
|
||||
|
||||
_video.pause();
|
||||
|
||||
_releaseSequence = true;
|
||||
|
||||
_mediaKeySession.closed.then( test.step_func( onClosed ) );
|
||||
_mediaKeySession.remove().catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
_mediaKeySession.remove().catch(onFailure);
|
||||
|
||||
_video.removeEventListener('timeupdate', onTimeupdate );
|
||||
}
|
||||
|
@ -95,7 +90,6 @@ function runTest(config,qualifier) {
|
|||
}).then(function(mediaKeys) {
|
||||
_mediaKeys = mediaKeys;
|
||||
_mediaKeySession = _mediaKeys.createSession( 'persistent-usage-record' );
|
||||
|
||||
waitForEventAndRunStep('encrypted', _video, onEncrypted, test);
|
||||
waitForEventAndRunStep('playing', _video, onPlaying, test);
|
||||
}).then(function() {
|
||||
|
@ -106,8 +100,6 @@ function runTest(config,qualifier) {
|
|||
_mediaSource = source;
|
||||
_video.src = URL.createObjectURL(_mediaSource);
|
||||
_video.play();
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}, testname);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ function runTest(config,qualifier) {
|
|||
_sessionId,
|
||||
_isClosing = false;
|
||||
|
||||
function onFailure(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}
|
||||
|
||||
function onEncrypted(event) {
|
||||
assert_equals(event.target, _video);
|
||||
assert_true(event instanceof window.MediaEncryptedEvent);
|
||||
|
@ -28,11 +32,8 @@ function runTest(config,qualifier) {
|
|||
waitForEventAndRunStep('message', _mediaKeySession, onMessage, test);
|
||||
_mediaKeySession.generateRequest( config.initDataType || event.initDataType,
|
||||
config.initData || event.initData ).then( function() {
|
||||
|
||||
_sessionId = _mediaKeySession.sessionId;
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
|
@ -43,24 +44,20 @@ function runTest(config,qualifier) {
|
|||
assert_in_array( event.messageType, [ 'license-request', 'individualization-request' ] );
|
||||
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
|
||||
_mediaKeySession.update( response ).then(function() {
|
||||
_video.setMediaKeys(_mediaKeys);
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
});
|
||||
}
|
||||
|
||||
function onPlaying(event) {
|
||||
|
||||
// Not using waitForEventAndRunStep() to avoid too many
|
||||
// EVENT(onTimeUpdate) logs.
|
||||
_video.addEventListener('timeupdate', onTimeupdate, true);
|
||||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( !_isClosing && _video.currentTime > ( config.duration || 2 ) ) {
|
||||
if ( !_isClosing && _video.currentTime > ( config.duration || 1 ) ) {
|
||||
_isClosing = true;
|
||||
_video.removeEventListener('timeupdate', onTimeupdate );
|
||||
_video.pause();
|
||||
|
@ -75,15 +72,11 @@ function runTest(config,qualifier) {
|
|||
|
||||
var win = window.open( config.windowscript );
|
||||
window.addEventListener('message', test.step_func(function( event ) {
|
||||
|
||||
event.data.forEach(test.step_func(function( assertion ) {
|
||||
|
||||
assert_equals(assertion.actual, assertion.expected, assertion.message);
|
||||
|
||||
}));
|
||||
|
||||
win.close();
|
||||
|
||||
test.done();
|
||||
}));
|
||||
|
||||
|
@ -91,7 +84,6 @@ function runTest(config,qualifier) {
|
|||
delete config.messagehandler;
|
||||
|
||||
win.onload = function() {
|
||||
|
||||
win.postMessage( { config: config, sessionId: _sessionId }, '*' );
|
||||
}
|
||||
}
|
||||
|
@ -100,14 +92,11 @@ function runTest(config,qualifier) {
|
|||
return access.createMediaKeys();
|
||||
}).then(function(mediaKeys) {
|
||||
_mediaKeys = mediaKeys;
|
||||
|
||||
_video.setMediaKeys( mediaKeys );
|
||||
|
||||
return _video.setMediaKeys( mediaKeys );
|
||||
}).then(function(){
|
||||
_mediaKeySession = _mediaKeys.createSession( 'persistent-usage-record' );
|
||||
|
||||
waitForEventAndRunStep('encrypted', _video, onEncrypted, test);
|
||||
waitForEventAndRunStep('playing', _video, onPlaying, test);
|
||||
}).then(function() {
|
||||
return config.servercertificate ? _mediaKeys.setServerCertificate( config.servercertificate ) : true;
|
||||
}).then(function( success ) {
|
||||
return testmediasource(config);
|
||||
|
@ -115,8 +104,6 @@ function runTest(config,qualifier) {
|
|||
_mediaSource = source;
|
||||
_video.src = URL.createObjectURL(_mediaSource);
|
||||
_video.play();
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}, testname);
|
||||
}
|
||||
|
|
|
@ -11,24 +11,23 @@ function runTest(config,qualifier) {
|
|||
sessionTypes: [ 'temporary' ] };
|
||||
|
||||
async_test( function( test ) {
|
||||
|
||||
var _video = config.video,
|
||||
_mediaKeys,
|
||||
_mediaKeySession,
|
||||
_mediaSource,
|
||||
_allKeysUsableEvent = false,
|
||||
_playingEvent = false,
|
||||
_timeupdateEvent = false,
|
||||
_events = [ ];
|
||||
|
||||
function onFailure(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
assert_equals( event.target, _mediaKeySession );
|
||||
assert_true( event instanceof window.MediaKeyMessageEvent );
|
||||
assert_equals( event.type, 'message');
|
||||
|
||||
assert_any( assert_equals,
|
||||
event.messageType,
|
||||
[ 'license-request', 'individualization-request' ] );
|
||||
assert_in_array( event.messageType, [ 'license-request', 'individualization-request' ] );
|
||||
|
||||
if ( event.messageType !== 'individualization-request' ) {
|
||||
_events.push( event.messageType );
|
||||
|
@ -36,13 +35,10 @@ function runTest(config,qualifier) {
|
|||
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
_events.push( 'license-response' );
|
||||
|
||||
waitForEventAndRunStep('keystatuseschange', _mediaKeySession, onKeyStatusesChange, test);
|
||||
_mediaKeySession.update( response ).then( function() {
|
||||
_events.push('updated');
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -50,24 +46,21 @@ function runTest(config,qualifier) {
|
|||
assert_equals(event.target, _mediaKeySession );
|
||||
assert_true(event instanceof window.Event );
|
||||
assert_equals(event.type, 'keystatuseschange' );
|
||||
|
||||
var hasKeys = false, pendingKeys = false;
|
||||
_mediaKeySession.keyStatuses.forEach( function( value, keyid ) {
|
||||
assert_any( assert_equals, value, [ 'status-pending', 'usable' ] );
|
||||
|
||||
hasKeys = true;
|
||||
pendingKeys = pendingKeys || ( value === 'status-pending' );
|
||||
|
||||
});
|
||||
|
||||
if ( !_allKeysUsableEvent && hasKeys && !pendingKeys ) {
|
||||
_allKeysUsableEvent = true;
|
||||
_events.push( 'allkeysusable' );
|
||||
_video.setMediaKeys(_mediaKeys);
|
||||
}
|
||||
|
||||
if ( !hasKeys ) {
|
||||
_events.push( 'emptykeyslist' );
|
||||
} else if (!pendingKeys ) {
|
||||
_events.push( 'allkeysusable' );
|
||||
_video.setMediaKeys(_mediaKeys).catch(onFailure);
|
||||
} else {
|
||||
assert_unreached('unexpected ' + event.type + ' event');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,17 +73,12 @@ function runTest(config,qualifier) {
|
|||
_mediaKeySession.generateRequest( config.initData ? config.initDataType : event.initDataType,
|
||||
config.initData || event.initData ).then( function() {
|
||||
_events.push( 'generaterequest' );
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}
|
||||
|
||||
function onClosed(event) {
|
||||
|
||||
_events.push( 'closed-promise' );
|
||||
|
||||
setTimeout( test.step_func( function() {
|
||||
|
||||
assert_array_equals( _events,
|
||||
[
|
||||
'generaterequest',
|
||||
|
@ -104,30 +92,23 @@ function runTest(config,qualifier) {
|
|||
'emptykeyslist'
|
||||
],
|
||||
"Expected events sequence" );
|
||||
|
||||
_video.src = "";
|
||||
_video.setMediaKeys( null ).then(function(){
|
||||
test.done();
|
||||
});
|
||||
test.done();
|
||||
} ), 0 );
|
||||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) && !_timeupdateEvent ) {
|
||||
if ( _video.currentTime > ( config.duration || 1 ) && !_timeupdateEvent ) {
|
||||
_timeupdateEvent = true;
|
||||
_video.pause();
|
||||
|
||||
_mediaKeySession.closed.then( test.step_func( onClosed ) );
|
||||
_mediaKeySession.close().then( function() {
|
||||
_events.push( 'closed' );
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaying(event) {
|
||||
_playingEvent = true;
|
||||
_events.push( 'playing' );
|
||||
|
||||
// Not using waitForEventAndRunStep() to avoid too many
|
||||
|
@ -149,8 +130,6 @@ function runTest(config,qualifier) {
|
|||
_mediaSource = source;
|
||||
_video.src = URL.createObjectURL(_mediaSource);
|
||||
_video.play();
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}, testname);
|
||||
}
|
||||
|
|
|
@ -15,44 +15,47 @@ function runTest(config,qualifier) {
|
|||
|
||||
var _video = config.video,
|
||||
_mediaKeys,
|
||||
_mediaKeySessions = [ ],
|
||||
_mediaSource;
|
||||
_mediaKeySessions = [ ];
|
||||
|
||||
function onFailure( error ) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
consoleWrite( "message " + event.messageType );
|
||||
assert_any( assert_equals, event.target, _mediaKeySessions );
|
||||
assert_true( event instanceof window.MediaKeyMessageEvent );
|
||||
assert_equals( event.type, 'message');
|
||||
assert_in_array( event.messageType, [ 'license-request', 'individualization-request' ] );
|
||||
|
||||
assert_any( assert_equals,
|
||||
event.messageType,
|
||||
[ 'license-request', 'individualization-request' ] );
|
||||
|
||||
config.messagehandler( event.messageType, event.message )
|
||||
.then( function( response ) {
|
||||
|
||||
event.target.update( response )
|
||||
.catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
event.target.update( response ).catch(onFailure);
|
||||
});
|
||||
}
|
||||
|
||||
function onWaitingForKey(event) {
|
||||
consoleWrite( "waitingforkey");
|
||||
}
|
||||
|
||||
function onPlaying(event) {
|
||||
consoleWrite( "playing");
|
||||
waitForEventAndRunStep('pause', _video, onStopped, test);
|
||||
waitForEventAndRunStep('waiting', _video, onStopped, test);
|
||||
waitForEventAndRunStep('stalled', _video, onStopped, test);
|
||||
}
|
||||
|
||||
// Not using waitForEventAndRunStep() to avoid too many
|
||||
// EVENT(onTimeUpdate) logs.
|
||||
_video.addEventListener('timeupdate', onTimeupdate, true);
|
||||
|
||||
function onStopped(event) {
|
||||
consoleWrite( event.type );
|
||||
if ( _mediaKeySessions.length < config.initData.length ) {
|
||||
var mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
waitForEventAndRunStep('message', mediaKeySession, onMessage, test);
|
||||
mediaKeySession.generateRequest( config.initDataType, config.initData[ _mediaKeySessions.length ] ).catch(onFailure);
|
||||
_mediaKeySessions.push( mediaKeySession );
|
||||
}
|
||||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) ) {
|
||||
|
||||
consoleWrite("Session 0:");
|
||||
dumpKeyStatuses( _mediaKeySessions[ 0 ].keyStatuses );
|
||||
consoleWrite("Session 1:");
|
||||
dumpKeyStatuses( _mediaKeySessions[ 1 ].keyStatuses );
|
||||
|
||||
if ( _video.currentTime > ( config.duration || 1 ) ) {
|
||||
_video.removeEventListener('timeupdate', onTimeupdate);
|
||||
_video.pause();
|
||||
test.done();
|
||||
|
@ -63,34 +66,24 @@ function runTest(config,qualifier) {
|
|||
return access.createMediaKeys();
|
||||
}).then(function(mediaKeys) {
|
||||
_mediaKeys = mediaKeys;
|
||||
|
||||
_video.setMediaKeys(_mediaKeys);
|
||||
|
||||
return _video.setMediaKeys(_mediaKeys);
|
||||
}).then(function(){
|
||||
waitForEventAndRunStep('waitingforkey', _video, onWaitingForKey, test);
|
||||
waitForEventAndRunStep('playing', _video, onPlaying, test);
|
||||
|
||||
config.initData.forEach( function( initData ) {
|
||||
|
||||
var mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
|
||||
waitForEventAndRunStep('message', mediaKeySession, onMessage, test);
|
||||
|
||||
_mediaKeySessions.push( mediaKeySession );
|
||||
|
||||
mediaKeySession.generateRequest( config.initDataType, initData )
|
||||
.catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
|
||||
} );
|
||||
// Not using waitForEventAndRunStep() to avoid too many
|
||||
// EVENT(onTimeUpdate) logs.
|
||||
_video.addEventListener('timeupdate', onTimeupdate, true);
|
||||
|
||||
var mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
waitForEventAndRunStep('message', mediaKeySession, onMessage, test);
|
||||
_mediaKeySessions.push( mediaKeySession );
|
||||
return mediaKeySession.generateRequest( config.initDataType, config.initData[ 0 ] );
|
||||
}).then(function() {
|
||||
return testmediasource(config);
|
||||
}).then(function(source) {
|
||||
_mediaSource = source;
|
||||
_video.src = URL.createObjectURL(_mediaSource);
|
||||
_video.src = URL.createObjectURL(source);
|
||||
_video.play();
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}, testname);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
function runTest(config,qualifier) {
|
||||
|
||||
// This test assumes one session is required for each provided initData
|
||||
|
||||
var testname = testnamePrefix( qualifier, config.keysystem )
|
||||
+ ', temporary, '
|
||||
+ /video\/([^;]*)/.exec( config.videoType )[ 1 ]
|
||||
+ ', playback with multiple keys, single session, '
|
||||
+ ', playback with multiple sessions, '
|
||||
+ config.testcase;
|
||||
|
||||
var configuration = { initDataTypes: [ config.initDataType ],
|
||||
|
@ -18,36 +20,8 @@ function runTest(config,qualifier) {
|
|||
_mediaKeySessions = [ ],
|
||||
_mediaSource;
|
||||
|
||||
function onEncrypted(event) {
|
||||
assert_equals(event.target, _video);
|
||||
assert_true(event instanceof window.MediaEncryptedEvent);
|
||||
assert_equals(event.type, 'encrypted');
|
||||
|
||||
// Only create a session for the first encrypted event
|
||||
if ( _mediaKeySessions.length > 0 ) return;
|
||||
|
||||
var mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
|
||||
waitForEventAndRunStep('message', mediaKeySession, onMessage, test);
|
||||
|
||||
var initDataType, initData;
|
||||
if ( config.initDataType && config.initData )
|
||||
{
|
||||
initDataType = config.initDataType;
|
||||
initData = config.initData;
|
||||
}
|
||||
else
|
||||
{
|
||||
initDataType = event.initDataType;
|
||||
initData = event.initData;
|
||||
}
|
||||
|
||||
_mediaKeySessions.push( mediaKeySession );
|
||||
|
||||
mediaKeySession.generateRequest( initDataType, initData )
|
||||
.catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
function onFailure( error ) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
|
@ -55,33 +29,21 @@ function runTest(config,qualifier) {
|
|||
assert_true( event instanceof window.MediaKeyMessageEvent );
|
||||
assert_equals( event.type, 'message');
|
||||
|
||||
assert_any( assert_equals,
|
||||
event.messageType,
|
||||
[ 'license-request', 'individualization-request' ] );
|
||||
assert_in_array( event.messageType, [ 'license-request', 'individualization-request' ] );
|
||||
|
||||
config.messagehandler( event.messageType, event.message )
|
||||
.then( function( response ) {
|
||||
|
||||
event.target.update( response )
|
||||
.catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
event.target.update( response ).catch(onFailure);
|
||||
});
|
||||
}
|
||||
|
||||
function onPlaying(event) {
|
||||
|
||||
// Not using waitForEventAndRunStep() to avoid too many
|
||||
// EVENT(onTimeUpdate) logs.
|
||||
_video.addEventListener('timeupdate', onTimeupdate, true);
|
||||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) ) {
|
||||
|
||||
consoleWrite("Session 0:");
|
||||
dumpKeyStatuses( _mediaKeySessions[ 0 ].keyStatuses );
|
||||
|
||||
if ( _video.currentTime > ( config.duration || 1 ) ) {
|
||||
_video.removeEventListener('timeupdate', onTimeupdate);
|
||||
_video.pause();
|
||||
test.done();
|
||||
|
@ -92,20 +54,21 @@ function runTest(config,qualifier) {
|
|||
return access.createMediaKeys();
|
||||
}).then(function(mediaKeys) {
|
||||
_mediaKeys = mediaKeys;
|
||||
|
||||
_video.setMediaKeys(_mediaKeys);
|
||||
|
||||
waitForEventAndRunStep('encrypted', _video, onEncrypted, test);
|
||||
return _video.setMediaKeys(_mediaKeys);
|
||||
}).then(function() {
|
||||
waitForEventAndRunStep('playing', _video, onPlaying, test);
|
||||
|
||||
}).then(function() {
|
||||
config.initData.forEach( function( initData ) {
|
||||
var mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
waitForEventAndRunStep('message', mediaKeySession, onMessage, test);
|
||||
_mediaKeySessions.push( mediaKeySession );
|
||||
mediaKeySession.generateRequest( config.initDataType, initData ).catch( onFailure );
|
||||
} );
|
||||
return testmediasource(config);
|
||||
}).then(function(source) {
|
||||
_mediaSource = source;
|
||||
_video.src = URL.createObjectURL(_mediaSource);
|
||||
_video.play();
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}, testname);
|
||||
}
|
|
@ -67,7 +67,7 @@ function runTest(config,qualifier) {
|
|||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) ) {
|
||||
if ( _video.currentTime > ( config.duration || 1 ) ) {
|
||||
_video.pause();
|
||||
test.done();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ function runTest(config,qualifier) {
|
|||
promise_test(function(test)
|
||||
{
|
||||
var promises = config.video.map( function( video ) { return play_video_as_promise( test, video ); } );
|
||||
|
||||
return Promise.all(promises);
|
||||
|
||||
}, testname );
|
||||
|
@ -23,6 +22,10 @@ function runTest(config,qualifier) {
|
|||
_mediaKeySession,
|
||||
_mediaSource;
|
||||
|
||||
function onFailure(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
assert_equals( event.target, _mediaKeySession );
|
||||
assert_true( event instanceof window.MediaKeyMessageEvent );
|
||||
|
@ -33,10 +36,7 @@ function runTest(config,qualifier) {
|
|||
[ 'license-request', 'individualization-request' ] );
|
||||
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
|
||||
_mediaKeySession.update( response ).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
_mediaKeySession.update( response ).catch(onFailure);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -49,18 +49,14 @@ function runTest(config,qualifier) {
|
|||
|
||||
_mediaKeySession.generateRequest( config.initData ? config.initDataType : event.initDataType,
|
||||
config.initData || event.initData )
|
||||
.catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
|
||||
_video.setMediaKeys(_mediaKeys);
|
||||
.catch(onFailure);
|
||||
}
|
||||
|
||||
function wait_for_timeupdate_message(video)
|
||||
{
|
||||
return new Promise(function(resolve) {
|
||||
video.addEventListener('timeupdate', function listener(event) {
|
||||
if ( event.target.currentTime > ( config.duration || 2 ) )
|
||||
if ( event.target.currentTime > ( config.duration || 1 ) )
|
||||
{
|
||||
video.removeEventListener('timeupdate', listener);
|
||||
resolve(event);
|
||||
|
@ -73,19 +69,16 @@ function runTest(config,qualifier) {
|
|||
return access.createMediaKeys();
|
||||
}).then(function(mediaKeys) {
|
||||
_mediaKeys = mediaKeys;
|
||||
_mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
|
||||
waitForEventAndRunStep('encrypted', _video, onEncrypted, test);
|
||||
|
||||
return _video.setMediaKeys(_mediaKeys);
|
||||
}).then(function() {
|
||||
_mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
waitForEventAndRunStep('encrypted', _video, onEncrypted, test);
|
||||
return testmediasource(config);
|
||||
}).then(function(source) {
|
||||
_mediaSource = source;
|
||||
_video.src = URL.createObjectURL(_mediaSource);
|
||||
_video.play();
|
||||
return wait_for_timeupdate_message(_video);
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ function runTest(config,qualifier) {
|
|||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) ) {
|
||||
if ( _video.currentTime > ( config.duration || 1 ) ) {
|
||||
assert_equals( _mediaKeySessions.length, config.initData.length );
|
||||
_video.removeEventListener('timeupdate', onTimeupdate);
|
||||
_video.pause();
|
||||
|
@ -60,7 +60,6 @@ function runTest(config,qualifier) {
|
|||
// Not using waitForEventAndRunStep() to avoid too many
|
||||
// EVENT(onTimeUpdate) logs.
|
||||
_video.addEventListener('timeupdate', onTimeupdate, true);
|
||||
}).then(function() {
|
||||
return testmediasource(config);
|
||||
}).then(function(source) {
|
||||
_mediaSource = source;
|
||||
|
|
|
@ -3,7 +3,7 @@ function runTest(config,qualifier) {
|
|||
var testname = testnamePrefix( qualifier, config.keysystem )
|
||||
+ ', temporary, '
|
||||
+ /video\/([^;]*)/.exec( config.videoType )[ 1 ]
|
||||
+ ', playback';
|
||||
+ ', playback, ' + config.testcase;
|
||||
|
||||
var configuration = { initDataTypes: [ config.initDataType ],
|
||||
audioCapabilities: [ { contentType: config.audioType } ],
|
||||
|
@ -17,6 +17,26 @@ function runTest(config,qualifier) {
|
|||
_mediaKeySession,
|
||||
_mediaSource;
|
||||
|
||||
function onFailure(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
}
|
||||
|
||||
function onEncrypted(event) {
|
||||
assert_equals(event.target, _video);
|
||||
assert_true(event instanceof window.MediaEncryptedEvent);
|
||||
assert_equals(event.type, 'encrypted');
|
||||
|
||||
// Only create the session for the firs encrypted event
|
||||
if ( _mediaKeySession !== undefined ) return;
|
||||
|
||||
var initDataType = config.initData ? config.initDataType : event.initDataType;
|
||||
var initData = config.initData || event.initData;
|
||||
|
||||
_mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
waitForEventAndRunStep('message', _mediaKeySession, onMessage, test);
|
||||
_mediaKeySession.generateRequest( initDataType, initData ).catch(onFailure);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
assert_equals( event.target, _mediaKeySession );
|
||||
assert_true( event instanceof window.MediaKeyMessageEvent );
|
||||
|
@ -27,57 +47,36 @@ function runTest(config,qualifier) {
|
|||
[ 'license-request', 'individualization-request' ] );
|
||||
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
|
||||
_mediaKeySession.update( response ).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
event.target.update( response ).catch(onFailure);
|
||||
});
|
||||
}
|
||||
|
||||
function onEncrypted(event) {
|
||||
assert_equals(event.target, _video);
|
||||
assert_true(event instanceof window.MediaEncryptedEvent);
|
||||
assert_equals(event.type, 'encrypted');
|
||||
|
||||
waitForEventAndRunStep('message', _mediaKeySession, onMessage, test);
|
||||
_mediaKeySession.generateRequest( config.initData ? config.initDataType : event.initDataType,
|
||||
config.initData || event.initData )
|
||||
.catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
|
||||
_video.setMediaKeys(_mediaKeys);
|
||||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 2 ) ) {
|
||||
_video.pause();
|
||||
test.done();
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaying(event) {
|
||||
// Not using waitForEventAndRunStep() to avoid too many
|
||||
// EVENT(onTimeUpdate) logs.
|
||||
_video.addEventListener('timeupdate', onTimeupdate, true);
|
||||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 1 ) ) {
|
||||
_video.pause();
|
||||
test.done();
|
||||
}
|
||||
}
|
||||
|
||||
navigator.requestMediaKeySystemAccess(config.keysystem, [ configuration ]).then(function(access) {
|
||||
return access.createMediaKeys();
|
||||
}).then(function(mediaKeys) {
|
||||
_mediaKeys = mediaKeys;
|
||||
_mediaKeySession = _mediaKeys.createSession( 'temporary' );
|
||||
|
||||
return _video.setMediaKeys(_mediaKeys);
|
||||
}).then(function(){
|
||||
waitForEventAndRunStep('encrypted', _video, onEncrypted, test);
|
||||
waitForEventAndRunStep('playing', _video, onPlaying, test);
|
||||
}).then(function() {
|
||||
return testmediasource(config);
|
||||
}).then(function(source) {
|
||||
_mediaSource = source;
|
||||
_video.src = URL.createObjectURL(_mediaSource);
|
||||
_video.play();
|
||||
}).catch(function(error) {
|
||||
forceTestFailureFromPromise(test, error);
|
||||
});
|
||||
}).catch(onFailure);
|
||||
}, testname);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@ drmconfig = {
|
|||
"com.widevine.alpha": [ {
|
||||
"serverURL": "https://lic.staging.drmtoday.com/license-proxy-widevine/cenc/",
|
||||
"servertype" : "drmtoday",
|
||||
"userId" : "12345",
|
||||
"merchant" : "cablelabs",
|
||||
"merchant" : "w3c-eme-test",
|
||||
} ],
|
||||
"com.microsoft.playready": [ {
|
||||
"serverURL": "http://playready-testserver.azurewebsites.net/rightsmanager.asmx",
|
||||
|
@ -30,8 +29,7 @@ drmconfig = {
|
|||
"serverURL": "https://lic.staging.drmtoday.com/license-proxy-headerauth/drmtoday/RightsManager.asmx",
|
||||
"servertype" : "drmtoday",
|
||||
"sessionTypes" : [ "temporary", "persistent-usage-record", "persistent-license" ],
|
||||
"userId" : "12345",
|
||||
"merchant" : "cablelabs"
|
||||
"merchant" : "w3c-eme-test"
|
||||
} ]
|
||||
};
|
||||
|
||||
|
@ -135,19 +133,9 @@ MessageHandler.prototype.messagehandler = function messagehandler( messageType,
|
|||
return serverURL;
|
||||
},
|
||||
getCustomHeaders : function( drmconfig, sessionType, messageType ) {
|
||||
|
||||
var customToken;
|
||||
if ( messageType === 'license-request' ) {
|
||||
var customToken = { outputProtection: { digital : false, analogue: false, enforce: false },
|
||||
profile: { purchase: { } },
|
||||
storeLicense: ( sessionType === 'persistent-license' ) };
|
||||
} else {
|
||||
customToken = {};
|
||||
}
|
||||
|
||||
var customHeader = { userId: drmconfig.userId,
|
||||
merchant: drmconfig.merchant,
|
||||
sessionId: btoa( JSON.stringify( customToken )) };
|
||||
var customHeader = { merchant: drmconfig.merchant,
|
||||
userId: "purchase",
|
||||
sessionId: "a0d0f0p" + ( ( sessionType === 'persistent-license' ) ? "1" : "0" ) };
|
||||
return { "dt-custom-data" : btoa( JSON.stringify( customHeader ) ) };
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue