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

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

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h Created 9 years, 11 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_impl.cc ('k') | net/base/keygen_handler_mac.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 event_.Signal(); 85 event_.Signal();
86 } 86 }
87 87
88 virtual int Resolve(const std::string& hostname, 88 virtual int Resolve(const std::string& hostname,
89 AddressFamily address_family, 89 AddressFamily address_family,
90 HostResolverFlags host_resolver_flags, 90 HostResolverFlags host_resolver_flags,
91 AddressList* addrlist, 91 AddressList* addrlist,
92 int* os_error) { 92 int* os_error) {
93 event_.Wait(); 93 event_.Wait();
94 { 94 {
95 AutoLock l(lock_); 95 base::AutoLock l(lock_);
96 capture_list_.push_back(CaptureEntry(hostname, address_family)); 96 capture_list_.push_back(CaptureEntry(hostname, address_family));
97 } 97 }
98 return ResolveUsingPrevious(hostname, address_family, 98 return ResolveUsingPrevious(hostname, address_family,
99 host_resolver_flags, addrlist, os_error); 99 host_resolver_flags, addrlist, os_error);
100 } 100 }
101 101
102 CaptureList GetCaptureList() const { 102 CaptureList GetCaptureList() const {
103 CaptureList copy; 103 CaptureList copy;
104 { 104 {
105 AutoLock l(lock_); 105 base::AutoLock l(lock_);
106 copy = capture_list_; 106 copy = capture_list_;
107 } 107 }
108 return copy; 108 return copy;
109 } 109 }
110 110
111 private: 111 private:
112 ~CapturingHostResolverProc() {} 112 ~CapturingHostResolverProc() {}
113 113
114 CaptureList capture_list_; 114 CaptureList capture_list_;
115 mutable Lock lock_; 115 mutable base::Lock lock_;
116 base::WaitableEvent event_; 116 base::WaitableEvent event_;
117 }; 117 };
118 118
119 // This resolver function creates an IPv4 address, whose numeral value 119 // This resolver function creates an IPv4 address, whose numeral value
120 // describes a hash of the requested hostname, and the value of the requested 120 // describes a hash of the requested hostname, and the value of the requested
121 // address_family. 121 // address_family.
122 // 122 //
123 // The resolved address for (hostname, address_family) will take the form: 123 // The resolved address for (hostname, address_family) will take the form:
124 // 192.x.y.z 124 // 192.x.y.z
125 // 125 //
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 EXPECT_EQ("192.1.98.2", NetAddressToString(addrlist[1].head())); 1655 EXPECT_EQ("192.1.98.2", NetAddressToString(addrlist[1].head()));
1656 EXPECT_EQ("192.1.98.1", NetAddressToString(addrlist[2].head())); 1656 EXPECT_EQ("192.1.98.1", NetAddressToString(addrlist[2].head()));
1657 EXPECT_EQ("192.1.98.1", NetAddressToString(addrlist[3].head())); 1657 EXPECT_EQ("192.1.98.1", NetAddressToString(addrlist[3].head()));
1658 } 1658 }
1659 1659
1660 // TODO(cbentzel): Test a mix of requests with different HostResolverFlags. 1660 // TODO(cbentzel): Test a mix of requests with different HostResolverFlags.
1661 1661
1662 } // namespace 1662 } // namespace
1663 1663
1664 } // namespace net 1664 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_resolver_impl.cc ('k') | net/base/keygen_handler_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698