mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
Update web-platform-tests to revision e8bfc205e36ad699601212cd50083870bad9a75d
This commit is contained in:
parent
65dd6d4340
commit
ccdb0a3458
1428 changed files with 118036 additions and 9786 deletions
|
@ -1,8 +1,8 @@
|
|||
function runTest(config,qualifier) {
|
||||
|
||||
var testname = testnamePrefix( qualifier, config.keysystem )
|
||||
var testname = testnamePrefix(qualifier, config.keysystem)
|
||||
+ ', persistent-license, '
|
||||
+ /video\/([^;]*)/.exec( config.videoType )[ 1 ]
|
||||
+ /video\/([^;]*)/.exec(config.videoType)[1]
|
||||
+ ', ' + config.testcase;
|
||||
|
||||
var configuration = { initDataTypes: [ config.initDataType ],
|
||||
|
@ -11,7 +11,7 @@ function runTest(config,qualifier) {
|
|||
sessionTypes: [ 'persistent-license' ] };
|
||||
|
||||
|
||||
async_test( function( test ) {
|
||||
async_test( function(test) {
|
||||
var _video = config.video,
|
||||
_mediaKeys,
|
||||
_mediaKeySession,
|
||||
|
@ -35,16 +35,15 @@ function runTest(config,qualifier) {
|
|||
}
|
||||
|
||||
function onMessage(event) {
|
||||
assert_equals( event.target, _mediaKeySession );
|
||||
assert_true( event instanceof window.MediaKeyMessageEvent );
|
||||
assert_equals( event.type, 'message');
|
||||
assert_equals(event.target, _mediaKeySession);
|
||||
assert_true(event instanceof window.MediaKeyMessageEvent);
|
||||
assert_equals(event.type, 'message');
|
||||
|
||||
assert_in_array( event.messageType, [ 'license-request', 'individualization-request' ] );
|
||||
assert_in_array(event.messageType, ['license-request', 'individualization-request']);
|
||||
|
||||
config.messagehandler( event.messageType, event.message ).then( function( response ) {
|
||||
_mediaKeySession.update( response )
|
||||
.catch(onFailure);
|
||||
});
|
||||
config.messagehandler(event.messageType, event.message).then(function(response) {
|
||||
return _mediaKeySession.update(response);
|
||||
}).catch(onFailure);
|
||||
}
|
||||
|
||||
function onPlaying(event) {
|
||||
|
@ -54,24 +53,24 @@ function runTest(config,qualifier) {
|
|||
}
|
||||
|
||||
function onTimeupdate(event) {
|
||||
if ( _video.currentTime > ( config.duration || 1 ) ) {
|
||||
_video.removeEventListener('timeupdate', onTimeupdate );
|
||||
if (_video.currentTime > (config.duration || 1)) {
|
||||
_video.removeEventListener('timeupdate', onTimeupdate);
|
||||
_video.pause();
|
||||
_video.removeAttribute('src');
|
||||
_video.load()
|
||||
|
||||
_mediaKeySession.closed.then( test.step_func( onClosed ) );
|
||||
_mediaKeySession.closed.then(test.step_func(onClosed));
|
||||
_mediaKeySession.close();
|
||||
}
|
||||
}
|
||||
|
||||
function onClosed() {
|
||||
// Open a new window in which we will attempt to play with the persisted license
|
||||
var win = window.open( config.windowscript );
|
||||
var win = window.open(config.windowscript);
|
||||
|
||||
// Lisen for an event from the new window containing its test assertions
|
||||
window.addEventListener('message', test.step_func(function( messageEvent ) {
|
||||
messageEvent.data.forEach(test.step_func(function( assertion ) {
|
||||
window.addEventListener('message', test.step_func(function(messageEvent) {
|
||||
messageEvent.data.forEach(test.step_func(function(assertion) {
|
||||
assert_equals(assertion.actual, assertion.expected, assertion.message);
|
||||
}));
|
||||
|
||||
|
@ -85,23 +84,24 @@ function runTest(config,qualifier) {
|
|||
|
||||
// Post the config and session id to the new window when it is ready
|
||||
win.onload = function() {
|
||||
win.postMessage( { config: config, sessionId: _sessionId }, '*' );
|
||||
win.postMessage({config: config, sessionId: _sessionId}, '*');
|
||||
}
|
||||
}
|
||||
|
||||
navigator.requestMediaKeySystemAccess(config.keysystem, [ configuration ]).then(function(access) {
|
||||
navigator.requestMediaKeySystemAccess(config.keysystem, [configuration]).then(function(access) {
|
||||
return access.createMediaKeys();
|
||||
}).then(function(mediaKeys) {
|
||||
_mediaKeys = mediaKeys;
|
||||
_video.setMediaKeys( mediaKeys );
|
||||
_mediaKeySession = _mediaKeys.createSession( 'persistent-license' );
|
||||
_mediaKeySession = _mediaKeys.createSession('persistent-license');
|
||||
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);
|
||||
return source.done;
|
||||
}).then(function(){
|
||||
_video.play();
|
||||
}).catch(onFailure);
|
||||
}, testname);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue