Chromium Code Reviews| Index: webrtc/p2p/base/turnport_unittest.cc |
| diff --git a/webrtc/p2p/base/turnport_unittest.cc b/webrtc/p2p/base/turnport_unittest.cc |
| index 0e415a28147e4e9a6f9ef73b8fad56bba1f2caf3..4b1babb9dc048ea63540fe6144ea559bdc4a3e9e 100644 |
| --- a/webrtc/p2p/base/turnport_unittest.cc |
| +++ b/webrtc/p2p/base/turnport_unittest.cc |
| @@ -44,6 +44,8 @@ static const SocketAddress kLocalAddr1("11.11.11.11", 0); |
| static const SocketAddress kLocalAddr2("22.22.22.22", 0); |
| static const SocketAddress kLocalIPv6Addr( |
| "2401:fa00:4:1000:be30:5bff:fee5:c3", 0); |
| +static const SocketAddress kLocalIPv6Addr2( |
| + "2401:fa00:4:2000:be30:5bff:fee5:d4", 0); |
| static const SocketAddress kTurnUdpIntAddr("99.99.99.3", |
| cricket::TURN_SERVER_PORT); |
| static const SocketAddress kTurnTcpIntAddr("99.99.99.4", |
| @@ -58,8 +60,6 @@ static const SocketAddress kTurnIPv6IntAddr( |
| cricket::TURN_SERVER_PORT); |
| static const SocketAddress kTurnUdpIPv6IntAddr( |
| "2400:4030:1:2c00:be30:abcd:efab:cdef", cricket::TURN_SERVER_PORT); |
| -static const SocketAddress kTurnUdpIPv6ExtAddr( |
| - "2620:0:1000:1b03:2e41:38ff:fea6:f2a4", 0); |
| static const char kIceUfrag1[] = "TESTICEUFRAG0001"; |
| static const char kIceUfrag2[] = "TESTICEUFRAG0002"; |
| @@ -588,7 +588,7 @@ TEST_F(TurnPortTest, DISABLED_TestTurnTcpOnAddressResolveFailure) { |
| // In case of UDP on address resolve failure, TurnPort will not create socket |
| // and return allocate failure. |
| -TEST_F(TurnPortTest, DISABLED_TestTurnUdpOnAdressResolveFailure) { |
| +TEST_F(TurnPortTest, DISABLED_TestTurnUdpOnAddressResolveFailure) { |
| CreateTurnPort(kTurnUsername, kTurnPassword, cricket::ProtocolAddress( |
|
pthatcher1
2016/06/21 05:26:54
Can we un-DISABLED the test?
honghaiz3
2016/06/21 18:36:06
Will do this in a separate CL, as it was typically
|
| rtc::SocketAddress("www.webrtc-blah-blah.com", 3478), |
| cricket::PROTO_UDP)); |
| @@ -983,6 +983,37 @@ TEST_F(TurnPortTest, TestTurnLocalIPv6AddressServerIPv6ExtenalIPv4) { |
| EXPECT_NE(0, turn_port_->Candidates()[0].address().port()); |
| } |
| +// Tests that the local and remote candidate address family should match when |
|
pthatcher1
2016/06/21 05:26:54
family = families
honghaiz3
2016/06/21 18:36:06
Done.
|
| +// a connection is created. Specially if a turn port has an IPv6 address, its |
|
pthatcher1
2016/06/21 05:26:54
Specially -> Specifically,
?
Taylor Brandstetter
2016/06/21 17:20:31
Can you capitalize TURN consistently here and belo
honghaiz3
2016/06/21 18:36:06
Done.
|
| +// local candidate will still be an IPv4 address and it can only create |
| +// connections with IPv4 remote candidates. |
| +TEST_F(TurnPortTest, TestCandidateAddressFamilyMatch) { |
| + rtc::ScopedFakeClock clock; |
|
Taylor Brandstetter
2016/06/21 17:20:31
I don't know why the fake clock is necessary here.
honghaiz3
2016/06/21 18:36:06
If we have to wait for some state change with a ti
Taylor Brandstetter
2016/06/21 19:26:48
The general solution in that case is to use a long
honghaiz3
2016/06/21 20:06:49
Removed the fake clock but keep the kTimeout. I th
|
| + turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); |
| + |
| + CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword, |
| + kTurnUdpIPv6ProtoAddr); |
| + turn_port_->PrepareAddress(); |
| + EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kTimeout, clock); |
| + ASSERT_EQ(1U, turn_port_->Candidates().size()); |
| + |
| + // Create an IPv4 port. Its candidate will match the Turn candidate. |
|
pthatcher1
2016/06/21 05:26:54
TURN
honghaiz3
2016/06/21 18:36:06
Done.
|
| + CreateUdpPort(); |
|
Taylor Brandstetter
2016/06/21 17:20:31
Why do you need to create actual remote ports? Cou
honghaiz3
2016/06/21 18:36:06
Done.
|
| + udp_port_->PrepareAddress(); |
| + EXPECT_TRUE_SIMULATED_WAIT(udp_ready_, kTimeout); |
| + Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
| + Port::ORIGIN_MESSAGE); |
| + EXPECT_TRUE(conn != nullptr); |
|
Taylor Brandstetter
2016/06/21 17:20:31
EXPECT_NE(nullptr, conn)?
honghaiz3
2016/06/21 18:36:06
Done.
|
| + |
| + // Create an IPv6 UDP port. Its candidate won't match the Turn candidate. |
|
pthatcher1
2016/06/21 05:26:54
TURN
honghaiz3
2016/06/21 18:36:06
Done.
|
| + CreateUdpPort(kLocalIPv6Addr2); |
| + udp_port_->PrepareAddress(); |
| + EXPECT_TRUE_SIMULATED_WAIT(udp_ready_, kTimeout); |
| + conn = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
| + Port::ORIGIN_MESSAGE); |
| + EXPECT_TRUE(conn == nullptr); |
|
Taylor Brandstetter
2016/06/21 17:20:31
EXPECT_EQ(nullptr, conn)?
honghaiz3
2016/06/21 18:36:06
Done.
|
| +} |
| + |
| TEST_F(TurnPortTest, TestOriginHeader) { |
| CreateTurnPortWithOrigin(kLocalAddr1, kTurnUsername, kTurnPassword, |
| kTurnUdpProtoAddr, kTestOrigin); |