<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Testing basic video exchange from offerer to receiver</title>
        <script src="../resources/testharness.js"></script>
        <script src="../resources/testharnessreport.js"></script>
    </head>
    <body>
        <script src ="routines.js"></script>
        <script>
promise_test(async (test) => {
    let firstConnection, secondConnection;
    await new Promise((resolve, reject) => {
        createConnections((connection) => {
            firstConnection = connection;
            localChannel = connection.createDataChannel('sendDataChannel');
        }, (connection) => {
            secondConnection = connection;
            connection.ondatachannel = resolve;
        });
        setTimeout(() => { reject("Test timed out"); }, 5000);
    });

    let stats = await getTypedStats(firstConnection, "local-candidate");
    assert_true(!stats.address, "address is not exposed");
    assert_true(!stats.networkType, "networkType is not exposed");

    assert_array_equals(Object.keys(stats), ["id","timestamp","type","candidateType","port","priority","protocol","transportId"], "local");

    stats = await getTypedStats(firstConnection, "remote-candidate");

    // For now, we do not want to expose address or networkType.
    assert_true(!stats.address, "address is not exposed");
    assert_true(!stats.networkType, "networkType is not exposed");

    assert_array_equals(Object.keys(stats), ["id","timestamp","type","candidateType","port","priority","protocol","transportId"], "remote");
}, "ICE candidate data channel stats");
        </script>
    </body>
</html>
