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

Unified Diff: webrtc/test/fake_network_pipe.cc

Issue 1512853002: Nuke TickTime::UseFakeClock. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | webrtc/test/fake_network_pipe_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/fake_network_pipe.cc
diff --git a/webrtc/test/fake_network_pipe.cc b/webrtc/test/fake_network_pipe.cc
index c36059356a04bbefa75653f126be5c2b70c15239..4e431222dac108bafcfc8dc4003c4c08b688d3d1 100644
--- a/webrtc/test/fake_network_pipe.cc
+++ b/webrtc/test/fake_network_pipe.cc
@@ -16,7 +16,7 @@
#include <algorithm>
#include "webrtc/call.h"
-#include "webrtc/system_wrappers/include/tick_util.h"
+#include "webrtc/system_wrappers/include/clock.h"
namespace webrtc {
@@ -70,14 +70,15 @@ class NetworkPacket {
int64_t arrival_time_;
};
-FakeNetworkPipe::FakeNetworkPipe(const FakeNetworkPipe::Config& config)
- : packet_receiver_(NULL),
+FakeNetworkPipe::FakeNetworkPipe(Clock* clock,
+ const FakeNetworkPipe::Config& config)
+ : clock_(clock),
+ packet_receiver_(NULL),
config_(config),
dropped_packets_(0),
sent_packets_(0),
total_packet_delay_(0),
- next_process_time_(TickTime::MillisecondTimestamp()) {
-}
+ next_process_time_(clock_->TimeInMilliseconds()) {}
FakeNetworkPipe::~FakeNetworkPipe() {
while (!capacity_link_.empty()) {
@@ -112,7 +113,7 @@ void FakeNetworkPipe::SendPacket(const uint8_t* data, size_t data_length) {
return;
}
- int64_t time_now = TickTime::MillisecondTimestamp();
+ int64_t time_now = clock_->TimeInMilliseconds();
// Delay introduced by the link capacity.
int64_t capacity_delay_ms = 0;
@@ -149,7 +150,7 @@ int FakeNetworkPipe::AverageDelay() {
}
void FakeNetworkPipe::Process() {
- int64_t time_now = TickTime::MillisecondTimestamp();
+ int64_t time_now = clock_->TimeInMilliseconds();
std::queue<NetworkPacket*> packets_to_deliver;
{
rtc::CritScope crit(&lock_);
@@ -210,8 +211,8 @@ int64_t FakeNetworkPipe::TimeUntilNextProcess() const {
const int64_t kDefaultProcessIntervalMs = 30;
if (capacity_link_.size() == 0 || delay_link_.size() == 0)
return kDefaultProcessIntervalMs;
- return std::max<int64_t>(
- next_process_time_ - TickTime::MillisecondTimestamp(), 0);
+ return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(),
+ 0);
}
} // namespace webrtc
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | webrtc/test/fake_network_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698