summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/encrypted-media/scripts/setmediakeys-at-same-time.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/encrypted-media/scripts/setmediakeys-at-same-time.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/encrypted-media/scripts/setmediakeys-at-same-time.js')
-rw-r--r--testing/web-platform/tests/encrypted-media/scripts/setmediakeys-at-same-time.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/testing/web-platform/tests/encrypted-media/scripts/setmediakeys-at-same-time.js b/testing/web-platform/tests/encrypted-media/scripts/setmediakeys-at-same-time.js
new file mode 100644
index 000000000..6d67d95b1
--- /dev/null
+++ b/testing/web-platform/tests/encrypted-media/scripts/setmediakeys-at-same-time.js
@@ -0,0 +1,59 @@
+function runTest(config, qualifier) {
+ var testname = testnamePrefix(qualifier, config.keysystem)
+ + ', setmediakeys at same time';
+
+ var configuration = getSimpleConfigurationForContent(config.content);
+
+ async_test(function(test) {
+ var _video = config.video,
+ _access,
+ _mediaKeys1,
+ _mediaKeys2,
+ _mediaKeys3,
+ _mediaKeys4,
+ _mediaKeys5;
+
+ // Test MediaKeys assignment.
+ assert_equals(_video.mediaKeys, null);
+ assert_equals(typeof _video.setMediaKeys, 'function');
+
+ function onFailure(error) {
+ forceTestFailureFromPromise(test, error);
+ }
+
+ function setMediaKeys(mediaKeys) {
+ return _video.setMediaKeys(mediaKeys)
+ .then(function() {return 1}, function() {return 0})
+ }
+
+ navigator.requestMediaKeySystemAccess(config.keysystem, [configuration]).then(function(access) {
+ _access = access;
+ return _access.createMediaKeys();
+ }).then(function(result) {
+ _mediaKeys1 = result;
+ return _access.createMediaKeys();
+ }).then(function(result) {
+ _mediaKeys2 = result;
+ return _access.createMediaKeys();
+ }).then(function(result) {
+ _mediaKeys3 = result;
+ return _access.createMediaKeys();
+ }).then(function(result) {
+ _mediaKeys4 = result;
+ return _access.createMediaKeys();
+ }).then(function(result) {
+ _mediaKeys5 = result;
+ return Promise.all([
+ setMediaKeys(_mediaKeys1),
+ setMediaKeys(_mediaKeys2),
+ setMediaKeys(_mediaKeys3),
+ setMediaKeys(_mediaKeys4),
+ setMediaKeys(_mediaKeys5)
+ ]);
+ }).then(function(results) {
+ var sum = results.reduce((a, b) => a + b, 0);
+ assert_in_array(sum,[1,5]);
+ test.done();
+ }).catch(onFailure);
+ }, testname);
+} \ No newline at end of file