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

Unified Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js

Issue 2847803005: Cleanup verifyKeyStatuses() to take KeyId/status pairs (Closed)
Patch Set: Created 3 years, 8 months 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
« no previous file with comments | « third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-session-remove-temporary.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
index 38d1c9912ce5398e3dab4f02d95fa27cf3436b0a..a8d5829fe0db9d51847119e60c4436e9176bd208 100644
--- a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
+++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
@@ -181,28 +181,18 @@ function dumpKeyStatuses(keyStatuses)
});
}
-// Verify that |keyStatuses| contains just the keys in |keys.expected|
-// and none of the keys in |keys.unexpected|. All expected keys should have
-// status |status|. Example call: verifyKeyStatuses(mediaKeySession.keyStatuses,
-// { expected: [key1], unexpected: [key2] }, 'usable');
-function verifyKeyStatuses(keyStatuses, keys, status) {
- var expected = keys.expected || [];
- var unexpected = keys.unexpected || [];
- status = status || 'usable';
-
+// Verify that |keyStatuses| contains just the keys in the array |expected|.
+// Each entry specifies the keyId and status expected.
+// Example call: verifyKeyStatuses(mediaKeySession.keyStatuses,
+// [{keyId: key1, status: 'usable'}, {keyId: key2, status: 'released'}]);
+function verifyKeyStatuses(keyStatuses, expected) {
// |keyStatuses| should have same size as number of |keys.expected|.
assert_equals(keyStatuses.size, expected.length);
- // All |keys.expected| should be found.
- expected.map(function(key) {
- assert_true(keyStatuses.has(key));
- assert_equals(keyStatuses.get(key), status);
- });
-
- // All |keys.unexpected| should not be found.
- unexpected.map(function(key) {
- assert_false(keyStatuses.has(key));
- assert_equals(keyStatuses.get(key), undefined);
+ // All |expected| should be found.
+ expected.map(function(item) {
+ assert_true(keyStatuses.has(item.keyId));
+ assert_equals(keyStatuses.get(item.keyId), item.status);
});
}
« no previous file with comments | « third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-session-remove-temporary.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698