| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_network_functions.h" | 8 #include "chrome/browser/chromeos/cros/cros_network_functions.h" |
| 9 #include "chrome/browser/chromeos/cros/sms_watcher.h" | 9 #include "chrome/browser/chromeos/cros/sms_watcher.h" |
| 10 #include "chromeos/dbus/mock_cashew_client.h" | 10 #include "chromeos/dbus/mock_cashew_client.h" |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 } | 894 } |
| 895 | 895 |
| 896 TEST_F(CrosNetworkFunctionsTest, CrosSetOfflineMode) { | 896 TEST_F(CrosNetworkFunctionsTest, CrosSetOfflineMode) { |
| 897 const bool kOffline = true; | 897 const bool kOffline = true; |
| 898 const base::FundamentalValue value(kOffline); | 898 const base::FundamentalValue value(kOffline); |
| 899 EXPECT_CALL(*mock_manager_client_, SetProperty( | 899 EXPECT_CALL(*mock_manager_client_, SetProperty( |
| 900 flimflam::kOfflineModeProperty, IsEqualTo(&value), _, _)).Times(1); | 900 flimflam::kOfflineModeProperty, IsEqualTo(&value), _, _)).Times(1); |
| 901 CrosSetOfflineMode(kOffline); | 901 CrosSetOfflineMode(kOffline); |
| 902 } | 902 } |
| 903 | 903 |
| 904 TEST_F(CrosNetworkFunctionsTest, CrosListIPConfigs) { | 904 TEST_F(CrosNetworkFunctionsTest, CrosListIPConfigsAndBlock) { |
| 905 const std::string device_path = "/device/path"; | 905 const std::string device_path = "/device/path"; |
| 906 std::string ipconfig_path = "/ipconfig/path"; | 906 std::string ipconfig_path = "/ipconfig/path"; |
| 907 | 907 |
| 908 const IPConfigType kType = IPCONFIG_TYPE_DHCP; | 908 const IPConfigType kType = IPCONFIG_TYPE_DHCP; |
| 909 const std::string address = "address"; | 909 const std::string address = "address"; |
| 910 const int kMtu = 123; | 910 const int kMtu = 123; |
| 911 const int kPrefixlen = 24; | 911 const int kPrefixlen = 24; |
| 912 const std::string netmask = "255.255.255.0"; | 912 const std::string netmask = "255.255.255.0"; |
| 913 const std::string broadcast = "broadcast"; | 913 const std::string broadcast = "broadcast"; |
| 914 const std::string peer_address = "peer address"; | 914 const std::string peer_address = "peer address"; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 CallGetPropertiesAndBlock(dbus::ObjectPath(device_path))) | 963 CallGetPropertiesAndBlock(dbus::ObjectPath(device_path))) |
| 964 .WillOnce(Return(device_properties)); | 964 .WillOnce(Return(device_properties)); |
| 965 EXPECT_CALL(*mock_ipconfig_client_, | 965 EXPECT_CALL(*mock_ipconfig_client_, |
| 966 CallGetPropertiesAndBlock(dbus::ObjectPath(ipconfig_path))) | 966 CallGetPropertiesAndBlock(dbus::ObjectPath(ipconfig_path))) |
| 967 .WillOnce(Return(ipconfig_properties)); | 967 .WillOnce(Return(ipconfig_properties)); |
| 968 | 968 |
| 969 NetworkIPConfigVector result_ipconfigs; | 969 NetworkIPConfigVector result_ipconfigs; |
| 970 std::vector<std::string> result_ipconfig_paths; | 970 std::vector<std::string> result_ipconfig_paths; |
| 971 std::string result_hardware_address; | 971 std::string result_hardware_address; |
| 972 EXPECT_TRUE( | 972 EXPECT_TRUE( |
| 973 CrosListIPConfigs(device_path, &result_ipconfigs, &result_ipconfig_paths, | 973 CrosListIPConfigsAndBlock(device_path, |
| 974 &result_hardware_address)); | 974 &result_ipconfigs, |
| 975 &result_ipconfig_paths, |
| 976 &result_hardware_address)); |
| 975 | 977 |
| 976 EXPECT_EQ(hardware_address, result_hardware_address); | 978 EXPECT_EQ(hardware_address, result_hardware_address); |
| 977 ASSERT_EQ(1U, result_ipconfigs.size()); | 979 ASSERT_EQ(1U, result_ipconfigs.size()); |
| 978 EXPECT_EQ(device_path, result_ipconfigs[0].device_path); | 980 EXPECT_EQ(device_path, result_ipconfigs[0].device_path); |
| 979 EXPECT_EQ(kType, result_ipconfigs[0].type); | 981 EXPECT_EQ(kType, result_ipconfigs[0].type); |
| 980 EXPECT_EQ(address, result_ipconfigs[0].address); | 982 EXPECT_EQ(address, result_ipconfigs[0].address); |
| 981 EXPECT_EQ(netmask, result_ipconfigs[0].netmask); | 983 EXPECT_EQ(netmask, result_ipconfigs[0].netmask); |
| 982 EXPECT_EQ(gateway, result_ipconfigs[0].gateway); | 984 EXPECT_EQ(gateway, result_ipconfigs[0].gateway); |
| 983 EXPECT_EQ(name_servers, result_ipconfigs[0].name_servers); | 985 EXPECT_EQ(name_servers, result_ipconfigs[0].name_servers); |
| 984 ASSERT_EQ(1U, result_ipconfig_paths.size()); | 986 ASSERT_EQ(1U, result_ipconfig_paths.size()); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 EXPECT_EQ("192.0.0.0", CrosPrefixLengthToNetmask(2)); | 1164 EXPECT_EQ("192.0.0.0", CrosPrefixLengthToNetmask(2)); |
| 1163 EXPECT_EQ("128.0.0.0", CrosPrefixLengthToNetmask(1)); | 1165 EXPECT_EQ("128.0.0.0", CrosPrefixLengthToNetmask(1)); |
| 1164 EXPECT_EQ("0.0.0.0", CrosPrefixLengthToNetmask(0)); | 1166 EXPECT_EQ("0.0.0.0", CrosPrefixLengthToNetmask(0)); |
| 1165 // Invalid Prefix Lengths | 1167 // Invalid Prefix Lengths |
| 1166 EXPECT_EQ("", CrosPrefixLengthToNetmask(-1)); | 1168 EXPECT_EQ("", CrosPrefixLengthToNetmask(-1)); |
| 1167 EXPECT_EQ("", CrosPrefixLengthToNetmask(33)); | 1169 EXPECT_EQ("", CrosPrefixLengthToNetmask(33)); |
| 1168 EXPECT_EQ("", CrosPrefixLengthToNetmask(255)); | 1170 EXPECT_EQ("", CrosPrefixLengthToNetmask(255)); |
| 1169 } | 1171 } |
| 1170 | 1172 |
| 1171 } // namespace chromeos | 1173 } // namespace chromeos |
| OLD | NEW |