mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -0,0 +1,48 @@
|
|||
// This test is only applicable to clearkey
|
||||
function runTest(config, qualifier)
|
||||
{
|
||||
var testname = testnamePrefix(qualifier, config.keysystem) + ' test handling of non-ASCII responses for update()';
|
||||
|
||||
var configuration = getSimpleConfigurationForContent(config.content);
|
||||
|
||||
if (config.initDataType) {
|
||||
configuration.initDataTypes = [config.initDataType];
|
||||
}
|
||||
|
||||
promise_test(function (test) {
|
||||
var initDataType;
|
||||
var initData;
|
||||
var mediaKeySession;
|
||||
var messageEventFired = false;
|
||||
|
||||
return navigator.requestMediaKeySystemAccess(config.keysystem, [configuration]).then(function (access) {
|
||||
initDataType = access.getConfiguration().initDataTypes[0];
|
||||
initData = getInitData(config.content, initDataType);
|
||||
return access.createMediaKeys();
|
||||
}).then(function (mediaKeys) {
|
||||
mediaKeySession = mediaKeys.createSession();
|
||||
var eventWatcher = new EventWatcher(test, mediaKeySession, ['message']);
|
||||
var promise = eventWatcher.wait_for('message');
|
||||
mediaKeySession.generateRequest(initDataType, initData);
|
||||
return promise;
|
||||
}).then(function (messageEvent) {
|
||||
// |jwkSet| contains a non-ASCII character \uDC00.
|
||||
var jwkSet = '{"keys":[{'
|
||||
+ '"kty":"oct",'
|
||||
+ '"k":"MDEyMzQ1Njc4OTAxMjM0NQ",'
|
||||
+ '"kid":"MDEyMzQ1Njc4O\uDC00TAxMjM0NQ"'
|
||||
+ '}]}';
|
||||
messageEventFired = true;
|
||||
return messageEvent.target.update(stringToUint8Array(jwkSet));
|
||||
}).then(function () {
|
||||
assert_unreached('Error: update() should fail because the processed message has non-ASCII character.');
|
||||
}).catch(function (error) {
|
||||
if(messageEventFired){
|
||||
assert_equals(error.name, 'TypeError');
|
||||
}
|
||||
else {
|
||||
assert_unreached('Error: ' + error.name);
|
||||
}
|
||||
});
|
||||
}, testname);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue