| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/network/host_resolver_impl_chromeos.h" | 5 #include "chromeos/network/host_resolver_impl_chromeos.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 base::MessageLoop io_message_loop_; | 149 base::MessageLoop io_message_loop_; |
| 150 net::BoundNetLog net_log_; | 150 net::BoundNetLog net_log_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(HostResolverImplChromeOSTest); | 152 DISALLOW_COPY_AND_ASSIGN(HostResolverImplChromeOSTest); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 TEST_F(HostResolverImplChromeOSTest, Resolve) { | 155 TEST_F(HostResolverImplChromeOSTest, Resolve) { |
| 156 net::HostResolver::RequestInfo info( | 156 net::HostResolver::RequestInfo info( |
| 157 net::HostPortPair(net::GetHostName(), 80)); | 157 net::HostPortPair(net::GetHostName(), 80)); |
| 158 info.set_address_family(net::ADDRESS_FAMILY_IPV4); | 158 info.set_address_family(net::ADDRESS_FAMILY_IPV4); |
| 159 info.set_is_my_ip_address(true); |
| 159 EXPECT_EQ(net::OK, CallResolve(info)); | 160 EXPECT_EQ(net::OK, CallResolve(info)); |
| 160 ASSERT_EQ(1u, addresses_.size()); | 161 ASSERT_EQ(1u, addresses_.size()); |
| 161 std::string expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); | 162 std::string expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); |
| 162 EXPECT_EQ(expected, addresses_[0].ToString()); | 163 EXPECT_EQ(expected, addresses_[0].ToString()); |
| 163 | 164 |
| 164 info.set_address_family(net::ADDRESS_FAMILY_IPV6); | 165 info.set_address_family(net::ADDRESS_FAMILY_IPV6); |
| 165 EXPECT_EQ(net::OK, CallResolve(info)); | 166 EXPECT_EQ(net::OK, CallResolve(info)); |
| 166 ASSERT_EQ(2u, addresses_.size()); | 167 ASSERT_EQ(2u, addresses_.size()); |
| 167 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); | 168 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); |
| 168 EXPECT_EQ(expected, addresses_[0].ToString()); | 169 EXPECT_EQ(expected, addresses_[0].ToString()); |
| 169 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); | 170 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); |
| 170 EXPECT_EQ(expected, addresses_[1].ToString()); | 171 EXPECT_EQ(expected, addresses_[1].ToString()); |
| 171 } | 172 } |
| OLD | NEW |