Increase testclient timeout from 1 to 5 seconds
BUG=4182
R=pthatcher@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/38839004
Cr-Commit-Position: refs/heads/master@{#8285}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8285 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/base/testclient.cc b/webrtc/base/testclient.cc
index 32670e2..8483c4e 100644
--- a/webrtc/base/testclient.cc
+++ b/webrtc/base/testclient.cc
@@ -34,7 +34,7 @@
bool TestClient::CheckConnState(AsyncPacketSocket::State state) {
// Wait for our timeout value until the socket reaches the desired state.
- uint32 end = TimeAfter(kTimeout);
+ uint32 end = TimeAfter(kTimeoutMs);
while (socket_->GetState() != state && TimeUntil(end) > 0)
Thread::Current()->ProcessMessages(1);
return (socket_->GetState() == state);
@@ -51,10 +51,10 @@
return socket_->SendTo(buf, size, dest, options);
}
-TestClient::Packet* TestClient::NextPacket() {
+TestClient::Packet* TestClient::NextPacket(int timeout_ms) {
// If no packets are currently available, we go into a get/dispatch loop for
- // at most 1 second. If, during the loop, a packet arrives, then we can stop
- // early and return it.
+ // at most timeout_ms. If, during the loop, a packet arrives, then we can
+ // stop early and return it.
// Note that the case where no packet arrives is important. We often want to
// test that a packet does not arrive.
@@ -63,7 +63,7 @@
// Pumping another thread's queue could lead to messages being dispatched from
// the wrong thread to non-thread-safe objects.
- uint32 end = TimeAfter(kTimeout);
+ uint32 end = TimeAfter(timeout_ms);
while (TimeUntil(end) > 0) {
{
CritScope cs(&crit_);
@@ -88,7 +88,7 @@
bool TestClient::CheckNextPacket(const char* buf, size_t size,
SocketAddress* addr) {
bool res = false;
- Packet* packet = NextPacket();
+ Packet* packet = NextPacket(kTimeoutMs);
if (packet) {
res = (packet->size == size && memcmp(packet->buf, buf, size) == 0);
if (addr)
@@ -100,7 +100,7 @@
bool TestClient::CheckNoPacket() {
bool res;
- Packet* packet = NextPacket();
+ Packet* packet = NextPacket(kNoPacketTimeoutMs);
res = (packet == NULL);
delete packet;
return res;