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

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

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 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/net_util_unittest.cc ('k') | net/curvecp/client_packetizer.h » ('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) 2011 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/single_request_host_resolver.h" 5 #include "net/base/single_request_host_resolver.h"
6 6
7 #include "net/base/address_list.h" 7 #include "net/base/address_list.h"
8 #include "net/base/mock_host_resolver.h" 8 #include "net/base/mock_host_resolver.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/base/net_log.h" 10 #include "net/base/net_log.h"
11 #include "net/base/test_completion_callback.h" 11 #include "net/base/test_completion_callback.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Resolve "watsup:90" using our SingleRequestHostResolver. 75 // Resolve "watsup:90" using our SingleRequestHostResolver.
76 AddressList addrlist; 76 AddressList addrlist;
77 TestCompletionCallback callback; 77 TestCompletionCallback callback;
78 HostResolver::RequestInfo request(HostPortPair("watsup", 90)); 78 HostResolver::RequestInfo request(HostPortPair("watsup", 90));
79 int rv = single_request_resolver.Resolve( 79 int rv = single_request_resolver.Resolve(
80 request, &addrlist, callback.callback(), BoundNetLog()); 80 request, &addrlist, callback.callback(), BoundNetLog());
81 EXPECT_EQ(ERR_IO_PENDING, rv); 81 EXPECT_EQ(ERR_IO_PENDING, rv);
82 EXPECT_EQ(OK, callback.WaitForResult()); 82 EXPECT_EQ(OK, callback.WaitForResult());
83 83
84 // Verify that the result is what we specified in the MockHostResolver. 84 // Verify that the result is what we specified in the MockHostResolver.
85 EXPECT_EQ("199.188.1.166", NetAddressToString(addrlist.head())); 85 ASSERT_FALSE(addrlist.empty());
86 EXPECT_EQ("199.188.1.166", addrlist.front().ToStringWithoutPort());
86 } 87 }
87 88
88 // Test that the Cancel() method cancels any outstanding request. 89 // Test that the Cancel() method cancels any outstanding request.
89 TEST(SingleRequestHostResolverTest, Cancel) { 90 TEST(SingleRequestHostResolverTest, Cancel) {
90 HangingHostResolver resolver; 91 HangingHostResolver resolver;
91 92
92 { 93 {
93 SingleRequestHostResolver single_request_resolver(&resolver); 94 SingleRequestHostResolver single_request_resolver(&resolver);
94 95
95 // Resolve "watsup:90" using our SingleRequestHostResolver. 96 // Resolve "watsup:90" using our SingleRequestHostResolver.
(...skipping 18 matching lines...) Expand all
114 SingleRequestHostResolver single_request_resolver(&resolver); 115 SingleRequestHostResolver single_request_resolver(&resolver);
115 single_request_resolver.Cancel(); 116 single_request_resolver.Cancel();
116 117
117 // To pass, HangingHostResolver should not have received a cancellation 118 // To pass, HangingHostResolver should not have received a cancellation
118 // request (since there is nothing to cancel). If it does, it will crash. 119 // request (since there is nothing to cancel). If it does, it will crash.
119 } 120 }
120 121
121 } // namespace 122 } // namespace
122 123
123 } // namespace net 124 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | net/curvecp/client_packetizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698