Adding ability to simulate EWOULDBLOCK/SignalReadyToSend.
Calling VirtualSocketServer::SetSendingBlocked(true) will simulate the network interface being blocked, and SetSendingBlocked(false) will simulate it being unblocked, resulting in SignalReadyToSend if appropriate. I plan to use this to write tests for upper layers of code that deal with EWOULDBLOCK/SignalReadyToSend. Also doing some minor housekeeping in this CL (using RTC_DCHECK, renaming variables, etc.). R=pthatcher@webrtc.org, skvlad@webrtc.org Review URL: https://codereview.webrtc.org/2284903002 . Cr-Commit-Position: refs/heads/master@{#14170}
This commit is contained in:
@ -77,7 +77,10 @@ class TestClient : public sigslot::has_slots<> {
|
||||
int GetError();
|
||||
int SetOption(Socket::Option opt, int value);
|
||||
|
||||
bool ready_to_send() const;
|
||||
bool ready_to_send() const { return ready_to_send_count() > 0; }
|
||||
|
||||
// How many times SignalReadyToSend has been fired.
|
||||
int ready_to_send_count() const { return ready_to_send_count_; }
|
||||
|
||||
private:
|
||||
// Timeout for reads when no packet is expected.
|
||||
@ -94,7 +97,7 @@ class TestClient : public sigslot::has_slots<> {
|
||||
CriticalSection crit_;
|
||||
AsyncPacketSocket* socket_;
|
||||
std::vector<Packet*>* packets_;
|
||||
bool ready_to_send_;
|
||||
int ready_to_send_count_ = 0;
|
||||
int64_t prev_packet_timestamp_;
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(TestClient);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user