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

Unified Diff: webrtc/base/testclient.h

Issue 2927413002: Update VirtualSocketServerTest to use a fake clock. (Closed)
Patch Set: Allow ProcessMessages with cmsLoop of kForever. Created 3 years, 6 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 | « webrtc/base/BUILD.gn ('k') | webrtc/base/testclient.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/testclient.h
diff --git a/webrtc/base/testclient.h b/webrtc/base/testclient.h
index b4703828eb84a36ccec117254dc5489b7ae9ebc2..bd78d83b355eeeaec99fb7e19f02b2cacee29a84 100644
--- a/webrtc/base/testclient.h
+++ b/webrtc/base/testclient.h
@@ -16,6 +16,7 @@
#include "webrtc/base/asyncudpsocket.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/fakeclock.h"
namespace rtc {
@@ -44,6 +45,10 @@ class TestClient : public sigslot::has_slots<> {
// Creates a client that will send and receive with the given socket and
// will post itself messages with the given thread.
explicit TestClient(std::unique_ptr<AsyncPacketSocket> socket);
+ // Create a test client that will use a fake clock. NextPacket needs to wait
+ // for a packet to be received, and thus it needs to advance the fake clock
+ // if the test is using one, rather than just sleeping.
+ TestClient(std::unique_ptr<AsyncPacketSocket> socket, FakeClock* fake_clock);
~TestClient() override;
SocketAddress address() const { return socket_->GetLocalAddress(); }
@@ -93,7 +98,9 @@ class TestClient : public sigslot::has_slots<> {
const PacketTime& packet_time);
void OnReadyToSend(AsyncPacketSocket* socket);
bool CheckTimestamp(int64_t packet_timestamp);
+ void AdvanceTime(int ms);
+ FakeClock* fake_clock_ = nullptr;
CriticalSection crit_;
std::unique_ptr<AsyncPacketSocket> socket_;
std::vector<std::unique_ptr<Packet>> packets_;
« no previous file with comments | « webrtc/base/BUILD.gn ('k') | webrtc/base/testclient.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698