| OLD | NEW |
| 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 <resolv.h> | 5 #include <resolv.h> |
| 6 | 6 |
| 7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
| 8 #include "net/dns/dns_config_service_posix.h" | 8 #include "net/dns/dns_config_service_posix.h" |
| 9 | 9 |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // MAXNS is normally 3, but let's test 4 if possible. | 15 // MAXNS is normally 3, but let's test 4 if possible. |
| 16 const char* kNameserversIPv4[] = { | 16 const char* kNameserversIPv4[] = { |
| 17 "8.8.8.8", | 17 "8.8.8.8", |
| 18 "192.168.1.1", | 18 "192.168.1.1", |
| 19 "63.1.2.4", | 19 "63.1.2.4", |
| 20 "1.0.0.1", | 20 "1.0.0.1", |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 #if defined(OS_LINUX) |
| 23 const char* kNameserversIPv6[] = { | 24 const char* kNameserversIPv6[] = { |
| 24 NULL, | 25 NULL, |
| 25 "2001:DB8:0::42", | 26 "2001:DB8:0::42", |
| 26 NULL, | 27 NULL, |
| 27 "::FFFF:129.144.52.38", | 28 "::FFFF:129.144.52.38", |
| 28 }; | 29 }; |
| 30 #endif |
| 29 | 31 |
| 30 // Fills in |res| with sane configuration. | 32 // Fills in |res| with sane configuration. |
| 31 void InitializeResState(res_state res) { | 33 void InitializeResState(res_state res) { |
| 32 memset(res, 0, sizeof(*res)); | 34 memset(res, 0, sizeof(*res)); |
| 33 res->options = RES_INIT | RES_RECURSE | RES_DEFNAMES | RES_DNSRCH | | 35 res->options = RES_INIT | RES_RECURSE | RES_DEFNAMES | RES_DNSRCH | |
| 34 RES_ROTATE; | 36 RES_ROTATE; |
| 35 res->ndots = 2; | 37 res->ndots = 2; |
| 36 res->retrans = 4; | 38 res->retrans = 4; |
| 37 res->retry = 7; | 39 res->retry = 7; |
| 38 | 40 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 internal::ConvertResStateToDnsConfig(res, &config)); | 147 internal::ConvertResStateToDnsConfig(res, &config)); |
| 146 | 148 |
| 147 sa.sin_addr.s_addr = 0xDEADBEEF; | 149 sa.sin_addr.s_addr = 0xDEADBEEF; |
| 148 res.nsaddr_list[0] = sa; | 150 res.nsaddr_list[0] = sa; |
| 149 EXPECT_EQ(internal::CONFIG_PARSE_POSIX_OK, | 151 EXPECT_EQ(internal::CONFIG_PARSE_POSIX_OK, |
| 150 internal::ConvertResStateToDnsConfig(res, &config)); | 152 internal::ConvertResStateToDnsConfig(res, &config)); |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace | 155 } // namespace |
| 154 } // namespace net | 156 } // namespace net |
| OLD | NEW |