зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 2d160c261384 (bug 1310879) for failing browser-chrome test browser/components/contextualidentity/test/browser/browser_eme.js. r=backout
This commit is contained in:
Родитель
ab415c7049
Коммит
52b641f9be
|
@ -433,6 +433,7 @@ GetSupportedKeySystems()
|
||||||
clearkey.mPersistentState = KeySystemFeatureSupport::Requestable;
|
clearkey.mPersistentState = KeySystemFeatureSupport::Requestable;
|
||||||
clearkey.mDistinctiveIdentifier = KeySystemFeatureSupport::Prohibited;
|
clearkey.mDistinctiveIdentifier = KeySystemFeatureSupport::Prohibited;
|
||||||
clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Temporary);
|
clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Temporary);
|
||||||
|
clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Persistent_license);
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
// Clearkey CDM uses WMF decoders on Windows.
|
// Clearkey CDM uses WMF decoders on Windows.
|
||||||
if (WMFDecoderModule::HasAAC()) {
|
if (WMFDecoderModule::HasAAC()) {
|
||||||
|
|
|
@ -696,6 +696,8 @@ skip-if = toolkit == 'android' # bug 1149374
|
||||||
skip-if = toolkit == 'android' # bug 1149374
|
skip-if = toolkit == 'android' # bug 1149374
|
||||||
[test_eme_request_notifications.html]
|
[test_eme_request_notifications.html]
|
||||||
skip-if = toolkit == 'android' # bug 1149374
|
skip-if = toolkit == 'android' # bug 1149374
|
||||||
|
[test_eme_persistent_sessions.html]
|
||||||
|
skip-if = toolkit == 'android' # bug 1149374
|
||||||
[test_eme_playback.html]
|
[test_eme_playback.html]
|
||||||
skip-if = toolkit == 'android' || toolkit == 'gonk' # android: bug 1149374; gonk: bug 1193351
|
skip-if = toolkit == 'android' || toolkit == 'gonk' # android: bug 1149374; gonk: bug 1193351
|
||||||
[test_eme_requestKeySystemAccess.html]
|
[test_eme_requestKeySystemAccess.html]
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test Encrypted Media Extensions</title>
|
||||||
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
|
<script type="text/javascript" src="manifest.js"></script>
|
||||||
|
<script type="text/javascript" src="eme.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre id="test">
|
||||||
|
<script class="testbody" type="text/javascript">
|
||||||
|
var manager = new MediaTestManager;
|
||||||
|
|
||||||
|
function UsableKeyIdsMatch(usableKeyIds, expectedKeyIds) {
|
||||||
|
var hexKeyIds = usableKeyIds.map(function(keyId) {
|
||||||
|
return Base64ToHex(window.btoa(ArrayBufferToString(keyId)));
|
||||||
|
}).sort();
|
||||||
|
var expected = Object.keys(expectedKeyIds).sort();
|
||||||
|
if (expected.length != hexKeyIds.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (var i = 0; i < hexKeyIds.length; i++) {
|
||||||
|
if (hexKeyIds[i] != expected[i]){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AwaitAllKeysUsable(session, keys, token) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
function check() {
|
||||||
|
var map = session.keyStatuses;
|
||||||
|
var usableKeyIds = [];
|
||||||
|
for (var [key, val] of map.entries()) {
|
||||||
|
is(val, "usable", token + ": key status should be usable");
|
||||||
|
usableKeyIds.push(key);
|
||||||
|
}
|
||||||
|
if (UsableKeyIdsMatch(usableKeyIds, keys)) {
|
||||||
|
session.removeEventListener("keystatuseschange", check);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
session.addEventListener("keystatuseschange", check);
|
||||||
|
check(); // in case all keys are already usable
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function AwaitAllKeysNotUsable(session, token) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
function check() {
|
||||||
|
var map = session.keyStatuses;
|
||||||
|
if (map.size == 0) {
|
||||||
|
session.removeEventListener("keystatuseschange", check);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
session.addEventListener("keystatuseschange", check);
|
||||||
|
check(); // in case all keys are already removed
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function startTest(test, token)
|
||||||
|
{
|
||||||
|
manager.started(token);
|
||||||
|
|
||||||
|
var recreatedSession; // will have remove() called on it.
|
||||||
|
|
||||||
|
var keySystemAccess;
|
||||||
|
|
||||||
|
var v = SetupEME(test, token,
|
||||||
|
{
|
||||||
|
onsessionupdated: function(session) {
|
||||||
|
Log(token, "Session created");
|
||||||
|
var sessionId;
|
||||||
|
|
||||||
|
// Once the session has loaded and has all its keys usable, close
|
||||||
|
// all sessions without calling remove() on them.
|
||||||
|
AwaitAllKeysUsable(session, test.keys, token)
|
||||||
|
.then(function() {
|
||||||
|
sessionId = session.sessionId;
|
||||||
|
Log(token, "Closing session with id=" + sessionId);
|
||||||
|
return session.close();
|
||||||
|
})
|
||||||
|
|
||||||
|
// Once the session is closed, reload the MediaKeys and reload the session
|
||||||
|
.then(function() {
|
||||||
|
return navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, gCencMediaKeySystemConfig);
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function(requestedKeySystemAccess) {
|
||||||
|
keySystemAccess = requestedKeySystemAccess;
|
||||||
|
return keySystemAccess.createMediaKeys();
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function(mediaKeys) {
|
||||||
|
Log(token, "re-created MediaKeys object ok");
|
||||||
|
recreatedSession = mediaKeys.createSession("persistent-license");
|
||||||
|
Log(token, "Created recreatedSession, loading sessionId=" + sessionId);
|
||||||
|
return recreatedSession.load(sessionId);
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function(suceeded) {
|
||||||
|
if (suceeded) {
|
||||||
|
return Promise.resolve();
|
||||||
|
} else {
|
||||||
|
return Promise.reject("Fail to load recreatedSession, sessionId=" + sessionId);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function() {
|
||||||
|
return AwaitAllKeysUsable(recreatedSession, test.keys, token);
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function() {
|
||||||
|
Log(token, "re-loaded persistent session, all keys still usable");
|
||||||
|
return Promise.all([AwaitAllKeysNotUsable(recreatedSession, token), recreatedSession.remove()]);
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function() {
|
||||||
|
Log(token, "removed session, all keys unusable.");
|
||||||
|
// Attempt to recreate the session, the attempt should fail.
|
||||||
|
return keySystemAccess.createMediaKeys();
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function(mediaKeys) {
|
||||||
|
Log(token, "re-re-created MediaKeys object ok");
|
||||||
|
// Trying to load the removed persistent session should fail.
|
||||||
|
return mediaKeys.createSession("persistent-license").load(sessionId);
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function(suceeded) {
|
||||||
|
is(suceeded, false, token + " we expect the third session creation to fail, as the session should have been removed.");
|
||||||
|
manager.finished(token);
|
||||||
|
})
|
||||||
|
|
||||||
|
.catch(function(reason) {
|
||||||
|
// Catch rejections if any.
|
||||||
|
ok(false, token + " rejected, reason=" + reason);
|
||||||
|
manager.finished(token);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
sessionType: "persistent-license",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
LoadTestWithManagedLoadToken(test, v, manager, token,
|
||||||
|
{ onlyLoadFirstFragments:2, noEndOfStream:false });
|
||||||
|
}
|
||||||
|
|
||||||
|
function beginTest() {
|
||||||
|
manager.runTests(gEMETests.filter(t => t.sessionCount === 1), startTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsMacOSSnowLeopardOrEarlier()) {
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
SetupEMEPref(beginTest);
|
||||||
|
} else {
|
||||||
|
todo(false, "Test disabled on this platform.");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -248,7 +248,14 @@ var tests = [
|
||||||
persistentState: 'required',
|
persistentState: 'required',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
shouldPass: false,
|
expectedConfig: {
|
||||||
|
label: SUPPORTED_LABEL,
|
||||||
|
initDataTypes: ['cenc'],
|
||||||
|
videoCapabilities: [{contentType: 'video/mp4'}],
|
||||||
|
sessionTypes: ['temporary','persistent-license'],
|
||||||
|
persistentState: 'required',
|
||||||
|
},
|
||||||
|
shouldPass: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Persistent sessions not allowed when persistentState prohibited',
|
name: 'Persistent sessions not allowed when persistentState prohibited',
|
||||||
|
@ -262,6 +269,26 @@ var tests = [
|
||||||
],
|
],
|
||||||
shouldPass: false,
|
shouldPass: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Persistent sessions; should bump optional persistState to required',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: SUPPORTED_LABEL,
|
||||||
|
initDataTypes: ['cenc'],
|
||||||
|
videoCapabilities: [{contentType: 'video/mp4'}],
|
||||||
|
sessionTypes: ['temporary','persistent-license'],
|
||||||
|
persistentState: 'optional',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
expectedConfig: {
|
||||||
|
label: SUPPORTED_LABEL,
|
||||||
|
initDataTypes: ['cenc'],
|
||||||
|
videoCapabilities: [{contentType: 'video/mp4'}],
|
||||||
|
sessionTypes: ['temporary','persistent-license'],
|
||||||
|
persistentState: 'required',
|
||||||
|
},
|
||||||
|
shouldPass: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Persistent-usage-record should not be supported by ClearKey',
|
name: 'Persistent-usage-record should not be supported by ClearKey',
|
||||||
options: [
|
options: [
|
||||||
|
|
Загрузка…
Ссылка в новой задаче