OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 EXPECT_EQ(0U, port()->Candidates().size()); | 194 EXPECT_EQ(0U, port()->Candidates().size()); |
195 } | 195 } |
196 | 196 |
197 // Test that we can get an address from a STUN server. | 197 // Test that we can get an address from a STUN server. |
198 TEST_F(StunPortTest, TestPrepareAddress) { | 198 TEST_F(StunPortTest, TestPrepareAddress) { |
199 CreateStunPort(kStunAddr1); | 199 CreateStunPort(kStunAddr1); |
200 PrepareAddress(); | 200 PrepareAddress(); |
201 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock); | 201 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock); |
202 ASSERT_EQ(1U, port()->Candidates().size()); | 202 ASSERT_EQ(1U, port()->Candidates().size()); |
203 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address())); | 203 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address())); |
| 204 std::string expected_server_url = "stun:127.0.0.1:5000"; |
| 205 EXPECT_EQ(port()->Candidates()[0].url(), expected_server_url); |
204 | 206 |
205 // TODO: Add IPv6 tests here, once either physicalsocketserver supports | 207 // TODO: Add IPv6 tests here, once either physicalsocketserver supports |
206 // IPv6, or this test is changed to use VirtualSocketServer. | 208 // IPv6, or this test is changed to use VirtualSocketServer. |
207 } | 209 } |
208 | 210 |
209 // Test that we fail properly if we can't get an address. | 211 // Test that we fail properly if we can't get an address. |
210 TEST_F(StunPortTest, TestPrepareAddressFail) { | 212 TEST_F(StunPortTest, TestPrepareAddressFail) { |
211 CreateStunPort(kBadAddr); | 213 CreateStunPort(kBadAddr); |
212 PrepareAddress(); | 214 PrepareAddress(); |
213 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock); | 215 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // Test that by default, the STUN binding requests will last for a long time. | 374 // Test that by default, the STUN binding requests will last for a long time. |
373 TEST_F(StunPortTest, TestStunBindingRequestLongLifetime) { | 375 TEST_F(StunPortTest, TestStunBindingRequestLongLifetime) { |
374 SetKeepaliveDelay(101); | 376 SetKeepaliveDelay(101); |
375 CreateStunPort(kStunAddr1); | 377 CreateStunPort(kStunAddr1); |
376 PrepareAddress(); | 378 PrepareAddress(); |
377 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock); | 379 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock); |
378 EXPECT_TRUE_SIMULATED_WAIT( | 380 EXPECT_TRUE_SIMULATED_WAIT( |
379 port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST), 1000, | 381 port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST), 1000, |
380 fake_clock); | 382 fake_clock); |
381 } | 383 } |
OLD | NEW |