| 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" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "chromeos/dbus/shill_device_client.h" | 16 #include "chromeos/dbus/shill_device_client.h" |
| 17 #include "chromeos/dbus/shill_ipconfig_client.h" | 17 #include "chromeos/dbus/shill_ipconfig_client.h" |
| 18 #include "chromeos/dbus/shill_service_client.h" | 18 #include "chromeos/dbus/shill_service_client.h" |
| 19 #include "chromeos/network/device_state.h" | 19 #include "chromeos/network/device_state.h" |
| 20 #include "chromeos/network/network_state.h" | 20 #include "chromeos/network/network_state.h" |
| 21 #include "chromeos/network/network_state_handler.h" | 21 #include "chromeos/network/network_state_handler.h" |
| 22 #include "dbus/object_path.h" | 22 #include "dbus/object_path.h" |
| 23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 24 #include "net/base/network_interfaces.h" | 24 #include "net/base/network_interfaces.h" |
| 25 #include "net/log/net_log_with_source.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 #include "third_party/cros_system_api/dbus/service_constants.h" | 27 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 const char kTestIPv4Address[] = "1.2.3.4"; | 31 const char kTestIPv4Address[] = "1.2.3.4"; |
| 31 const char kTestIPv6Address[] = "1:2:3:4:5:6:7:8"; | 32 const char kTestIPv6Address[] = "1:2:3:4:5:6:7:8"; |
| 32 | 33 |
| 33 void DoNothingWithCallStatus(chromeos::DBusMethodCallStatus call_status) {} | 34 void DoNothingWithCallStatus(chromeos::DBusMethodCallStatus call_status) {} |
| 34 void ErrorCallbackFunction(const std::string& error_name, | 35 void ErrorCallbackFunction(const std::string& error_name, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 EXPECT_EQ(expected, addresses_[0].ToString()); | 159 EXPECT_EQ(expected, addresses_[0].ToString()); |
| 159 | 160 |
| 160 info.set_address_family(net::ADDRESS_FAMILY_IPV6); | 161 info.set_address_family(net::ADDRESS_FAMILY_IPV6); |
| 161 EXPECT_EQ(net::OK, CallResolve(info)); | 162 EXPECT_EQ(net::OK, CallResolve(info)); |
| 162 ASSERT_EQ(2u, addresses_.size()); | 163 ASSERT_EQ(2u, addresses_.size()); |
| 163 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); | 164 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); |
| 164 EXPECT_EQ(expected, addresses_[0].ToString()); | 165 EXPECT_EQ(expected, addresses_[0].ToString()); |
| 165 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); | 166 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); |
| 166 EXPECT_EQ(expected, addresses_[1].ToString()); | 167 EXPECT_EQ(expected, addresses_[1].ToString()); |
| 167 } | 168 } |
| OLD | NEW |