diff options
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/fake_shill_manager_client.cc | 4 | ||||
-rw-r--r-- | chromeos/dbus/fake_shill_manager_client.h | 1 | ||||
-rw-r--r-- | chromeos/dbus/mock_shill_device_client.h | 2 | ||||
-rw-r--r-- | chromeos/dbus/mock_shill_manager_client.h | 1 | ||||
-rw-r--r-- | chromeos/dbus/shill_device_client.cc | 8 | ||||
-rw-r--r-- | chromeos/dbus/shill_device_client.h | 9 | ||||
-rw-r--r-- | chromeos/dbus/shill_device_client_stub.cc | 8 | ||||
-rw-r--r-- | chromeos/dbus/shill_device_client_stub.h | 2 | ||||
-rw-r--r-- | chromeos/dbus/shill_device_client_unittest.cc | 28 | ||||
-rw-r--r-- | chromeos/dbus/shill_manager_client.cc | 6 | ||||
-rw-r--r-- | chromeos/dbus/shill_manager_client.h | 8 | ||||
-rw-r--r-- | chromeos/dbus/shill_manager_client_stub.cc | 4 | ||||
-rw-r--r-- | chromeos/dbus/shill_manager_client_stub.h | 1 | ||||
-rw-r--r-- | chromeos/dbus/shill_manager_client_unittest.cc | 27 | ||||
-rw-r--r-- | chromeos/network/cros_network_functions.cc | 38 | ||||
-rw-r--r-- | chromeos/network/cros_network_functions.h | 12 | ||||
-rw-r--r-- | chromeos/network/cros_network_functions_unittest.cc | 86 |
17 files changed, 0 insertions, 245 deletions
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc index affdef37..35b256a 100644 --- a/chromeos/dbus/fake_shill_manager_client.cc +++ b/chromeos/dbus/fake_shill_manager_client.cc @@ -46,10 +46,6 @@ void FakeShillManagerClient::GetService(const base::DictionaryValue& properties, const ErrorCallback& error_callback) { } -base::DictionaryValue* FakeShillManagerClient::CallGetPropertiesAndBlock() { - return NULL; -} - void FakeShillManagerClient::AddPropertyChangedObserver( ShillPropertyChangedObserver* observer) { } diff --git a/chromeos/dbus/fake_shill_manager_client.h b/chromeos/dbus/fake_shill_manager_client.h index 9aa1c9d..2a1c0e72 100644 --- a/chromeos/dbus/fake_shill_manager_client.h +++ b/chromeos/dbus/fake_shill_manager_client.h @@ -23,7 +23,6 @@ class FakeShillManagerClient : public ShillManagerClient { virtual void RemovePropertyChangedObserver( ShillPropertyChangedObserver* observer) OVERRIDE; virtual void GetProperties(const DictionaryValueCallback& callback) OVERRIDE; - virtual base::DictionaryValue* CallGetPropertiesAndBlock() OVERRIDE; virtual void GetNetworksForGeolocation( const DictionaryValueCallback& callback) OVERRIDE; virtual void SetProperty(const std::string& name, diff --git a/chromeos/dbus/mock_shill_device_client.h b/chromeos/dbus/mock_shill_device_client.h index 3f2a2db..eef766f 100644 --- a/chromeos/dbus/mock_shill_device_client.h +++ b/chromeos/dbus/mock_shill_device_client.h @@ -26,8 +26,6 @@ class MockShillDeviceClient : public ShillDeviceClient { ShillPropertyChangedObserver* observer)); MOCK_METHOD2(GetProperties, void(const dbus::ObjectPath& device_path, const DictionaryValueCallback& callback)); - MOCK_METHOD1(CallGetPropertiesAndBlock, - base::DictionaryValue*(const dbus::ObjectPath& device_path)); MOCK_METHOD2(ProposeScan, void(const dbus::ObjectPath& device_path, const VoidDBusMethodCallback& callback)); MOCK_METHOD5(SetProperty, void(const dbus::ObjectPath& device_path, diff --git a/chromeos/dbus/mock_shill_manager_client.h b/chromeos/dbus/mock_shill_manager_client.h index 8f7fe3e..b62aebd 100644 --- a/chromeos/dbus/mock_shill_manager_client.h +++ b/chromeos/dbus/mock_shill_manager_client.h @@ -22,7 +22,6 @@ class MockShillManagerClient : public ShillManagerClient { MOCK_METHOD1(RemovePropertyChangedObserver, void(ShillPropertyChangedObserver* observer)); MOCK_METHOD1(GetProperties, void(const DictionaryValueCallback& callback)); - MOCK_METHOD0(CallGetPropertiesAndBlock, base::DictionaryValue*()); MOCK_METHOD1(GetNetworksForGeolocation, void(const DictionaryValueCallback& callback)); MOCK_METHOD4(SetProperty, void(const std::string& name, diff --git a/chromeos/dbus/shill_device_client.cc b/chromeos/dbus/shill_device_client.cc index 69dde4f..07e2a15 100644 --- a/chromeos/dbus/shill_device_client.cc +++ b/chromeos/dbus/shill_device_client.cc @@ -62,14 +62,6 @@ class ShillDeviceClientImpl : public ShillDeviceClient { GetHelper(device_path)->CallDictionaryValueMethod(&method_call, callback); } - virtual base::DictionaryValue* CallGetPropertiesAndBlock( - const dbus::ObjectPath& device_path) OVERRIDE { - dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, - flimflam::kGetPropertiesFunction); - return GetHelper(device_path)->CallDictionaryValueMethodAndBlock( - &method_call); - } - virtual void ProposeScan(const dbus::ObjectPath& device_path, const VoidDBusMethodCallback& callback) OVERRIDE { dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, diff --git a/chromeos/dbus/shill_device_client.h b/chromeos/dbus/shill_device_client.h index 6a3fb35..2047059 100644 --- a/chromeos/dbus/shill_device_client.h +++ b/chromeos/dbus/shill_device_client.h @@ -80,15 +80,6 @@ class CHROMEOS_EXPORT ShillDeviceClient { virtual void GetProperties(const dbus::ObjectPath& device_path, const DictionaryValueCallback& callback) = 0; - // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the - // method call finishes. The caller is responsible to delete the result. - // Thie method returns NULL when method call fails. - // - // TODO(hashimoto): Refactor CrosGetDeviceNetworkList and remove this method. - // crosbug.com/29902 - virtual base::DictionaryValue* CallGetPropertiesAndBlock( - const dbus::ObjectPath& device_path) = 0; - // Calls ProposeScan method. // |callback| is called after the method call finishes. virtual void ProposeScan(const dbus::ObjectPath& device_path, diff --git a/chromeos/dbus/shill_device_client_stub.cc b/chromeos/dbus/shill_device_client_stub.cc index 4e63fb4..674b558 100644 --- a/chromeos/dbus/shill_device_client_stub.cc +++ b/chromeos/dbus/shill_device_client_stub.cc @@ -64,14 +64,6 @@ void ShillDeviceClientStub::GetProperties( device_path, callback)); } -base::DictionaryValue* ShillDeviceClientStub::CallGetPropertiesAndBlock( - const dbus::ObjectPath& device_path){ - base::DictionaryValue* device_properties = NULL; - stub_devices_.GetDictionaryWithoutPathExpansion( - device_path.value(), &device_properties); - return device_properties; -} - void ShillDeviceClientStub::ProposeScan(const dbus::ObjectPath& device_path, const VoidDBusMethodCallback& callback){ PostVoidCallback(callback, DBUS_METHOD_CALL_SUCCESS); diff --git a/chromeos/dbus/shill_device_client_stub.h b/chromeos/dbus/shill_device_client_stub.h index cc7edf2..8038cc7 100644 --- a/chromeos/dbus/shill_device_client_stub.h +++ b/chromeos/dbus/shill_device_client_stub.h @@ -29,8 +29,6 @@ class ShillDeviceClientStub : public ShillDeviceClient, ShillPropertyChangedObserver* observer) OVERRIDE; virtual void GetProperties(const dbus::ObjectPath& device_path, const DictionaryValueCallback& callback) OVERRIDE; - virtual base::DictionaryValue* CallGetPropertiesAndBlock( - const dbus::ObjectPath& device_path) OVERRIDE; virtual void ProposeScan(const dbus::ObjectPath& device_path, const VoidDBusMethodCallback& callback) OVERRIDE; diff --git a/chromeos/dbus/shill_device_client_unittest.cc b/chromeos/dbus/shill_device_client_unittest.cc index b6c25b5..4149b17 100644 --- a/chromeos/dbus/shill_device_client_unittest.cc +++ b/chromeos/dbus/shill_device_client_unittest.cc @@ -140,34 +140,6 @@ TEST_F(ShillDeviceClientTest, GetProperties) { message_loop_.RunUntilIdle(); } -TEST_F(ShillDeviceClientTest, CallGetPropertiesAndBlock) { - const bool kValue = true; - // Create response. - scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); - dbus::MessageWriter writer(response.get()); - dbus::MessageWriter array_writer(NULL); - writer.OpenArray("{sv}", &array_writer); - dbus::MessageWriter entry_writer(NULL); - array_writer.OpenDictEntry(&entry_writer); - entry_writer.AppendString(flimflam::kCellularAllowRoamingProperty); - entry_writer.AppendVariantOfBool(kValue); - array_writer.CloseContainer(&entry_writer); - writer.CloseContainer(&array_writer); - - // Set expectations. - base::DictionaryValue value; - value.SetWithoutPathExpansion(flimflam::kCellularAllowRoamingProperty, - base::Value::CreateBooleanValue(kValue)); - PrepareForMethodCall(flimflam::kGetPropertiesFunction, - base::Bind(&ExpectNoArgument), - response.get()); - // Call method. - scoped_ptr<base::DictionaryValue> result( - client_->CallGetPropertiesAndBlock(dbus::ObjectPath(kExampleDevicePath))); - ASSERT_TRUE(result.get()); - EXPECT_TRUE(result->Equals(&value)); -} - TEST_F(ShillDeviceClientTest, ProposeScan) { // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); diff --git a/chromeos/dbus/shill_manager_client.cc b/chromeos/dbus/shill_manager_client.cc index a20102d..544153e 100644 --- a/chromeos/dbus/shill_manager_client.cc +++ b/chromeos/dbus/shill_manager_client.cc @@ -68,12 +68,6 @@ class ShillManagerClientImpl : public ShillManagerClient { helper_.CallDictionaryValueMethod(&method_call, callback); } - virtual base::DictionaryValue* CallGetPropertiesAndBlock() OVERRIDE { - dbus::MethodCall method_call(flimflam::kFlimflamManagerInterface, - flimflam::kGetPropertiesFunction); - return helper_.CallDictionaryValueMethodAndBlock(&method_call); - } - virtual void GetNetworksForGeolocation( const DictionaryValueCallback& callback) OVERRIDE { dbus::MethodCall method_call(flimflam::kFlimflamManagerInterface, diff --git a/chromeos/dbus/shill_manager_client.h b/chromeos/dbus/shill_manager_client.h index 0a2b9b06..8480e7a 100644 --- a/chromeos/dbus/shill_manager_client.h +++ b/chromeos/dbus/shill_manager_client.h @@ -126,14 +126,6 @@ class CHROMEOS_EXPORT ShillManagerClient { // |callback| is called after the method call succeeds. virtual void GetProperties(const DictionaryValueCallback& callback) = 0; - // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the - // method call finishes. The caller is responsible to delete the result. - // Thie method returns NULL when method call fails. - // - // TODO(hashimoto): Refactor blocking calls and remove this method. - // crosbug.com/29902 - virtual base::DictionaryValue* CallGetPropertiesAndBlock() = 0; - // Calls GetNetworksForGeolocation method. // |callback| is called after the method call succeeds. virtual void GetNetworksForGeolocation( diff --git a/chromeos/dbus/shill_manager_client_stub.cc b/chromeos/dbus/shill_manager_client_stub.cc index 36f02939..121cc8e 100644 --- a/chromeos/dbus/shill_manager_client_stub.cc +++ b/chromeos/dbus/shill_manager_client_stub.cc @@ -67,10 +67,6 @@ void ShillManagerClientStub::GetProperties( callback)); } -base::DictionaryValue* ShillManagerClientStub::CallGetPropertiesAndBlock() { - return stub_properties_.DeepCopy(); -} - void ShillManagerClientStub::GetNetworksForGeolocation( const DictionaryValueCallback& callback) { if (callback.is_null()) diff --git a/chromeos/dbus/shill_manager_client_stub.h b/chromeos/dbus/shill_manager_client_stub.h index 569dd4f..bd99eef 100644 --- a/chromeos/dbus/shill_manager_client_stub.h +++ b/chromeos/dbus/shill_manager_client_stub.h @@ -28,7 +28,6 @@ class ShillManagerClientStub : public ShillManagerClient, virtual void RemovePropertyChangedObserver( ShillPropertyChangedObserver* observer) OVERRIDE; virtual void GetProperties(const DictionaryValueCallback& callback) OVERRIDE; - virtual base::DictionaryValue* CallGetPropertiesAndBlock() OVERRIDE; virtual void GetNetworksForGeolocation( const DictionaryValueCallback& callback) OVERRIDE; virtual void SetProperty(const std::string& name, diff --git a/chromeos/dbus/shill_manager_client_unittest.cc b/chromeos/dbus/shill_manager_client_unittest.cc index ad5b6a0..e0d0db1 100644 --- a/chromeos/dbus/shill_manager_client_unittest.cc +++ b/chromeos/dbus/shill_manager_client_unittest.cc @@ -211,33 +211,6 @@ TEST_F(ShillManagerClientTest, GetProperties) { message_loop_.RunUntilIdle(); } -TEST_F(ShillManagerClientTest, CallGetPropertiesAndBlock) { - // Create response. - scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); - dbus::MessageWriter writer(response.get()); - dbus::MessageWriter array_writer(NULL); - writer.OpenArray("{sv}", &array_writer); - dbus::MessageWriter entry_writer(NULL); - array_writer.OpenDictEntry(&entry_writer); - entry_writer.AppendString(flimflam::kOfflineModeProperty); - entry_writer.AppendVariantOfBool(true); - array_writer.CloseContainer(&entry_writer); - writer.CloseContainer(&array_writer); - - // Create the expected value. - base::DictionaryValue value; - value.SetWithoutPathExpansion(flimflam::kOfflineModeProperty, - base::Value::CreateBooleanValue(true)); - // Set expectations. - PrepareForMethodCall(flimflam::kGetPropertiesFunction, - base::Bind(&ExpectNoArgument), - response.get()); - // Call method. - scoped_ptr<base::DictionaryValue> result( - client_->CallGetPropertiesAndBlock()); - EXPECT_TRUE(value.Equals(result.get())); -} - TEST_F(ShillManagerClientTest, GetNetworksForGeolocation) { // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); diff --git a/chromeos/network/cros_network_functions.cc b/chromeos/network/cros_network_functions.cc index 68f3d2e..ea3c09a 100644 --- a/chromeos/network/cros_network_functions.cc +++ b/chromeos/network/cros_network_functions.cc @@ -611,44 +611,6 @@ void CrosListIPConfigs(const std::string& device_path, base::Bind(&ListIPConfigsCallback, callback, device_path)); } -bool CrosListIPConfigsAndBlock(const std::string& device_path, - NetworkIPConfigVector* ipconfig_vector, - std::vector<std::string>* ipconfig_paths, - std::string* hardware_address) { - if (hardware_address) - hardware_address->clear(); - const dbus::ObjectPath device_object_path(device_path); - ShillDeviceClient* device_client = - DBusThreadManager::Get()->GetShillDeviceClient(); - // TODO(hashimoto): Remove this blocking D-Bus method call. - // crosbug.com/29902 - scoped_ptr<base::DictionaryValue> properties( - device_client->CallGetPropertiesAndBlock(device_object_path)); - if (!properties.get()) - return false; - - base::ListValue* ips = NULL; - if (!properties->GetListWithoutPathExpansion( - flimflam::kIPConfigsProperty, &ips)) - return false; - - for (size_t i = 0; i < ips->GetSize(); i++) { - std::string ipconfig_path; - if (!ips->GetString(i, &ipconfig_path)) { - LOG(WARNING) << "Found NULL ip for device " << device_path; - continue; - } - ParseIPConfig(device_path, ipconfig_path, ipconfig_vector); - if (ipconfig_paths) - ipconfig_paths->push_back(ipconfig_path); - } - // Store the hardware address as well. - if (hardware_address) - properties->GetStringWithoutPathExpansion(flimflam::kAddressProperty, - hardware_address); - return true; -} - void CrosRequestIPConfigRefresh(const std::string& ipconfig_path) { DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh( dbus::ObjectPath(ipconfig_path), diff --git a/chromeos/network/cros_network_functions.h b/chromeos/network/cros_network_functions.h index 09fafc1..997f060 100644 --- a/chromeos/network/cros_network_functions.h +++ b/chromeos/network/cros_network_functions.h @@ -239,18 +239,6 @@ CHROMEOS_EXPORT void CrosListIPConfigs( const std::string& device_path, const NetworkGetIPConfigsCallback& callback); -// DEPRECATED, DO NOT USE: Use the asynchronous CrosListIPConfigs, above, -// instead. -// Gets a list of all the NetworkIPConfigs using a given device path. -// Optionally, you can get ipconfig-paths and the hardware address. Pass NULL as -// |ipconfig_paths| and |hardware_address| if you are not interested in these -// values. -CHROMEOS_EXPORT bool CrosListIPConfigsAndBlock( - const std::string& device_path, - NetworkIPConfigVector* ipconfig_vector, - std::vector<std::string>* ipconfig_paths, - std::string* hardware_address); - // Refreshes the IP config |ipconfig_path| to pick up changes in // configuration, and renew the DHCP lease, if any. CHROMEOS_EXPORT void CrosRequestIPConfigRefresh( diff --git a/chromeos/network/cros_network_functions_unittest.cc b/chromeos/network/cros_network_functions_unittest.cc index f14bc42..bd75344 100644 --- a/chromeos/network/cros_network_functions_unittest.cc +++ b/chromeos/network/cros_network_functions_unittest.cc @@ -782,92 +782,6 @@ TEST_F(CrosNetworkFunctionsTest, CrosSetOfflineMode) { CrosSetOfflineMode(kOffline); } -TEST_F(CrosNetworkFunctionsTest, CrosListIPConfigsAndBlock) { - const std::string device_path = "/device/path"; - std::string ipconfig_path = "/ipconfig/path"; - - const IPConfigType kType = IPCONFIG_TYPE_DHCP; - const std::string address = "address"; - const int kMtu = 123; - const int kPrefixlen = 24; - const std::string netmask = "255.255.255.0"; - const std::string broadcast = "broadcast"; - const std::string peer_address = "peer address"; - const std::string gateway = "gateway"; - const std::string domainname = "domainname"; - const std::string name_server1 = "nameserver1"; - const std::string name_server2 = "nameserver2"; - const std::string name_servers = name_server1 + "," + name_server2; - const std::string hardware_address = "hardware address"; - - base::ListValue* ipconfigs = new base::ListValue; - ipconfigs->Append(new base::StringValue(ipconfig_path)); - base::DictionaryValue* device_properties = new base::DictionaryValue; - device_properties->SetWithoutPathExpansion( - flimflam::kIPConfigsProperty, ipconfigs); - device_properties->SetWithoutPathExpansion( - flimflam::kAddressProperty, - new base::StringValue(hardware_address)); - - base::ListValue* name_servers_list = new base::ListValue; - name_servers_list->Append(new base::StringValue(name_server1)); - name_servers_list->Append(new base::StringValue(name_server2)); - base::DictionaryValue* ipconfig_properties = new base::DictionaryValue; - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kMethodProperty, - new base::StringValue(flimflam::kTypeDHCP)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kAddressProperty, - new base::StringValue(address)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kMtuProperty, - base::Value::CreateIntegerValue(kMtu)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kPrefixlenProperty, - base::Value::CreateIntegerValue(kPrefixlen)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kBroadcastProperty, - new base::StringValue(broadcast)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kPeerAddressProperty, - new base::StringValue(peer_address)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kGatewayProperty, - new base::StringValue(gateway)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kDomainNameProperty, - new base::StringValue(domainname)); - ipconfig_properties->SetWithoutPathExpansion( - flimflam::kNameServersProperty, name_servers_list); - - EXPECT_CALL(*mock_device_client_, - CallGetPropertiesAndBlock(dbus::ObjectPath(device_path))) - .WillOnce(Return(device_properties)); - EXPECT_CALL(*mock_ipconfig_client_, - CallGetPropertiesAndBlock(dbus::ObjectPath(ipconfig_path))) - .WillOnce(Return(ipconfig_properties)); - - NetworkIPConfigVector result_ipconfigs; - std::vector<std::string> result_ipconfig_paths; - std::string result_hardware_address; - EXPECT_TRUE( - CrosListIPConfigsAndBlock(device_path, - &result_ipconfigs, - &result_ipconfig_paths, - &result_hardware_address)); - - EXPECT_EQ(hardware_address, result_hardware_address); - ASSERT_EQ(1U, result_ipconfigs.size()); - EXPECT_EQ(device_path, result_ipconfigs[0].device_path); - EXPECT_EQ(kType, result_ipconfigs[0].type); - EXPECT_EQ(address, result_ipconfigs[0].address); - EXPECT_EQ(netmask, result_ipconfigs[0].netmask); - EXPECT_EQ(gateway, result_ipconfigs[0].gateway); - EXPECT_EQ(name_servers, result_ipconfigs[0].name_servers); - ASSERT_EQ(1U, result_ipconfig_paths.size()); - EXPECT_EQ(ipconfig_path, result_ipconfig_paths[0]); -} - TEST_F(CrosNetworkFunctionsTest, CrosConfigureService) { const std::string key1 = "key1"; const std::string string1 = "string1"; |