diff options
author | Danil Chapovalov <danilchap@webrtc.org> | 2020-02-10 11:16:00 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-10 12:21:17 +0000 |
commit | 0c626afcf387d16ba0ea35871690a0ca5bd11962 (patch) | |
tree | 989a0ab270cfc79cfcd4d457bf2fe279e1f349ec /p2p/base | |
parent | 9b05803e1949119a8e3884dbf27af0b0a8e79d49 (diff) | |
download | webrtc-0c626afcf387d16ba0ea35871690a0ca5bd11962.tar.gz |
Use newer version of TimeDelta and TimeStamp factories in webrtc
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Micros<\(.*\)>()/TimeDelta::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Millis<\(.*\)>()/TimeDelta::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Seconds<\(.*\)>()/TimeDelta::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::us/TimeDelta::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::ms/TimeDelta::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::seconds/TimeDelta::Seconds/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Micros<\(.*\)>()/Timestamp::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Millis<\(.*\)>()/Timestamp::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Seconds<\(.*\)>()/Timestamp::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::us/Timestamp::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::ms/Timestamp::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::seconds/Timestamp::Seconds/g"
git cl format
Bug: None
Change-Id: I87469d2e4a38369654da839ab7c838215a7911e7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168402
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30491}
Diffstat (limited to 'p2p/base')
-rw-r--r-- | p2p/base/dtls_transport_unittest.cc | 5 | ||||
-rw-r--r-- | p2p/base/p2p_transport_channel_unittest.cc | 26 | ||||
-rw-r--r-- | p2p/base/port_unittest.cc | 2 | ||||
-rw-r--r-- | p2p/base/turn_port_unittest.cc | 2 |
4 files changed, 18 insertions, 17 deletions
diff --git a/p2p/base/dtls_transport_unittest.cc b/p2p/base/dtls_transport_unittest.cc index 287264da9e..8ac6e9b8a6 100644 --- a/p2p/base/dtls_transport_unittest.cc +++ b/p2p/base/dtls_transport_unittest.cc @@ -584,9 +584,10 @@ TEST_F(DtlsTransportTest, TestRetransmissionSchedule) { // millisecond before the expected time and verify that no unexpected // retransmissions were sent. Then advance it the final millisecond and // verify that the expected retransmission was sent. - fake_clock_.AdvanceTime(webrtc::TimeDelta::ms(timeout_schedule_ms[i] - 1)); + fake_clock_.AdvanceTime( + webrtc::TimeDelta::Millis(timeout_schedule_ms[i] - 1)); EXPECT_EQ(expected_hellos, client1_.received_dtls_client_hellos()); - fake_clock_.AdvanceTime(webrtc::TimeDelta::ms(1)); + fake_clock_.AdvanceTime(webrtc::TimeDelta::Millis(1)); EXPECT_EQ(++expected_hellos, client1_.received_dtls_client_hellos()); } } diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc index 5f84aa3cf1..ff60767ceb 100644 --- a/p2p/base/p2p_transport_channel_unittest.cc +++ b/p2p/base/p2p_transport_channel_unittest.cc @@ -3619,7 +3619,7 @@ TEST_F(P2PTransportChannelPingTest, TestReceivingStateChange) { Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1, &clock); ASSERT_TRUE(conn1 != nullptr); - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); conn1->ReceivedPing(); conn1->OnReadPacket("ABC", 3, rtc::TimeMicros()); EXPECT_TRUE_SIMULATED_WAIT(ch.receiving(), kShortTimeout, clock); @@ -3854,7 +3854,7 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) { TEST_F(P2PTransportChannelPingTest, TestControlledAgentDataReceivingTakesHigherPrecedenceThanPriority) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("SwitchSelectedConnection", 1, &pa); PrepareChannel(&ch); @@ -3902,7 +3902,7 @@ TEST_F(P2PTransportChannelPingTest, TEST_F(P2PTransportChannelPingTest, TestControlledAgentNominationTakesHigherPrecedenceThanDataReceiving) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("SwitchSelectedConnection", 1, &pa); @@ -3942,7 +3942,7 @@ TEST_F(P2PTransportChannelPingTest, TEST_F(P2PTransportChannelPingTest, TestControlledAgentSelectsConnectionWithHigherNomination) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test", 1, &pa); @@ -3989,7 +3989,7 @@ TEST_F(P2PTransportChannelPingTest, TEST_F(P2PTransportChannelPingTest, TestControlledAgentIgnoresSmallerNomination) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test", 1, &pa); @@ -4089,7 +4089,7 @@ TEST_F(P2PTransportChannelPingTest, TestAddRemoteCandidateWithAddressReuse) { // will be pruned. Otherwise, lower-priority connections are kept. TEST_F(P2PTransportChannelPingTest, TestDontPruneWhenWeak) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); PrepareChannel(&ch); @@ -4149,7 +4149,7 @@ TEST_F(P2PTransportChannelPingTest, TestDontPruneHighPriorityConnections) { // Test that GetState returns the state correctly. TEST_F(P2PTransportChannelPingTest, TestGetState) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); EXPECT_EQ(webrtc::IceTransportState::kNew, ch.GetIceTransportState()); @@ -4189,7 +4189,7 @@ TEST_F(P2PTransportChannelPingTest, TestGetState) { // right away, and it can become active and be pruned again. TEST_F(P2PTransportChannelPingTest, TestConnectionPrunedAgain) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -4368,7 +4368,7 @@ TEST_F(P2PTransportChannelPingTest, TestPortDestroyedAfterTimeoutAndPruned) { // Simulate 2 minutes going by. This should be enough time for the port to // time out. for (int second = 0; second < 120; ++second) { - fake_clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + fake_clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); } EXPECT_EQ(nullptr, GetConnectionTo(&ch, "1.1.1.1", 1)); // Port will not be removed because it is not pruned yet. @@ -5445,7 +5445,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampening0) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -5469,7 +5469,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampening) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -5493,7 +5493,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampeningPingReceived) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -5520,7 +5520,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampeningBoth) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc index e2dde8358c..c701da229b 100644 --- a/p2p/base/port_unittest.cc +++ b/p2p/base/port_unittest.cc @@ -255,7 +255,7 @@ static void SendPingAndReceiveResponse(Connection* lconn, ASSERT_TRUE(lport->last_stun_buf()); rconn->OnReadPacket(lport->last_stun_buf()->data<char>(), lport->last_stun_buf()->size(), /* packet_time_us */ -1); - clock->AdvanceTime(webrtc::TimeDelta::ms(ms)); + clock->AdvanceTime(webrtc::TimeDelta::Millis(ms)); ASSERT_TRUE_WAIT(rport->last_stun_msg(), kDefaultTimeout); ASSERT_TRUE(rport->last_stun_buf()); lconn->OnReadPacket(rport->last_stun_buf()->data<char>(), diff --git a/p2p/base/turn_port_unittest.cc b/p2p/base/turn_port_unittest.cc index e8c1a6e0f3..1f5a7bf49e 100644 --- a/p2p/base/turn_port_unittest.cc +++ b/p2p/base/turn_port_unittest.cc @@ -166,7 +166,7 @@ class TurnPortTest : public ::testing::Test, // Some code uses "last received time == 0" to represent "nothing received // so far", so we need to start the fake clock at a nonzero time... // TODO(deadbeef): Fix this. - fake_clock_.AdvanceTime(webrtc::TimeDelta::seconds(1)); + fake_clock_.AdvanceTime(webrtc::TimeDelta::Seconds(1)); } virtual void OnMessage(rtc::Message* msg) { |