<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Testing onnegotiationneeded</title>
        <script src="../resources/testharness.js"></script>
        <script src="../resources/testharnessreport.js"></script>
    </head>
    <body>
        <script>
promise_test(() => {
    let done;
    const promise = new Promise(resolve => done = resolve);

    const pc = new RTCPeerConnection();
    pc.onnegotiationneeded = function(e) {
        assert_equals(pc, this);
        done();
    }
    pc.createDataChannel('x');
    return promise;
}, "Make sure event target is the connection");
        </script>
    </body>
</html>
