diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-01-25 00:23:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-25 00:23:44 -0500 |
commit | b1669b853b3462d32295431321dcb69377060df4 (patch) | |
tree | 0f87dcb0b71a604e5d4ae82f52dc8fc36072e5e9 /tests/wpt/web-platform-tests/encrypted-media/scripts/check-encryption-scheme.js | |
parent | efecb3e1a2ce2a075784b63ab247399db2dc6cf2 (diff) | |
parent | bdaf11b099f86ba6cb5c9882ead16d46f6db3ca7 (diff) | |
download | servo-b1669b853b3462d32295431321dcb69377060df4.tar.gz servo-b1669b853b3462d32295431321dcb69377060df4.zip |
Auto merge of #22759 - servo-wpt-sync:wpt_update_24-01-2019, r=jdm
Sync WPT with upstream (24-01-2019)
Automated downstream sync of changes from upstream as of 24-01-2019.
[no-wpt-sync]
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22759)
<!-- Reviewable:end -->
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.'); +} |