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

Unified Diff: remoting/test/fake_socket_factory.h

Issue 2369243002: Report network stats in the scroll performance tests (Closed)
Patch Set: . Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/test/fake_socket_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/test/fake_socket_factory.h
diff --git a/remoting/test/fake_socket_factory.h b/remoting/test/fake_socket_factory.h
index e75581824816b9c6f57db39173bfd5961fb3096d..c36b2b7acee6bdb703a55bfc69399dabdc03f56d 100644
--- a/remoting/test/fake_socket_factory.h
+++ b/remoting/test/fake_socket_factory.h
@@ -53,6 +53,19 @@ class FakePacketSocketFactory : public rtc::PacketSocketFactory,
out_of_order_rate_ = out_of_order_rate;
}
+ void ResetStats();
+
+ base::TimeDelta average_buffer_delay() {
+ return total_packets_received_ > 0
+ ? (total_buffer_delay_ / total_packets_received_)
+ : base::TimeDelta();
+ }
+ base::TimeDelta max_buffer_delay() { return max_buffer_delay_; }
+ double drop_rate() {
+ return static_cast<double>(total_packets_dropped_) /
+ (total_packets_received_ + total_packets_dropped_);
+ }
+
// rtc::PacketSocketFactory interface.
rtc::AsyncPacketSocket* CreateUdpSocket(
const rtc::SocketAddress& local_address,
@@ -119,6 +132,11 @@ class FakePacketSocketFactory : public rtc::PacketSocketFactory,
std::list<PendingPacket> pending_packets_;
+ int total_packets_received_ = 0;
+ int total_packets_dropped_ = 0;
+ base::TimeDelta total_buffer_delay_;
+ base::TimeDelta max_buffer_delay_;
+
base::WeakPtrFactory<FakePacketSocketFactory> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(FakePacketSocketFactory);
« no previous file with comments | « no previous file | remoting/test/fake_socket_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698