test_setIdentityProvider.html (2512B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript">var scriptRelativePath = "../";</script> 5 <script type="application/javascript" src="../pc.js"></script> 6 </head> 7 <body> 8 <pre id="test"> 9 <script type="application/javascript"> 10 createHTML({ 11 title: "setIdentityProvider leads to peerIdentity and assertions in SDP", 12 bug: "942367" 13 }); 14 15 function checkIdentity(peer, prefix, idp, name) { 16 prefix = prefix + ": "; 17 return peer._pc.peerIdentity.then(peerIdentity => { 18 ok(peerIdentity, prefix + "peerIdentity is set"); 19 is(peerIdentity.idp, idp, prefix + "IdP is correct"); 20 is(peerIdentity.name, name + "@" + idp, prefix + "identity is correct"); 21 }); 22 } 23 24 function theTest() { 25 var test = new PeerConnectionTest(); 26 test.setMediaConstraints([{audio: true}], [{audio: true}]); 27 test.pcLocal.setIdentityProvider("test1.example.com", 28 { protocol: "idp.js", 29 usernameHint: "someone" }); 30 test.pcRemote.setIdentityProvider("test2.example.com", 31 { protocol: "idp.js", 32 usernameHinte: "someone"}); 33 34 test.chain.append([ 35 function PC_LOCAL_PEER_IDENTITY_IS_SET_CORRECTLY(test) { 36 return checkIdentity(test.pcLocal, "local", "test2.example.com", "someone"); 37 }, 38 function PC_REMOTE_PEER_IDENTITY_IS_SET_CORRECTLY(test) { 39 return checkIdentity(test.pcRemote, "remote", "test1.example.com", "someone"); 40 }, 41 42 function OFFER_AND_ANSWER_INCLUDES_IDENTITY(test) { 43 ok(test.originalOffer.sdp.includes("a=identity"), "a=identity is in the offer SDP"); 44 ok(test.originalAnswer.sdp.includes("a=identity"), "a=identity is in the answer SDP"); 45 }, 46 47 function PC_LOCAL_DESCRIPTIONS_CONTAIN_IDENTITY(test) { 48 ok(test.pcLocal.localDescription.sdp.includes("a=identity"), 49 "a=identity is in the local copy of the offer"); 50 ok(test.pcLocal.remoteDescription.sdp.includes("a=identity"), 51 "a=identity is in the local copy of the answer"); 52 }, 53 function PC_REMOTE_DESCRIPTIONS_CONTAIN_IDENTITY(test) { 54 ok(test.pcRemote.localDescription.sdp.includes("a=identity"), 55 "a=identity is in the remote copy of the offer"); 56 ok(test.pcRemote.remoteDescription.sdp.includes("a=identity"), 57 "a=identity is in the remote copy of the answer"); 58 } 59 ]); 60 return test.run(); 61 } 62 runNetworkTest(theTest); 63 64 </script> 65 </pre> 66 </body> 67 </html>