diff options
author | WPT Sync Bot <josh+wptsync@joshmatthews.net> | 2019-01-24 20:55:37 -0500 |
---|---|---|
committer | WPT Sync Bot <josh+wptsync@joshmatthews.net> | 2019-01-24 23:13:56 -0500 |
commit | bdaf11b099f86ba6cb5c9882ead16d46f6db3ca7 (patch) | |
tree | d283874ad14fc52bd3ed0ee7ed2fcdf97c1e00d4 /tests/wpt/web-platform-tests/encrypted-media/scripts/check-encryption-scheme.js | |
parent | 43e21dc845c7e7c930e6cdbb31b218fd80eddf2e (diff) | |
download | servo-bdaf11b099f86ba6cb5c9882ead16d46f6db3ca7.tar.gz servo-bdaf11b099f86ba6cb5c9882ead16d46f6db3ca7.zip |
Update web-platform-tests to revision 388ba3a049a3473b1945b9f8f81e9d6e342a249e
Diffstat (limited to 'tests/wpt/web-platform-tests/encrypted-media/scripts/check-encryption-scheme.js')
-rw-r--r-- | tests/wpt/web-platform-tests/encrypted-media/scripts/check-encryption-scheme.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/encrypted-media/scripts/check-encryption-scheme.js b/tests/wpt/web-platform-tests/encrypted-media/scripts/check-encryption-scheme.js new file mode 100644 index 00000000000..5d629271b42 --- /dev/null +++ b/tests/wpt/web-platform-tests/encrypted-media/scripts/check-encryption-scheme.js @@ -0,0 +1,41 @@ +function runTest(config, qualifier) +{ + function checkEncryptionScheme(encryptionScheme) + { + var simpleConfig = getSimpleConfiguration(); + assert_greater_than(simpleConfig[0].audioCapabilities.length, 0); + simpleConfig[0].audioCapabilities.forEach(function(capability) { + capability.encryptionScheme = encryptionScheme; + }); + + return navigator.requestMediaKeySystemAccess(config.keysystem, simpleConfig) + .then( + function(access) { + var actualConfiguration = access.getConfiguration(); + for (let i = 0; i < actualConfiguration.audioCapabilities.length; i++) { + const capability = actualConfiguration.audioCapabilities[i]; + + // If "encryptionScheme" is not supported, fail. + if (!('encryptionScheme' in capability)) { + return Promise.reject('Not implemented'); + } + + // If "encryptionScheme" is supported, it should be returned. + assert_equals(capability.encryptionScheme, encryptionScheme); + } + return Promise.resolve('Supported'); + }, + function error() { + // CDM does not support "encryptionScheme". Test should still pass. + return Promise.resolve('Not supported'); + }); + } + + promise_test( + () => checkEncryptionScheme('cenc'), + testnamePrefix(qualifier, config.keysystem) + ' support for "cenc" encryption scheme.'); + + promise_test( + () => checkEncryptionScheme('cbcs'), + testnamePrefix(qualifier, config.keysystem) + ' support for "cbcs" encryption scheme.'); +} |