| OLD | NEW |
| 1 // Copyright (c) 2009 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 "base/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
| 6 #include "net/base/address_list.h" | 6 #include "net/base/address_list.h" |
| 7 #include "net/base/mock_host_resolver.h" | 7 #include "net/base/mock_host_resolver.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| 11 #include "net/base/sys_addrinfo.h" | 11 #include "net/base/sys_addrinfo.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 41 virtual void Shutdown() {} | 41 virtual void Shutdown() {} |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 ~MockHostResolverWithMultipleResults() {} | 44 ~MockHostResolverWithMultipleResults() {} |
| 45 | 45 |
| 46 // Resolves an IP literal to an address list. | 46 // Resolves an IP literal to an address list. |
| 47 AddressList ResolveIPLiteral(const char* ip_literal) { | 47 AddressList ResolveIPLiteral(const char* ip_literal) { |
| 48 AddressList result; | 48 AddressList result; |
| 49 int rv = SystemHostResolverProc(ip_literal, | 49 int rv = SystemHostResolverProc(ip_literal, |
| 50 ADDRESS_FAMILY_UNSPECIFIED, | 50 ADDRESS_FAMILY_UNSPECIFIED, |
| 51 0, |
| 51 &result); | 52 &result); |
| 52 EXPECT_EQ(OK, rv); | 53 EXPECT_EQ(OK, rv); |
| 53 EXPECT_EQ(NULL, result.head()->ai_next); | 54 EXPECT_EQ(NULL, result.head()->ai_next); |
| 54 return result; | 55 return result; |
| 55 } | 56 } |
| 56 | 57 |
| 57 // Builds an AddressList that is |ip_literal| + |address_list|. | 58 // Builds an AddressList that is |ip_literal| + |address_list|. |
| 58 // |orig_list| must not be empty. | 59 // |orig_list| must not be empty. |
| 59 AddressList PrependAddressToList(const char* ip_literal, | 60 AddressList PrependAddressToList(const char* ip_literal, |
| 60 const AddressList& orig_list) { | 61 const AddressList& orig_list) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 183 |
| 183 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2", | 184 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2", |
| 184 bindings->MyIpAddressEx()); | 185 bindings->MyIpAddressEx()); |
| 185 | 186 |
| 186 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2", | 187 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2", |
| 187 bindings->DnsResolveEx("FOO")); | 188 bindings->DnsResolveEx("FOO")); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace | 191 } // namespace |
| 191 } // namespace net | 192 } // namespace net |
| OLD | NEW |