Chromium Code Reviews| Index: chromeos/dbus/shill_manager_client_stub.cc |
| diff --git a/chromeos/dbus/shill_manager_client_stub.cc b/chromeos/dbus/shill_manager_client_stub.cc |
| index d77dab6f33e550d307d5513d9034070e4461def8..c66d631a22cf8999734c1c1d096844c6ee9edacf 100644 |
| --- a/chromeos/dbus/shill_manager_client_stub.cc |
| +++ b/chromeos/dbus/shill_manager_client_stub.cc |
| @@ -39,7 +39,7 @@ struct ValueEquals { |
| } // namespace |
| ShillManagerClientStub::ShillManagerClientStub() |
| -: weak_ptr_factory_(this) { |
| + : weak_ptr_factory_(this) { |
| SetDefaultProperties(); |
| } |
| @@ -180,9 +180,6 @@ void ShillManagerClientStub::ConfigureService( |
| const base::DictionaryValue& properties, |
| const ObjectPathCallback& callback, |
| const ErrorCallback& error_callback) { |
| - if (callback.is_null()) |
| - return; |
| - |
| ShillServiceClient::TestInterface* service_client = |
| DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
| @@ -190,10 +187,13 @@ void ShillManagerClientStub::ConfigureService( |
| std::string type; |
| if (!properties.GetString(flimflam::kGuidProperty, &guid) || |
| !properties.GetString(flimflam::kTypeProperty, &type)) { |
| + LOG(ERROR) << "ConfugureService requies GUID and Type to be defined"; |
|
pneubeck (no reviews)
2013/05/07 08:46:39
ConfugureService -> ConfigureService
stevenjb
2013/05/08 01:57:22
Done.
|
| // If the properties aren't filled out completely, then just return an empty |
| // object path. |
| - MessageLoop::current()->PostTask( |
| - FROM_HERE, base::Bind(callback, dbus::ObjectPath())); |
| + if (!callback.is_null()) { |
| + MessageLoop::current()->PostTask( |
| + FROM_HERE, base::Bind(callback, dbus::ObjectPath())); |
| + } |
| return; |
| } |
| @@ -231,8 +231,10 @@ void ShillManagerClientStub::ConfigureService( |
| DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); |
| profile_test->AddService(service_path); |
| - MessageLoop::current()->PostTask( |
| - FROM_HERE, base::Bind(callback, dbus::ObjectPath(service_path))); |
| + if (!callback.is_null()) { |
| + MessageLoop::current()->PostTask( |
| + FROM_HERE, base::Bind(callback, dbus::ObjectPath(service_path))); |
| + } |
| } |
| void ShillManagerClientStub::ConfigureServiceForProfile( |
| @@ -332,13 +334,13 @@ void ShillManagerClientStub::ClearDevices() { |
| stub_properties_.Remove(flimflam::kDevicesProperty, NULL); |
| } |
| -void ShillManagerClientStub::ClearServices() { |
| +void ShillManagerClientStub::ClearManagerServices() { |
| stub_properties_.Remove(flimflam::kServicesProperty, NULL); |
| stub_properties_.Remove(flimflam::kServiceWatchListProperty, NULL); |
| } |
| -void ShillManagerClientStub::AddService(const std::string& service_path, |
| - bool add_to_watch_list) { |
| +void ShillManagerClientStub::AddManagerService(const std::string& service_path, |
| + bool add_to_watch_list) { |
| if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent( |
| base::Value::CreateStringValue(service_path))) { |
| CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| @@ -347,24 +349,28 @@ void ShillManagerClientStub::AddService(const std::string& service_path, |
| AddServiceToWatchList(service_path); |
| } |
| -void ShillManagerClientStub::AddServiceAtIndex(const std::string& service_path, |
| - size_t index, |
| - bool add_to_watch_list) { |
| +void ShillManagerClientStub::MoveServiceToIndex( |
| + const std::string& service_path, |
| + size_t index, |
| + bool add_to_watch_list) { |
| base::StringValue path_value(service_path); |
| - base::ListValue* service_list = |
| - GetListProperty(flimflam::kServicesProperty); |
| + base::ListValue* service_list = GetListProperty(flimflam::kServicesProperty); |
| base::ListValue::iterator iter = |
| std::find_if(service_list->begin(), service_list->end(), |
| ValueEquals(&path_value)); |
| - if (iter != service_list->end()) |
| - service_list->Erase(iter, NULL); |
| + if (iter == service_list->end()) { |
| + LOG(ERROR) << "Service not found to move: " << service_path; |
| + return; |
| + } |
| + service_list->Erase(iter, NULL); |
| service_list->Insert(index, path_value.DeepCopy()); |
| CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| if (add_to_watch_list) |
| AddServiceToWatchList(service_path); |
| } |
| -void ShillManagerClientStub::RemoveService(const std::string& service_path) { |
| +void ShillManagerClientStub::RemoveManagerService( |
| + const std::string& service_path) { |
| base::StringValue service_path_value(service_path); |
| if (GetListProperty(flimflam::kServicesProperty)->Remove( |
| service_path_value, NULL)) { |