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

Unified Diff: net/dns/dns_transaction_unittest.cc

Issue 8837001: Adjust timeouts on DnsTransactionTest for valgrind (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_transaction_unittest.cc
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
index 46c68b3158fca1f53005193de27093d29eed2907..ac701d829cd5fb34317ffc55f1f7a50568f24314 100644
--- a/net/dns/dns_transaction_unittest.cc
+++ b/net/dns/dns_transaction_unittest.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/test/test_timeouts.h"
#include "base/time.h"
#include "net/dns/dns_protocol.h"
#include "net/dns/dns_query.h"
@@ -29,24 +30,28 @@ int ReturnZero(int min, int max) {
class DnsTransactionTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
- DnsConfig config;
+ qname_ = std::string(kT0DnsName, arraysize(kT0DnsName));
+ // Use long timeout to prevent timing out on slow bots.
+ ConfigureSession(base::TimeDelta::FromMilliseconds(
+ TestTimeouts::action_timeout_ms()));
+ callback_ = base::Bind(&DnsTransactionTest::OnTransactionComplete,
+ base::Unretained(this));
+ }
+ void ConfigureSession(const base::TimeDelta& timeout) {
IPEndPoint dns_server;
bool rv = CreateDnsAddress(kDnsIp, kDnsPort, &dns_server);
ASSERT_TRUE(rv);
+
+ DnsConfig config;
config.nameservers.push_back(dns_server);
config.attempts = 3;
- config.timeout = base::TimeDelta::FromMilliseconds(20);
-
- qname_ = std::string(kT0DnsName, arraysize(kT0DnsName));
+ config.timeout = timeout;
session_ = new DnsSession(config,
new MockClientSocketFactory(),
base::Bind(&ReturnZero),
NULL /* NetLog */);
-
- callback_ = base::Bind(&DnsTransactionTest::OnTransactionComplete,
- base::Unretained(this));
}
void StartTransaction() {
@@ -151,6 +156,9 @@ TEST_F(DnsTransactionTest, FirstTimeoutTest) {
new DelayedSocketData(0, reads0, arraysize(reads0),
writes0, arraysize(writes0)));
+ // Use short timeout to speed up the test.
+ ConfigureSession(base::TimeDelta::FromMilliseconds(
+ TestTimeouts::tiny_timeout_ms()));
factory().AddSocketDataProvider(socket0_data.get());
factory().AddSocketDataProvider(socket1_data.get());
@@ -189,6 +197,9 @@ TEST_F(DnsTransactionTest, SecondTimeoutTest) {
new DelayedSocketData(0, reads0, arraysize(reads0),
writes0, arraysize(writes0)));
+ // Use short timeout to speed up the test.
+ ConfigureSession(base::TimeDelta::FromMilliseconds(
+ TestTimeouts::tiny_timeout_ms()));
factory().AddSocketDataProvider(socket0_data.get());
factory().AddSocketDataProvider(socket1_data.get());
factory().AddSocketDataProvider(socket2_data.get());
@@ -224,6 +235,9 @@ TEST_F(DnsTransactionTest, ThirdTimeoutTest) {
scoped_refptr<DelayedSocketData> socket2_data(
new DelayedSocketData(2, NULL, 0, writes0, arraysize(writes0)));
+ // Use short timeout to speed up the test.
+ ConfigureSession(base::TimeDelta::FromMilliseconds(
+ TestTimeouts::tiny_timeout_ms()));
factory().AddSocketDataProvider(socket0_data.get());
factory().AddSocketDataProvider(socket1_data.get());
factory().AddSocketDataProvider(socket2_data.get());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698