1 // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
9 // Test that offer/answer between 2 peers completes successfully.
11 // Note: This test does not performs ice candidate exchange and
12 // does not verifies that media can flow between the peers.
13 function testOfferAnswer(test, bot1, bot2) {
14 test.wait( [ bot1.createPeerConnection.bind(bot1, null),
15 bot2.createPeerConnection.bind(bot2, null) ],
18 function run(pc1, pc2) {
19 test.log("Establishing call.");
20 pc1.createOffer(gotOffer);
22 function gotOffer(offer) {
23 test.log("Got offer");
25 pc1.setLocalDescription(offer, expectedCall, test.fail);
26 pc2.setRemoteDescription(offer, expectedCall, test.fail);
27 pc2.createAnswer(gotAnswer, test.fail);
30 function gotAnswer(answer) {
31 test.log("Got answer");
33 pc2.setLocalDescription(answer, expectedCall, test.fail);
34 pc1.setRemoteDescription(answer, expectedCall, test.fail);
37 // TODO(andresp): Implement utilities in test to write expectations
38 // that certain methods must be called.
39 var expectedCalls = 0;
40 function expectedCall() {
41 if (++expectedCalls == 6)
47 registerBotTest('testOfferAnswer/chrome-chrome',
48 testOfferAnswer, ['chrome', 'chrome']);