Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1781 rconn->Ping(0); | 1781 rconn->Ping(0); |
| 1782 EXPECT_EQ(5U, rconn->stats().sent_ping_requests_total); | 1782 EXPECT_EQ(5U, rconn->stats().sent_ping_requests_total); |
| 1783 EXPECT_EQ(3U, rconn->stats().sent_ping_requests_before_first_response); | 1783 EXPECT_EQ(3U, rconn->stats().sent_ping_requests_before_first_response); |
| 1784 | 1784 |
| 1785 // Response should include same ping count. | 1785 // Response should include same ping count. |
| 1786 retransmit_attr = msg->GetUInt32(STUN_ATTR_RETRANSMIT_COUNT); | 1786 retransmit_attr = msg->GetUInt32(STUN_ATTR_RETRANSMIT_COUNT); |
| 1787 ASSERT_TRUE(retransmit_attr != NULL); | 1787 ASSERT_TRUE(retransmit_attr != NULL); |
| 1788 EXPECT_EQ(2U, retransmit_attr->value()); | 1788 EXPECT_EQ(2U, retransmit_attr->value()); |
| 1789 } | 1789 } |
| 1790 | 1790 |
| 1791 TEST_F(PortTest, TestRoundTripTime) { | |
| 1792 std::unique_ptr<TestPort> lport( | |
| 1793 CreateTestPort(kLocalAddr1, "lfrag", "lpass")); | |
| 1794 std::unique_ptr<TestPort> rport( | |
| 1795 CreateTestPort(kLocalAddr2, "rfrag", "rpass")); | |
| 1796 lport->SetIceRole(cricket::ICEROLE_CONTROLLING); | |
| 1797 lport->SetIceTiebreaker(kTiebreaker1); | |
| 1798 rport->SetIceRole(cricket::ICEROLE_CONTROLLED); | |
| 1799 rport->SetIceTiebreaker(kTiebreaker2); | |
| 1800 | |
| 1801 lport->PrepareAddress(); | |
| 1802 rport->PrepareAddress(); | |
| 1803 ASSERT_FALSE(rport->Candidates().empty()); | |
| 1804 Connection* lconn = lport->CreateConnection( | |
| 1805 rport->Candidates()[0], Port::ORIGIN_MESSAGE); | |
| 1806 | |
| 1807 EXPECT_FALSE(lconn->stats().total_round_trip_time_ms); | |
| 1808 EXPECT_FALSE(lconn->stats().current_round_trip_time_ms); | |
| 1809 | |
| 1810 lconn->ReceivedPingResponse(10, "id"); | |
|
Taylor Brandstetter
2017/02/25 01:31:29
ReceivedPingResponse is something that *should* be
pthatcher1
2017/02/27 18:07:21
I agree. TestHandleStunMessage is an example of h
hbos
2017/02/27 19:51:34
I updated the test to use Ping much like the real
| |
| 1811 ASSERT_TRUE(lconn->stats().total_round_trip_time_ms); | |
| 1812 ASSERT_TRUE(lconn->stats().current_round_trip_time_ms); | |
| 1813 EXPECT_EQ(*lconn->stats().total_round_trip_time_ms, 10u); | |
| 1814 EXPECT_EQ(*lconn->stats().current_round_trip_time_ms, 10u); | |
| 1815 | |
| 1816 lconn->ReceivedPingResponse(20, "id"); | |
| 1817 ASSERT_TRUE(lconn->stats().total_round_trip_time_ms); | |
| 1818 ASSERT_TRUE(lconn->stats().current_round_trip_time_ms); | |
| 1819 EXPECT_EQ(*lconn->stats().total_round_trip_time_ms, 30u); | |
| 1820 EXPECT_EQ(*lconn->stats().current_round_trip_time_ms, 20u); | |
| 1821 | |
| 1822 lconn->ReceivedPingResponse(30, "id"); | |
| 1823 ASSERT_TRUE(lconn->stats().total_round_trip_time_ms); | |
| 1824 ASSERT_TRUE(lconn->stats().current_round_trip_time_ms); | |
| 1825 EXPECT_EQ(*lconn->stats().total_round_trip_time_ms, 60u); | |
| 1826 EXPECT_EQ(*lconn->stats().current_round_trip_time_ms, 30u); | |
| 1827 } | |
| 1828 | |
| 1791 TEST_F(PortTest, TestUseCandidateAttribute) { | 1829 TEST_F(PortTest, TestUseCandidateAttribute) { |
| 1792 std::unique_ptr<TestPort> lport( | 1830 std::unique_ptr<TestPort> lport( |
| 1793 CreateTestPort(kLocalAddr1, "lfrag", "lpass")); | 1831 CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
| 1794 std::unique_ptr<TestPort> rport( | 1832 std::unique_ptr<TestPort> rport( |
| 1795 CreateTestPort(kLocalAddr2, "rfrag", "rpass")); | 1833 CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
| 1796 lport->SetIceRole(cricket::ICEROLE_CONTROLLING); | 1834 lport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
| 1797 lport->SetIceTiebreaker(kTiebreaker1); | 1835 lport->SetIceTiebreaker(kTiebreaker1); |
| 1798 rport->SetIceRole(cricket::ICEROLE_CONTROLLED); | 1836 rport->SetIceRole(cricket::ICEROLE_CONTROLLED); |
| 1799 rport->SetIceTiebreaker(kTiebreaker2); | 1837 rport->SetIceTiebreaker(kTiebreaker2); |
| 1800 | 1838 |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2762 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); | 2800 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); |
| 2763 EXPECT_NE(conn1, conn2); | 2801 EXPECT_NE(conn1, conn2); |
| 2764 conn_in_use = port->GetConnection(address); | 2802 conn_in_use = port->GetConnection(address); |
| 2765 EXPECT_EQ(conn2, conn_in_use); | 2803 EXPECT_EQ(conn2, conn_in_use); |
| 2766 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); | 2804 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); |
| 2767 | 2805 |
| 2768 // Make sure the new connection was not deleted. | 2806 // Make sure the new connection was not deleted. |
| 2769 rtc::Thread::Current()->ProcessMessages(300); | 2807 rtc::Thread::Current()->ProcessMessages(300); |
| 2770 EXPECT_TRUE(port->GetConnection(address) != nullptr); | 2808 EXPECT_TRUE(port->GetConnection(address) != nullptr); |
| 2771 } | 2809 } |
| OLD | NEW |