Bug 996238 - Adding test for asymmetric media isolation across PC. r=ekr

This commit is contained in:
Martin Thomson 2015-03-31 16:01:52 -07:00
parent 32d80a6936
commit 2df76e9b08
5 changed files with 92 additions and 56 deletions

View File

@ -0,0 +1 @@
martin@Martins-MacBook-Pro.local.287

View File

@ -0,0 +1,51 @@
function identityPcTest(remoteOptions) {
var user = 'someone';
var domain1 = 'test1.example.com';
var domain2 = 'test2.example.com';
var id1 = user + '@' + domain1;
var id2 = user + '@' + domain2;
test = new PeerConnectionTest({
config_local: {
peerIdentity: id2
},
config_remote: {
peerIdentity: id1
}
});
test.setMediaConstraints([{
audio: true,
video: true,
peerIdentity: id2
}], [remoteOptions || {
audio: true,
video: true,
fake: true,
peerIdentity: id1
}]);
test.setIdentityProvider(test.pcLocal, 'test1.example.com', 'idp.html');
test.setIdentityProvider(test.pcRemote, 'test2.example.com', 'idp.html');
test.chain.append([
function PEER_IDENTITY_IS_SET_CORRECTLY(test) {
// no need to wait to check identity in this case,
// setRemoteDescription should wait for the IdP to complete
function checkIdentity(pc, pfx, idp, name) {
is(pc.peerIdentity.idp, idp, pfx + "IdP is correct");
is(pc.peerIdentity.name, name + "@" + idp, pfx + "identity is correct");
}
checkIdentity(test.pcLocal._pc, "local: ", "test2.example.com", "someone");
checkIdentity(test.pcRemote._pc, "remote: ", "test1.example.com", "someone");
},
function REMOTE_STREAMS_ARE_RESTRICTED(test) {
var remoteStream = test.pcLocal._pc.getRemoteStreams()[0];
return Promise.all([
new Promise(done => audioIsSilence(true, remoteStream, done)),
new Promise(done => videoIsBlack(true, remoteStream, done))
]);
}
]);
test.run();
}

View File

@ -5,6 +5,7 @@
skip-if = (os == 'win' && strictContentSandbox) || android_version == '10' || android_version == '18' || (buildapp == 'b2g' && toolkit != 'gonk') || (buildapp == 'b2g' && toolkit == 'gonk')
support-files =
/.well-known/idp-proxy/idp.js
identityPcTest.js
[test_idpproxy.html]
support-files =
@ -25,6 +26,7 @@ support-files =
[test_setIdentityProvider.html]
[test_setIdentityProviderWithErrors.html]
[test_peerConnection_peerIdentity.html]
[test_peerConnection_asymmetricIsolation.html]
# Bug 950317: Hack for making a cleanup hook after finishing all WebRTC cases
[../test_zmedia_cleanup.html]

View File

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript">var scriptRelativePath = "../";</script>
<script type="application/javascript" src="../pc.js"></script>
<script type="application/javascript" src="../blacksilence.js"></script>
<script type="application/javascript" src="identityPcTest.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "Non-isolated media entering an isolated session becomes isolated",
bug: "996238"
});
function theTest() {
// override the remote media capture options to remove isolation
// for the remote party; the test verifies that the media it receives
// on the local side is isolated
identityPcTest({
audio: true,
video: true,
fake: true
});
}
runNetworkTest(theTest);
</script>
</pre>
</body>
</html>

View File

@ -4,67 +4,17 @@
<script type="application/javascript">var scriptRelativePath = "../";</script>
<script type="application/javascript" src="../pc.js"></script>
<script type="application/javascript" src="../blacksilence.js"></script>
<script type="application/javascript" src="identityPcTest.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "setIdentityProvider leads to peerIdentity and assertions in SDP",
bug: "942367"
});
var test;
function theTest() {
var id1 = 'someone@test1.example.com';
var id2 = 'someone@test2.example.com';
test = new PeerConnectionTest({
config_local: {
peerIdentity: id2
},
config_remote: {
peerIdentity: id1
}
});
test.setMediaConstraints([{
audio: true,
video: true,
peerIdentity: id2
}], [{
audio: true,
video: true,
fake: true,
peerIdentity: id1
}]);
test.pcLocal.setIdentityProvider('test1.example.com', 'idp.js');
test.pcRemote.setIdentityProvider('test2.example.com', 'idp.js');
test.chain.append([
function PEER_IDENTITY_IS_SET_CORRECTLY(test) {
// no need to wait to check identity in this case,
// setRemoteDescription should wait for the IdP to complete
function checkIdentity(pc, pfx, idp, name) {
return pc.peerIdentity.then(peerInfo => {
is(peerInfo.idp, idp, pfx + "IdP check");
is(peerInfo.name, name + "@" + idp, pfx + "identity check");
});
}
return Promise.all([
checkIdentity(test.pcLocal._pc, "local: ", "test2.example.com", "someone"),
checkIdentity(test.pcRemote._pc, "remote: ", "test1.example.com", "someone")
]);
},
function REMOTE_STREAMS_ARE_RESTRICTED(test) {
var remoteStream = test.pcLocal._pc.getRemoteStreams()[0];
return Promise.all([
new Promise(done => audioIsSilence(true, remoteStream, done)),
new Promise(done => videoIsBlack(true, remoteStream, done))
]);
}
]);
test.run();
}
runNetworkTest(theTest);
createHTML({
title: "setIdentityProvider leads to peerIdentity and assertions in SDP",
bug: "942367"
});
runNetworkTest(identityPcTest);
</script>
</pre>
</body>