OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | |
2 // | |
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. | |
8 // | |
9 // Test that offer/answer between 2 peers completes successfully. | |
10 // | |
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) ], | |
16 run); | |
17 | |
18 function run(pc1, pc2) { | |
19 test.log("Establishing call."); | |
20 pc1.createOffer(gotOffer); | |
21 | |
22 function gotOffer(offer) { | |
23 test.log("Got offer"); | |
24 expectedCall(); | |
25 pc1.setLocalDescription(offer, expectedCall, test.fail); | |
26 pc2.setRemoteDescription(offer, expectedCall, test.fail); | |
27 pc2.createAnswer(gotAnswer, test.fail); | |
28 } | |
29 | |
30 function gotAnswer(answer) { | |
31 test.log("Got answer"); | |
32 expectedCall(); | |
33 pc2.setLocalDescription(answer, expectedCall, test.fail); | |
34 pc1.setRemoteDescription(answer, expectedCall, test.fail); | |
35 } | |
36 | |
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) | |
42 test.done(); | |
43 } | |
44 } | |
45 } | |
46 | |
47 registerBotTest('testOfferAnswer/chrome-chrome', | |
48 testOfferAnswer, ['chrome', 'chrome']); | |
OLD | NEW |