| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "extensions/browser/api/system_network/system_network_api.h" | 5 #include "extensions/browser/api/system_network/system_network_api.h" |
| 6 #include "extensions/browser/api_test_utils.h" | 6 #include "extensions/browser/api_test_utils.h" |
| 7 #include "extensions/browser/api_unittest.h" | 7 #include "extensions/browser/api_unittest.h" |
| 8 #include "extensions/common/test_util.h" | 8 #include "extensions/common/test_util.h" |
| 9 | 9 |
| 10 using extensions::api_test_utils::RunFunctionAndReturnSingleResult; | 10 using extensions::api_test_utils::RunFunctionAndReturnSingleResult; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 socket_function.get(), "[]", browser_context())); | 32 socket_function.get(), "[]", browser_context())); |
| 33 ASSERT_EQ(base::Value::Type::LIST, result->GetType()); | 33 ASSERT_EQ(base::Value::Type::LIST, result->GetType()); |
| 34 | 34 |
| 35 // All we can confirm is that we have at least one address, but not what it | 35 // All we can confirm is that we have at least one address, but not what it |
| 36 // is. | 36 // is. |
| 37 base::ListValue* value = static_cast<base::ListValue*>(result.get()); | 37 base::ListValue* value = static_cast<base::ListValue*>(result.get()); |
| 38 ASSERT_TRUE(value->GetSize() > 0); | 38 ASSERT_TRUE(value->GetSize() > 0); |
| 39 | 39 |
| 40 for (const auto& network_interface_value : *value) { | 40 for (const auto& network_interface_value : *value) { |
| 41 NetworkInterface network_interface; | 41 NetworkInterface network_interface; |
| 42 ASSERT_TRUE(NetworkInterface::Populate(network_interface_value, | 42 ASSERT_TRUE(NetworkInterface::Populate(*network_interface_value, |
| 43 &network_interface)); | 43 &network_interface)); |
| 44 | 44 |
| 45 LOG(INFO) << "Network interface: address=" << network_interface.address | 45 LOG(INFO) << "Network interface: address=" << network_interface.address |
| 46 << ", name=" << network_interface.name | 46 << ", name=" << network_interface.name |
| 47 << ", prefix length=" << network_interface.prefix_length; | 47 << ", prefix length=" << network_interface.prefix_length; |
| 48 ASSERT_NE(std::string(), network_interface.address); | 48 ASSERT_NE(std::string(), network_interface.address); |
| 49 ASSERT_NE(std::string(), network_interface.name); | 49 ASSERT_NE(std::string(), network_interface.name); |
| 50 ASSERT_LE(0, network_interface.prefix_length); | 50 ASSERT_LE(0, network_interface.prefix_length); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace extensions | 54 } // namespace extensions |
| OLD | NEW |