summaryrefslogtreecommitdiffstats
path: root/net/dns
diff options
context:
space:
mode:
authorttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-13 02:21:59 +0000
committerttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-13 02:21:59 +0000
commit4817d12607a1e0a0cdc6eaa510aad4a07f529dd3 (patch)
tree78116742ab6769a42131e1e1aaf31376ac9bccd4 /net/dns
parent023f5e1d03c90150b1f47e952e5a0159ac5597bc (diff)
downloadchromium_src-4817d12607a1e0a0cdc6eaa510aad4a07f529dd3.zip
chromium_src-4817d12607a1e0a0cdc6eaa510aad4a07f529dd3.tar.gz
chromium_src-4817d12607a1e0a0cdc6eaa510aad4a07f529dd3.tar.bz2
DnsProbeJob: Differentiate network and DNS errors
DnsTransaction uses net_error to return errors returned by the remote DNS server as well as local errors encountered trying to talk to the server (like timeouts). Make note of which net errors mean that we received a response from the DNS server, and mark those as "failing" instead of "unreachable". Also, add another behavior to mock DNS transactions so we can test cases where the server is unreachable. BUG=156415 TEST=updated DnsProbeJobTest with a new case Review URL: https://chromiumcodereview.appspot.com/11530018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/dns')
-rw-r--r--net/dns/dns_test_util.cc3
-rw-r--r--net/dns/dns_test_util.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc
index 8663370..237646b 100644
--- a/net/dns/dns_test_util.cc
+++ b/net/dns/dns_test_util.cc
@@ -126,6 +126,9 @@ class MockTransaction : public DnsTransaction,
case MockDnsClientRule::FAIL_ASYNC:
callback_.Run(this, ERR_NAME_NOT_RESOLVED, NULL);
break;
+ case MockDnsClientRule::TIMEOUT:
+ callback_.Run(this, ERR_DNS_TIMED_OUT, NULL);
+ break;
default:
NOTREACHED();
break;
diff --git a/net/dns/dns_test_util.h b/net/dns/dns_test_util.h
index 7d11920..1b67697 100644
--- a/net/dns/dns_test_util.h
+++ b/net/dns/dns_test_util.h
@@ -180,6 +180,7 @@ struct MockDnsClientRule {
enum Result {
FAIL_SYNC, // Fail synchronously with ERR_NAME_NOT_RESOLVED.
FAIL_ASYNC, // Fail asynchronously with ERR_NAME_NOT_RESOLVED.
+ TIMEOUT, // Fail asynchronously with ERR_DNS_TIMEOUT.
EMPTY, // Return an empty response.
OK, // Return a response with loopback address.
};