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

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

Issue 126110: [Refactor] Rename DnsResolutionObserver --> HostResolver::Observer.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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
« no previous file with comments | « net/base/host_resolver.cc ('k') | net/base/tcp_client_socket_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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.h" 5 #include "net/base/host_resolver.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <ws2tcpip.h> 8 #include <ws2tcpip.h>
9 #include <wspiapi.h> 9 #include <wspiapi.h>
10 #elif defined(OS_POSIX) 10 #elif defined(OS_POSIX)
11 #include <netdb.h> 11 #include <netdb.h>
12 #endif 12 #endif
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/ref_counted.h" 18 #include "base/ref_counted.h"
19 #include "net/base/address_list.h" 19 #include "net/base/address_list.h"
20 #include "net/base/completion_callback.h" 20 #include "net/base/completion_callback.h"
21 #include "net/base/dns_resolution_observer.h"
22 #include "net/base/host_resolver_unittest.h" 21 #include "net/base/host_resolver_unittest.h"
23 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
24 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
25 24
26 using net::RuleBasedHostMapper; 25 using net::RuleBasedHostMapper;
27 using net::ScopedHostMapper; 26 using net::ScopedHostMapper;
28 using net::WaitingHostMapper; 27 using net::WaitingHostMapper;
29 28
30 // TODO(eroman): 29 // TODO(eroman):
31 // - Test mixing async with sync (in particular how does sync update the 30 // - Test mixing async with sync (in particular how does sync update the
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 const net::HostResolver::RequestInfo& b) { 689 const net::HostResolver::RequestInfo& b) {
691 return a.hostname() == b.hostname() && 690 return a.hostname() == b.hostname() &&
692 a.port() == b.port() && 691 a.port() == b.port() &&
693 a.allow_cached_response() == b.allow_cached_response() && 692 a.allow_cached_response() == b.allow_cached_response() &&
694 a.is_speculative() == b.is_speculative() && 693 a.is_speculative() == b.is_speculative() &&
695 a.referrer() == b.referrer(); 694 a.referrer() == b.referrer();
696 } 695 }
697 696
698 // Observer that just makes note of how it was called. The test code can then 697 // Observer that just makes note of how it was called. The test code can then
699 // inspect to make sure it was called with the right parameters. 698 // inspect to make sure it was called with the right parameters.
700 class CapturingObserver : public net::DnsResolutionObserver { 699 class CapturingObserver : public net::HostResolver::Observer {
701 public: 700 public:
702 // DnsResolutionObserver methods: 701 // DnsResolutionObserver methods:
703 virtual void OnStartResolution(int id, 702 virtual void OnStartResolution(int id,
704 const net::HostResolver::RequestInfo& info) { 703 const net::HostResolver::RequestInfo& info) {
705 start_log.push_back(StartEntry(id, info)); 704 start_log.push_back(StartEntry(id, info));
706 } 705 }
707 706
708 virtual void OnFinishResolutionWithStatus( 707 virtual void OnFinishResolutionWithStatus(
709 int id, 708 int id,
710 bool was_resolved, 709 bool was_resolved,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 // Resolve "host3" 783 // Resolve "host3"
785 net::HostResolver::RequestInfo info3("host3", 70); 784 net::HostResolver::RequestInfo info3("host3", 70);
786 host_resolver.Resolve(info3, &addrlist, NULL, NULL); 785 host_resolver.Resolve(info3, &addrlist, NULL, NULL);
787 786
788 // No effect this time, since observer was removed. 787 // No effect this time, since observer was removed.
789 EXPECT_EQ(2U, observer.start_log.size()); 788 EXPECT_EQ(2U, observer.start_log.size());
790 EXPECT_EQ(2U, observer.finish_log.size()); 789 EXPECT_EQ(2U, observer.finish_log.size());
791 } 790 }
792 791
793 } // namespace 792 } // namespace
OLDNEW
« no previous file with comments | « net/base/host_resolver.cc ('k') | net/base/tcp_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698