DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (409f3966645a)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript">var scriptRelativePath = "../";</script>
  <script type="application/javascript" src="../pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    title: 'RTCPeerConnection identity with login',
    bug: '1153314'
  });

function waitForLoginDone() {
  return new Promise(resolve => {
    window.addEventListener('message', function listener(e) {
      is(e.origin, 'https://example.com', 'got the right message origin');
      is(e.data, 'LOGINDONE', 'got the right message');
      window.removeEventListener('message', listener);
      resolve();
    });
  });
}

function checkLogin(t, name, onLoginNeeded) {
  t.pcLocal.setIdentityProvider('example.com',
                                { protocol: 'idp.js#login:' + name });
  return t.pcLocal._pc.getIdentityAssertion()
    .then(a => ok(false, 'should request login'),
          e => {
            is(e.name, 'IdpLoginError', 'name is IdpLoginError');
            is(t.pcLocal._pc.idpLoginUrl.split('#')[0],
               'https://example.com/.well-known/idp-proxy/login.html',
               'got the right login URL from the IdP');
            return t.pcLocal._pc.idpLoginUrl;
          })
    .then(onLoginNeeded)
    .then(waitForLoginDone)
    .then(() => t.pcLocal._pc.getIdentityAssertion())
    .then(a => ok(a, 'got assertion'));
}

function theTest() {
  var test = new PeerConnectionTest();
  test.setMediaConstraints([{audio: true}], [{audio: true}]);
  test.chain.removeAfter('PC_REMOTE_CHECK_INITIAL_SIGNALINGSTATE');
  test.chain.append([
    function PC_LOCAL_IDENTITY_ASSERTION_WITH_IFRAME_LOGIN(t) {
      return checkLogin(t, 'iframe', loginUrl => {
        var iframe = document.createElement('iframe');
        iframe.setAttribute('src', loginUrl);
        iframe.frameBorder = 0;
        iframe.width = 400;
        iframe.height = 60;
        document.getElementById('display').appendChild(iframe);
      });
    },
    function PC_LOCAL_IDENTITY_ASSERTION_WITH_WINDOW_LOGIN(t) {
      return checkLogin(t, 'openwin', loginUrl => {
        window.open(loginUrl, 'login', 'width=400,height=60');
      });
    }
  ]);
  test.run();
}
runNetworkTest(theTest);

</script>
</pre>
</body>
</html>