Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/setmediakeys-multiple-times-with-the-same-mediakeys.js

Issue 2546853003: Add W3C encrypted-media tests (Closed)
Patch Set: rebase now that content files landed Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/setmediakeys-multiple-times-with-the-same-mediakeys.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/setmediakeys-multiple-times-with-the-same-mediakeys.js b/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/setmediakeys-multiple-times-with-the-same-mediakeys.js
new file mode 100644
index 0000000000000000000000000000000000000000..f6af8267f24fa5d98e0bd7ba0096528814124e1f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/setmediakeys-multiple-times-with-the-same-mediakeys.js
@@ -0,0 +1,46 @@
+function runTest(config, qualifier) {
+ var testname = testnamePrefix( qualifier, config.keysystem )
+ + ', setmediakeys multiple times with the same mediakeys';
+
+ var configuration = getSimpleConfigurationForContent( config.content );
+
+ if ( config.initDataType && config.initData ) {
+ configuration.initDataTypes = [ config.initDataType ];
+ }
+
+ async_test (function (test) {
+ var _video = config.video,
+ _mediaKeys;
+
+ // Test MediaKeys assignment.
+ assert_equals(_video.mediaKeys, null);
+ assert_equals(typeof _video.setMediaKeys, 'function');
+
+ function onFailure(error) {
+ forceTestFailureFromPromise(test, error);
+ }
+
+ navigator.requestMediaKeySystemAccess(config.keysystem, [configuration]).then(function(access) {
+ return access.createMediaKeys();
+ }).then(function(result) {
+ _mediaKeys = result;
+ // Set mediaKeys for first time on video should work.
+ return _video.setMediaKeys(_mediaKeys);
+ }).then(function(result) {
+ assert_equals(_video.mediaKeys, _mediaKeys);
+ // Set mediaKeys on video again should return a resolved promise.
+ return _video.setMediaKeys(_mediaKeys);
+ }).then(function (result) {
+ assert_equals(_video.mediaKeys, _mediaKeys);
+ return testmediasource(config);
+ }).then(function(source) {
+ // Set src attribute on Video Element
+ _video.src = URL.createObjectURL(source);
+ // Set mediaKeys again on video should still return a resolved promise.
+ return _video.setMediaKeys(_mediaKeys);
+ }).then(function() {
+ assert_equals(_video.mediaKeys, _mediaKeys);
+ test.done();
+ }).catch(onFailure);
+ }, testname);
+}

Powered by Google App Engine
This is Rietveld 408576698