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

Side by Side Diff: net/base/host_resolver_impl_unittest.cc

Issue 9667025: [net/dns] Serve requests from HOSTS file if possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added MockDnsClient. Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/host_resolver_impl.h" 5 #include "net/base/host_resolver_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/time.h" 21 #include "base/time.h"
22 #include "net/base/address_list.h" 22 #include "net/base/address_list.h"
23 #include "net/base/completion_callback.h" 23 #include "net/base/completion_callback.h"
24 #include "net/base/host_cache.h" 24 #include "net/base/host_cache.h"
25 #include "net/base/mock_host_resolver.h" 25 #include "net/base/mock_host_resolver.h"
26 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
27 #include "net/base/net_log_unittest.h" 27 #include "net/base/net_log_unittest.h"
28 #include "net/base/net_util.h" 28 #include "net/base/net_util.h"
29 #include "net/base/sys_addrinfo.h" 29 #include "net/base/sys_addrinfo.h"
30 #include "net/base/test_completion_callback.h" 30 #include "net/base/test_completion_callback.h"
31 #include "net/dns/dns_test_util.h"
31 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
32 33
33 namespace net { 34 namespace net {
34 35
35 using base::TimeDelta; 36 using base::TimeDelta;
36 using base::TimeTicks; 37 using base::TimeTicks;
37 38
38 static const size_t kMaxJobs = 10u; 39 static const size_t kMaxJobs = 10u;
39 static const size_t kMaxRetryAttempts = 4u; 40 static const size_t kMaxRetryAttempts = 4u;
40 41
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 // Resolve returns -4 to indicate that 3rd attempt has resolved the host. 1744 // Resolve returns -4 to indicate that 3rd attempt has resolved the host.
1744 EXPECT_EQ(-4, callback.WaitForResult()); 1745 EXPECT_EQ(-4, callback.WaitForResult());
1745 1746
1746 resolver_proc->WaitForAllAttemptsToFinish(TimeDelta::FromMilliseconds(60000)); 1747 resolver_proc->WaitForAllAttemptsToFinish(TimeDelta::FromMilliseconds(60000));
1747 MessageLoop::current()->RunAllPending(); 1748 MessageLoop::current()->RunAllPending();
1748 1749
1749 EXPECT_EQ(resolver_proc->total_attempts_resolved(), kTotalAttempts); 1750 EXPECT_EQ(resolver_proc->total_attempts_resolved(), kTotalAttempts);
1750 EXPECT_EQ(resolver_proc->resolved_attempt_number(), kAttemptNumberToResolve); 1751 EXPECT_EQ(resolver_proc->resolved_attempt_number(), kAttemptNumberToResolve);
1751 } 1752 }
1752 1753
1754
1755 // TODO(szym): test HostResolverImpl::DnsTask using MockDnsClient.
1756 // TODO(szym): test ServeFromHosts using mock DnsHosts.
1757
1753 // TODO(cbentzel): Test a mix of requests with different HostResolverFlags. 1758 // TODO(cbentzel): Test a mix of requests with different HostResolverFlags.
1754 1759
1755 } // namespace net 1760 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698