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

Unified Diff: webrtc/base/virtualsocketserver.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/virtualsocket_unittest.cc ('k') | webrtc/base/virtualsocketserver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/virtualsocketserver.h
diff --git a/webrtc/base/virtualsocketserver.h b/webrtc/base/virtualsocketserver.h
index 56535f1783e2ce501b39ebd9d77dd6a0e2f381bc..0ab2af29fbc9da07fcfa54f7a7eda470b0a7f232 100644
--- a/webrtc/base/virtualsocketserver.h
+++ b/webrtc/base/virtualsocketserver.h
@@ -17,6 +17,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/event.h"
+#include "webrtc/base/fakeclock.h"
#include "webrtc/base/messagequeue.h"
#include "webrtc/base/socketserver.h"
@@ -33,6 +34,10 @@ class SocketAddressPair;
class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> {
public:
VirtualSocketServer();
+ // This constructor needs to be used if the test uses a fake clock and
+ // ProcessMessagesUntilIdle, since ProcessMessagesUntilIdle needs a way of
+ // advancing time.
+ explicit VirtualSocketServer(FakeClock* fake_clock);
~VirtualSocketServer() override;
// The default route indicates which local address to use when a socket is
@@ -242,6 +247,10 @@ class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> {
typedef std::map<SocketAddress, VirtualSocket*> AddressMap;
typedef std::map<SocketAddressPair, VirtualSocket*> ConnectionMap;
+ // May be null if the test doesn't use a fake clock, or it does but doesn't
+ // use ProcessMessagesUntilIdle.
+ FakeClock* fake_clock_ = nullptr;
+
// Used to implement Wait/WakeUp.
Event wakeup_;
MessageQueue* msg_queue_;
« no previous file with comments | « webrtc/base/virtualsocket_unittest.cc ('k') | webrtc/base/virtualsocketserver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698