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 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1854 ASSERT_TRUE(conn1 != nullptr); | 1854 ASSERT_TRUE(conn1 != nullptr); |
1855 EXPECT_EQ(conn1->remote_candidate().priority(), remote_priority); | 1855 EXPECT_EQ(conn1->remote_candidate().priority(), remote_priority); |
1856 | 1856 |
1857 // conn3, a real prflx connection, should have prflx priority. | 1857 // conn3, a real prflx connection, should have prflx priority. |
1858 port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 1), | 1858 port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 1), |
1859 cricket::PROTO_UDP, &request, kIceUfrag[1], false); | 1859 cricket::PROTO_UDP, &request, kIceUfrag[1], false); |
1860 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 1); | 1860 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 1); |
1861 ASSERT_TRUE(conn3 != nullptr); | 1861 ASSERT_TRUE(conn3 != nullptr); |
1862 EXPECT_EQ(conn3->remote_candidate().priority(), prflx_priority); | 1862 EXPECT_EQ(conn3->remote_candidate().priority(), prflx_priority); |
1863 } | 1863 } |
1864 | |
1865 TEST_F(P2PTransportChannelPingTest, TestReceivingStateChange) { | |
1866 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | |
1867 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); | |
1868 PrepareChannel(&ch); | |
1869 ch.Connect(); | |
1870 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1)); | |
1871 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | |
1872 ASSERT_TRUE(conn1 != nullptr); | |
1873 | |
1874 conn1->ReceivedPing(); | |
1875 conn1->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0)); | |
1876 EXPECT_TRUE_WAIT(ch.best_connection() != nullptr, 1000) | |
1877 EXPECT_TRUE_WAIT(ch.receiving(), 1000); | |
1878 // The default receiving timeout value is 2500ms. | |
1879 EXPECT_TRUE_WAIT(!ch.receiving(), 4000); | |
1880 } | |
1881 | |
1882 TEST_F(P2PTransportChannelPingTest, | |
1883 TestReceivingStateChangeSetReceivingTimeout) { | |
1884 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | |
1885 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); | |
1886 PrepareChannel(&ch); | |
1887 ch.set_receiving_timeout(500); | |
pthatcher1
2015/07/07 22:01:40
On second though, just delete the previous test an
honghaiz3
2015/08/05 23:56:57
Done.
| |
1888 ch.Connect(); | |
1889 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1)); | |
1890 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | |
1891 ASSERT_TRUE(conn1 != nullptr); | |
1892 | |
1893 conn1->ReceivedPing(); | |
1894 conn1->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0)); | |
1895 EXPECT_TRUE_WAIT(ch.best_connection() != nullptr, 1000) | |
1896 EXPECT_TRUE_WAIT(ch.receiving(), 1000); | |
1897 EXPECT_TRUE_WAIT(!ch.receiving(), 1000); | |
1898 } | |
OLD | NEW |