| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 chromeos::DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( | 134 chromeos::DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( |
| 135 dbus::ObjectPath(path), | 135 dbus::ObjectPath(path), |
| 136 shill::kMethodProperty, | 136 shill::kMethodProperty, |
| 137 base::StringValue(method), | 137 base::StringValue(method), |
| 138 base::Bind(&DoNothingWithCallStatus)); | 138 base::Bind(&DoNothingWithCallStatus)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 std::unique_ptr<chromeos::NetworkStateHandler> network_state_handler_; | 141 std::unique_ptr<chromeos::NetworkStateHandler> network_state_handler_; |
| 142 std::unique_ptr<net::HostResolver> host_resolver_; | 142 std::unique_ptr<net::HostResolver> host_resolver_; |
| 143 base::MessageLoop io_message_loop_; | 143 base::MessageLoop io_message_loop_; |
| 144 net::BoundNetLog net_log_; | 144 net::NetLogWithSource net_log_; |
| 145 std::unique_ptr<net::HostResolver::Request> request_; | 145 std::unique_ptr<net::HostResolver::Request> request_; |
| 146 | 146 |
| 147 DISALLOW_COPY_AND_ASSIGN(HostResolverImplChromeOSTest); | 147 DISALLOW_COPY_AND_ASSIGN(HostResolverImplChromeOSTest); |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 TEST_F(HostResolverImplChromeOSTest, Resolve) { | 150 TEST_F(HostResolverImplChromeOSTest, Resolve) { |
| 151 net::HostResolver::RequestInfo info( | 151 net::HostResolver::RequestInfo info( |
| 152 net::HostPortPair(net::GetHostName(), 80)); | 152 net::HostPortPair(net::GetHostName(), 80)); |
| 153 info.set_address_family(net::ADDRESS_FAMILY_IPV4); | 153 info.set_address_family(net::ADDRESS_FAMILY_IPV4); |
| 154 info.set_is_my_ip_address(true); | 154 info.set_is_my_ip_address(true); |
| 155 EXPECT_EQ(net::OK, CallResolve(info)); | 155 EXPECT_EQ(net::OK, CallResolve(info)); |
| 156 ASSERT_EQ(1u, addresses_.size()); | 156 ASSERT_EQ(1u, addresses_.size()); |
| 157 std::string expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); | 157 std::string expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); |
| 158 EXPECT_EQ(expected, addresses_[0].ToString()); | 158 EXPECT_EQ(expected, addresses_[0].ToString()); |
| 159 | 159 |
| 160 info.set_address_family(net::ADDRESS_FAMILY_IPV6); | 160 info.set_address_family(net::ADDRESS_FAMILY_IPV6); |
| 161 EXPECT_EQ(net::OK, CallResolve(info)); | 161 EXPECT_EQ(net::OK, CallResolve(info)); |
| 162 ASSERT_EQ(2u, addresses_.size()); | 162 ASSERT_EQ(2u, addresses_.size()); |
| 163 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); | 163 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); |
| 164 EXPECT_EQ(expected, addresses_[0].ToString()); | 164 EXPECT_EQ(expected, addresses_[0].ToString()); |
| 165 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); | 165 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); |
| 166 EXPECT_EQ(expected, addresses_[1].ToString()); | 166 EXPECT_EQ(expected, addresses_[1].ToString()); |
| 167 } | 167 } |
| OLD | NEW |