| 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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   978   EXPECT_EQ(device_path, result_ipconfigs[0].device_path); |   978   EXPECT_EQ(device_path, result_ipconfigs[0].device_path); | 
|   979   EXPECT_EQ(kType, result_ipconfigs[0].type); |   979   EXPECT_EQ(kType, result_ipconfigs[0].type); | 
|   980   EXPECT_EQ(address, result_ipconfigs[0].address); |   980   EXPECT_EQ(address, result_ipconfigs[0].address); | 
|   981   EXPECT_EQ(netmask, result_ipconfigs[0].netmask); |   981   EXPECT_EQ(netmask, result_ipconfigs[0].netmask); | 
|   982   EXPECT_EQ(gateway, result_ipconfigs[0].gateway); |   982   EXPECT_EQ(gateway, result_ipconfigs[0].gateway); | 
|   983   EXPECT_EQ(name_servers, result_ipconfigs[0].name_servers); |   983   EXPECT_EQ(name_servers, result_ipconfigs[0].name_servers); | 
|   984   ASSERT_EQ(1U, result_ipconfig_paths.size()); |   984   ASSERT_EQ(1U, result_ipconfig_paths.size()); | 
|   985   EXPECT_EQ(ipconfig_path, result_ipconfig_paths[0]); |   985   EXPECT_EQ(ipconfig_path, result_ipconfig_paths[0]); | 
|   986 } |   986 } | 
|   987  |   987  | 
|   988 TEST_F(CrosNetworkFunctionsTest, CrosAddIPConfig) { |  | 
|   989   const std::string device_path = "/device/path"; |  | 
|   990   const dbus::ObjectPath result_path("/result/path"); |  | 
|   991   EXPECT_CALL(*mock_device_client_, |  | 
|   992               CallAddIPConfigAndBlock(dbus::ObjectPath(device_path), |  | 
|   993                                       flimflam::kTypeDHCP)) |  | 
|   994       .WillOnce(Return(result_path)); |  | 
|   995   EXPECT_TRUE(CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP)); |  | 
|   996 } |  | 
|   997  |  | 
|   998 TEST_F(CrosNetworkFunctionsTest, CrosRemoveIPConfig) { |  | 
|   999   const std::string path = "/path"; |  | 
|  1000   EXPECT_CALL(*mock_ipconfig_client_, |  | 
|  1001               CallRemoveAndBlock(dbus::ObjectPath(path))).Times(1); |  | 
|  1002   CrosRemoveIPConfig(path); |  | 
|  1003 } |  | 
|  1004  |  | 
|  1005 TEST_F(CrosNetworkFunctionsTest, CrosGetWifiAccessPoints) { |   988 TEST_F(CrosNetworkFunctionsTest, CrosGetWifiAccessPoints) { | 
|  1006   const std::string device_path = "/device/path"; |   989   const std::string device_path = "/device/path"; | 
|  1007   base::ListValue* devices = new base::ListValue; |   990   base::ListValue* devices = new base::ListValue; | 
|  1008   devices->Append(base::Value::CreateStringValue(device_path)); |   991   devices->Append(base::Value::CreateStringValue(device_path)); | 
|  1009   base::DictionaryValue* manager_properties = new base::DictionaryValue; |   992   base::DictionaryValue* manager_properties = new base::DictionaryValue; | 
|  1010   manager_properties->SetWithoutPathExpansion( |   993   manager_properties->SetWithoutPathExpansion( | 
|  1011       flimflam::kDevicesProperty, devices); |   994       flimflam::kDevicesProperty, devices); | 
|  1012  |   995  | 
|  1013   const int kScanInterval = 42; |   996   const int kScanInterval = 42; | 
|  1014   const std::string network_path = "/network/path"; |   997   const std::string network_path = "/network/path"; | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1162   EXPECT_EQ("192.0.0.0", CrosPrefixLengthToNetmask(2)); |  1145   EXPECT_EQ("192.0.0.0", CrosPrefixLengthToNetmask(2)); | 
|  1163   EXPECT_EQ("128.0.0.0", CrosPrefixLengthToNetmask(1)); |  1146   EXPECT_EQ("128.0.0.0", CrosPrefixLengthToNetmask(1)); | 
|  1164   EXPECT_EQ("0.0.0.0", CrosPrefixLengthToNetmask(0)); |  1147   EXPECT_EQ("0.0.0.0", CrosPrefixLengthToNetmask(0)); | 
|  1165   // Invalid Prefix Lengths |  1148   // Invalid Prefix Lengths | 
|  1166   EXPECT_EQ("", CrosPrefixLengthToNetmask(-1)); |  1149   EXPECT_EQ("", CrosPrefixLengthToNetmask(-1)); | 
|  1167   EXPECT_EQ("", CrosPrefixLengthToNetmask(33)); |  1150   EXPECT_EQ("", CrosPrefixLengthToNetmask(33)); | 
|  1168   EXPECT_EQ("", CrosPrefixLengthToNetmask(255)); |  1151   EXPECT_EQ("", CrosPrefixLengthToNetmask(255)); | 
|  1169 } |  1152 } | 
|  1170  |  1153  | 
|  1171 }  // namespace chromeos |  1154 }  // namespace chromeos | 
| OLD | NEW |