| Index: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-release-noreference.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-release-noreference.html b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-release-noreference.html
|
| index bff8e233a3b5da44ea66ab8ddbc12bd7d70470d1..60019a1e8dc75c9047daa41748946df10d167f55 100644
|
| --- a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-release-noreference.html
|
| +++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-release-noreference.html
|
| @@ -8,21 +8,26 @@
|
| </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
|
| // AND the session has not received a close() event)
|
| async_test(function(test)
|
| {
|
| + gc();
|
| 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;
|
| }
|
|
|
| // Create 2 sessions.
|
| @@ -37,52 +42,31 @@
|
| }).then(function(result) {
|
| mediaKeys = result;
|
|
|
| - // 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, 'MediaKeys.create()');
|
|
|
| mediaKeySession1 = mediaKeys.createSession();
|
| return mediaKeySession1.generateRequest(initDataType, initData);
|
| }).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)');
|
| }).then(function(result) {
|
| // Run gc(). All sessions should remain as we have a
|
| // reference to each one.
|
| return createGCPromise();
|
| }).then(function(result) {
|
| - // Should be just 1 MediaKeys + 2 MediaKeySessions.
|
| - // In non-Oilpan, there is also something from createGCPromise().
|
| - assert_between_inclusive(numSuspendableObjectsCreated(), 3, 4, 'After gc()');
|
| + assert_equals(numMediaKeysCreated(), 1, 'After gc()');
|
| + assert_equals(numMediaKeySessionCreated(), 2, 'After gc()');
|
|
|
| // Close the sessions. Once the close() event is received,
|
| // they should get garbage collected as there are no JS
|
| @@ -97,9 +81,8 @@
|
| }).then(function(result) {
|
| return createGCPromise();
|
| }).then(function(result) {
|
| - // Only MediaKeys + mediaKeySession2 should remain.
|
| - // In non-Oilpan, there is also something from createGCPromise().
|
| - assert_between_inclusive(numSuspendableObjectsCreated(), 2, 3, 'mediaKeySession1 not collected');
|
| + assert_equals(numMediaKeysCreated(), 1, 'mediaKeySession1 not collected');
|
| + assert_equals(numMediaKeySessionCreated(), 1, 'mediaKeySession1 not collected');
|
|
|
| var promise = mediaKeySession2.close();
|
| mediaKeySession2 = null;
|
| @@ -111,9 +94,8 @@
|
| }).then(function(result) {
|
| return createGCPromise();
|
| }).then(function(result) {
|
| - // Only MediaKeys should remain.
|
| - // In non-Oilpan, there is also something from createGCPromise().
|
| - assert_between_inclusive(numSuspendableObjectsCreated(), 1, 2, 'mediaKeySession2 not collected');
|
| + assert_equals(numMediaKeysCreated(), 1, 'mediaKeySession2 not collected');
|
| + assert_equals(numMediaKeySessionCreated(), 0, 'mediaKeySession2 not collected');
|
|
|
| assert_not_equals(mediaKeys, null);
|
| test.done();
|
|
|