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

Unified Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-reference.html

Issue 2606633002: encrypted-media tests should not count # of SuspendableObjects (Closed)
Patch Set: temp 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/media/encrypted-media/encrypted-media-lifetime-mediakeysession-reference.html
diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-reference.html b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-reference.html
index 2736a4619eb023d527595838550e14d620ef3c12..b1235fb99fb4eb600b4cb195d8fef256044d6017 100644
--- a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-reference.html
+++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-reference.html
@@ -8,8 +8,6 @@
</head>
<body>
<script>
- // Since MediaKeySession (and MediaKeys) are SuspendableObjects,
- // we can determine when they are garbage collected.
// MediaKeySessions remain as long as:
// JavaScript has a reference to it
// OR (MediaKeys is around
@@ -17,17 +15,24 @@
async_test(function(test)
{
+ gc();
var mediaKeys;
var mediaKeySession1;
var mediaKeySession2;
var mediaKeySession3;
var initDataType;
var initData;
- var startingSuspendableObjectCount = window.internals.suspendableObjectCount(document);
+ var startingMediaKeysCount = window.internals.mediaKeysCount();
+ var startingMediaKeySessionCount = window.internals.mediaKeySessionCount();
- function numSuspendableObjectsCreated()
+ function numMediaKeysCreated()
{
- return window.internals.suspendableObjectCount(document) - startingSuspendableObjectCount;
+ return window.internals.mediaKeysCount() - startingMediaKeysCount;
+ }
+
+ function numMediaKeySessionCreated()
+ {
+ return window.internals.mediaKeySessionCount() - startingMediaKeySessionCount;
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
@@ -38,14 +43,8 @@
mediaKeys = result;
assert_equals(typeof mediaKeys.createSession, 'function');
- // Verify MediaKeys is an SuspendableObject.
- // In non-Oilpan, numSuspendableObjectsCreate() == 1.
- // In Oilpan, numSuspendableObjectsCreate() <= 4.
- // (1 MediaKeys,
- // 1 MediaKeysInitializer and
- // 1 MediaKeySystemAccessInitializer (navigator.requestMediaKeySystemAccess() use above),
- // 1 MediaKeySystemAccessInitializer (isInitDataSupported() (via getSupportedInitDataType())))
- assert_between_inclusive(numSuspendableObjectsCreated(), 1, 4, 'MediaKeys.create()');
+ assert_equals(numMediaKeysCreated(), 1, 'MediaKeys.create()');
+ assert_equals(numMediaKeySessionCreated(), 0, 'After final gc()');
// Create 3 sessions.
mediaKeySession1 = mediaKeys.createSession();
@@ -53,54 +52,32 @@
}).then(function() {
assert_true(mediaKeySession1.sessionId && mediaKeySession1.sessionId.length > 0);
- // Should be 1 MediaKeys + 1 MediaKeySession.
- // In non-Oilpan, numSuspendableObjectsCreate() == 2.
- // In Oilpan, numSuspendableObjectsCreate() <= 6.
- // (1 MediaKeys,
- // 1 MediaKeysInitializer and
- // 2 MediaKeySystemAccessInitializer,
- // 1 ContentDecryptionModuleResultPromise and
- // 1 MediaKeySession).
- assert_between_inclusive(numSuspendableObjectsCreated(), 2, 6, 'MediaKeys.createSession(1)');
+ assert_equals(numMediaKeysCreated(), 1, 'MediaKeys.createSession(1)');
+ assert_equals(numMediaKeySessionCreated(), 1, 'MediaKeys.createSession(1)');
mediaKeySession2 = mediaKeys.createSession();
return mediaKeySession2.generateRequest(initDataType, initData);
}).then(function() {
assert_true(mediaKeySession2.sessionId && mediaKeySession2.sessionId.length > 0);
- // Should be 1 MediaKeys + 2 MediaKeySessions.
- // In non-Oilpan, numSuspendableObjectsCreate() == 3.
- // In Oilpan, numSuspendableObjectsCreate() <= 8.
- // (1 MediaKeys,
- // 1 MediaKeysInitializer and
- // 2 MediaKeySystemAccessInitializers,
- // 2 ContentDecryptionModuleResultPromise and
- // 2 MediaKeySession).
- assert_between_inclusive(numSuspendableObjectsCreated(), 3, 8, 'mediaKeys.createSession(2)');
+ assert_equals(numMediaKeysCreated(), 1, 'mediaKeys.createSession(2)');
+ assert_equals(numMediaKeySessionCreated(), 2, 'mediaKeys.createSession(2)');
mediaKeySession3 = mediaKeys.createSession();
return mediaKeySession3.generateRequest(initDataType, initData);
}).then(function() {
assert_true(mediaKeySession3.sessionId && mediaKeySession3.sessionId.length > 0);
- // Should be 1 MediaKeys + 3 MediaKeySessions.
- // In non-Oilpan, numSuspendableObjectsCreate() == 4.
- // In Oilpan, numSuspendableObjectsCreate() <= 10.
- // (1 MediaKeys,
- // 1 MediaKeysInitializer and
- // 2 MediaKeySystemAccessInitializers,
- // 3 ContentDecryptionModuleResultPromise and
- // 3 MediaKeySession).
- assert_between_inclusive(numSuspendableObjectsCreated(), 4, 10, 'mediaKeys.createSession(3)');
+ assert_equals(numMediaKeysCreated(), 1, 'mediaKeys.createSession(3)');
+ assert_equals(numMediaKeySessionCreated(), 3, 'mediaKeys.createSession(3)');
// Run gc(). All sessions should remain as we have a
// reference to each one. However, running gc()
// asynchronously should free up the last PromiseResolver.
return createGCPromise();
}).then(function(result) {
- // Only MediaKeys + 3 MediaKeySessions should remain.
- // In non-Oilpan, there is also something from createGCPromise().
- assert_between_inclusive(numSuspendableObjectsCreated(), 4, 5, 'After gc()');
+ assert_equals(numMediaKeysCreated(), 1, 'After gc()');
+ assert_equals(numMediaKeySessionCreated(), 3, 'After gc()');
// Now drop references to 2 of the sessions. Even though we
// don't have a reference, MediaKeys is still around (and
@@ -112,9 +89,8 @@
}).then(function(result) {
return createGCPromise();
}).then(function(result) {
- // MediaKeys + 3 MediaKeySessions should remain.
- // In non-Oilpan, there is also something from createGCPromise().
- assert_between_inclusive(numSuspendableObjectsCreated(), 4, 5, 'After second gc()');
+ assert_equals(numMediaKeysCreated(), 1, 'After second gc()');
+ assert_equals(numMediaKeySessionCreated(), 3, 'After second gc()');
// Now drop the reference to MediaKeys. It and the 2
// unreferenced sessions should be collected. Since
@@ -129,18 +105,16 @@
}).then(function(result) {
return createGCPromise();
}).then(function(result) {
- // Only 1 MediaKeySessions should remain.
- // In non-Oilpan, there is also something from createGCPromise().
- assert_between_inclusive(numSuspendableObjectsCreated(), 1, 2, 'After mediaKeys = null');
+ assert_equals(numMediaKeysCreated(), 0, 'After mediaKeys = null');
+ assert_equals(numMediaKeySessionCreated(), 1, 'After mediaKeys = null');
// Drop the reference to the last session. It should get
// collected now since MediaKeys is gone.
mediaKeySession3 = null;
return createGCPromise();
}).then(function(result) {
- // No MediaKeySessions should remain.
- // In non-Oilpan, there is also something from createGCPromise().
- assert_between_inclusive(numSuspendableObjectsCreated(), 0, 1, 'After final gc()');
+ assert_equals(numMediaKeysCreated(), 0, 'After final gc()');
+ assert_equals(numMediaKeySessionCreated(), 0, 'After final gc()');
test.done();
}).catch(function(error) {

Powered by Google App Engine
This is Rietveld 408576698