Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 1207563002: Add flakiness check if there is no received packets in a certain period. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comments and add tests Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.set_receiving_timeout(500);
1870 ch.Connect();
1871 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1));
1872 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
1873 ASSERT_TRUE(conn1 != nullptr);
1874
1875 conn1->ReceivedPing();
1876 conn1->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0));
1877 EXPECT_TRUE_WAIT(ch.best_connection() != nullptr, 1000)
1878 EXPECT_TRUE_WAIT(ch.receiving(), 1000);
1879 EXPECT_TRUE_WAIT(!ch.receiving(), 1000);
1880 }
pthatcher1 2015/07/07 20:49:55 Can you add a test for when set_receiving_timeout
honghaiz3 2015/08/05 23:56:57 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698