Index: chromeos/dbus/fake_shill_manager_client.cc |
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc |
index d3ad56641aa07e74879092b1a6ad95559420655a..b3f22b897fa4fdef5d8707330afa9ca37f08e3f5 100644 |
--- a/chromeos/dbus/fake_shill_manager_client.cc |
+++ b/chromeos/dbus/fake_shill_manager_client.cc |
@@ -5,10 +5,8 @@ |
#include "chromeos/dbus/fake_shill_manager_client.h" |
#include "base/bind.h" |
-#include "base/command_line.h" |
#include "base/message_loop/message_loop.h" |
#include "base/values.h" |
-#include "chromeos/chromeos_switches.h" |
#include "chromeos/dbus/dbus_thread_manager.h" |
#include "chromeos/dbus/shill_device_client.h" |
#include "chromeos/dbus/shill_profile_client.h" |
@@ -45,7 +43,8 @@ void AppendServicesForType( |
ShillServiceClient::TestInterface* service_client = |
DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
for (base::ListValue::const_iterator iter = service_list_in->begin(); |
- iter != service_list_in->end(); ++iter) { |
+ iter != service_list_in->end(); |
+ ++iter) { |
std::string service_path; |
if (!(*iter)->GetAsString(&service_path)) |
continue; |
@@ -61,10 +60,8 @@ void AppendServicesForType( |
continue; |
std::string state; |
properties->GetString(shill::kStateProperty, &state); |
- if (state == shill::kStateOnline || |
- state == shill::kStateAssociation || |
- state == shill::kStateConfiguration || |
- state == shill::kStatePortal || |
+ if (state == shill::kStateOnline || state == shill::kStateAssociation || |
+ state == shill::kStateConfiguration || state == shill::kStatePortal || |
state == shill::kStateReady) { |
active_service_list_out->push_back(service_path); |
} else { |
@@ -75,9 +72,7 @@ void AppendServicesForType( |
} // namespace |
-FakeShillManagerClient::FakeShillManagerClient() |
- : weak_ptr_factory_(this) { |
-} |
+FakeShillManagerClient::FakeShillManagerClient() : weak_ptr_factory_(this) {} |
FakeShillManagerClient::~FakeShillManagerClient() {} |
@@ -98,19 +93,19 @@ void FakeShillManagerClient::RemovePropertyChangedObserver( |
void FakeShillManagerClient::GetProperties( |
const DictionaryValueCallback& callback) { |
base::MessageLoop::current()->PostTask( |
- FROM_HERE, base::Bind( |
- &FakeShillManagerClient::PassStubProperties, |
- weak_ptr_factory_.GetWeakPtr(), |
- callback)); |
+ FROM_HERE, |
+ base::Bind(&FakeShillManagerClient::PassStubProperties, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ callback)); |
} |
void FakeShillManagerClient::GetNetworksForGeolocation( |
const DictionaryValueCallback& callback) { |
base::MessageLoop::current()->PostTask( |
- FROM_HERE, base::Bind( |
- &FakeShillManagerClient::PassStubGeoNetworks, |
- weak_ptr_factory_.GetWeakPtr(), |
- callback)); |
+ FROM_HERE, |
+ base::Bind(&FakeShillManagerClient::PassStubGeoNetworks, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ callback)); |
} |
void FakeShillManagerClient::SetProperty(const std::string& name, |
@@ -118,7 +113,7 @@ void FakeShillManagerClient::SetProperty(const std::string& name, |
const base::Closure& callback, |
const ErrorCallback& error_callback) { |
stub_properties_.SetWithoutPathExpansion(name, value.DeepCopy()); |
- CallNotifyObserversPropertyChanged(name, 0); |
+ CallNotifyObserversPropertyChanged(name); |
base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
} |
@@ -133,20 +128,17 @@ void FakeShillManagerClient::RequestScan(const std::string& type, |
DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); |
std::string device_path = device_client->GetDevicePathForType(device_type); |
if (!device_path.empty()) { |
- device_client->SetDeviceProperty(device_path, |
- shill::kScanningProperty, |
- base::FundamentalValue(true)); |
- } |
- const int kScanDurationSeconds = 3; |
- int scan_duration_seconds = kScanDurationSeconds; |
- if (!CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableStubInteractive)) { |
- scan_duration_seconds = 0; |
+ device_client->SetDeviceProperty( |
+ device_path, shill::kScanningProperty, base::FundamentalValue(true)); |
} |
+ int scan_duration_seconds = |
+ DBusThreadManager::Get()->GetShillInteractiveDelay(); |
base::MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&FakeShillManagerClient::ScanCompleted, |
- weak_ptr_factory_.GetWeakPtr(), device_path, callback), |
+ weak_ptr_factory_.GetWeakPtr(), |
+ device_path, |
+ callback), |
base::TimeDelta::FromSeconds(scan_duration_seconds)); |
} |
@@ -156,21 +148,23 @@ void FakeShillManagerClient::EnableTechnology( |
const ErrorCallback& error_callback) { |
base::ListValue* enabled_list = NULL; |
if (!stub_properties_.GetListWithoutPathExpansion( |
- shill::kEnabledTechnologiesProperty, &enabled_list)) { |
+ shill::kEnabledTechnologiesProperty, &enabled_list)) { |
base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
base::MessageLoop::current()->PostTask( |
FROM_HERE, |
base::Bind(error_callback, "StubError", "Property not found")); |
return; |
} |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableStubInteractive)) { |
- const int kEnableTechnologyDelaySeconds = 3; |
+ int interactive_delay = DBusThreadManager::Get()->GetShillInteractiveDelay(); |
+ if (interactive_delay) { |
base::MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&FakeShillManagerClient::SetTechnologyEnabled, |
- weak_ptr_factory_.GetWeakPtr(), type, callback, true), |
- base::TimeDelta::FromSeconds(kEnableTechnologyDelaySeconds)); |
+ weak_ptr_factory_.GetWeakPtr(), |
+ type, |
+ callback, |
+ true), |
+ base::TimeDelta::FromSeconds(interactive_delay)); |
} else { |
SetTechnologyEnabled(type, callback, true); |
} |
@@ -182,20 +176,22 @@ void FakeShillManagerClient::DisableTechnology( |
const ErrorCallback& error_callback) { |
base::ListValue* enabled_list = NULL; |
if (!stub_properties_.GetListWithoutPathExpansion( |
- shill::kEnabledTechnologiesProperty, &enabled_list)) { |
+ shill::kEnabledTechnologiesProperty, &enabled_list)) { |
base::MessageLoop::current()->PostTask( |
FROM_HERE, |
base::Bind(error_callback, "StubError", "Property not found")); |
return; |
} |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableStubInteractive)) { |
- const int kDisableTechnologyDelaySeconds = 3; |
+ int interactive_delay = DBusThreadManager::Get()->GetShillInteractiveDelay(); |
+ if (interactive_delay) { |
base::MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&FakeShillManagerClient::SetTechnologyEnabled, |
- weak_ptr_factory_.GetWeakPtr(), type, callback, false), |
- base::TimeDelta::FromSeconds(kDisableTechnologyDelaySeconds)); |
+ weak_ptr_factory_.GetWeakPtr(), |
+ type, |
+ callback, |
+ false), |
+ base::TimeDelta::FromSeconds(interactive_delay)); |
} else { |
SetTechnologyEnabled(type, callback, false); |
} |
@@ -234,8 +230,11 @@ void FakeShillManagerClient::ConfigureService( |
if (!existing_properties) { |
// Add a new service to the service client stub because none exists, yet. |
// This calls AddManagerService. |
- service_client->AddServiceWithIPConfig(service_path, guid, type, |
- shill::kStateIdle, ipconfig_path, |
+ service_client->AddServiceWithIPConfig(service_path, |
+ guid, |
+ type, |
+ shill::kStateIdle, |
+ ipconfig_path, |
true /* visible */, |
true /* watch */); |
existing_properties = service_client->GetServiceProperties(service_path); |
@@ -247,7 +246,8 @@ void FakeShillManagerClient::ConfigureService( |
// Now set all the properties. |
for (base::DictionaryValue::Iterator iter(*merged_properties); |
- !iter.IsAtEnd(); iter.Advance()) { |
+ !iter.IsAtEnd(); |
+ iter.Advance()) { |
service_client->SetServiceProperty(service_path, iter.key(), iter.value()); |
} |
@@ -256,8 +256,10 @@ void FakeShillManagerClient::ConfigureService( |
merged_properties->GetStringWithoutPathExpansion(shill::kProfileProperty, |
&profile_path); |
if (!profile_path.empty()) { |
- DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> |
- AddService(profile_path, service_path); |
+ DBusThreadManager::Get() |
+ ->GetShillProfileClient() |
+ ->GetTestInterface() |
+ ->AddService(profile_path, service_path); |
} |
base::MessageLoop::current()->PostTask( |
@@ -276,11 +278,9 @@ void FakeShillManagerClient::ConfigureServiceForProfile( |
ConfigureService(properties, callback, error_callback); |
} |
- |
-void FakeShillManagerClient::GetService( |
- const base::DictionaryValue& properties, |
- const ObjectPathCallback& callback, |
- const ErrorCallback& error_callback) { |
+void FakeShillManagerClient::GetService(const base::DictionaryValue& properties, |
+ const ObjectPathCallback& callback, |
+ const ErrorCallback& error_callback) { |
base::MessageLoop::current()->PostTask( |
FROM_HERE, base::Bind(callback, dbus::ObjectPath())); |
} |
@@ -306,14 +306,13 @@ void FakeShillManagerClient::VerifyAndEncryptData( |
const std::string& data, |
const StringCallback& callback, |
const ErrorCallback& error_callback) { |
- base::MessageLoop::current()->PostTask(FROM_HERE, |
- base::Bind(callback, "encrypted_data")); |
+ base::MessageLoop::current()->PostTask( |
+ FROM_HERE, base::Bind(callback, "encrypted_data")); |
} |
void FakeShillManagerClient::ConnectToBestServices( |
const base::Closure& callback, |
- const ErrorCallback& error_callback) { |
-} |
+ const ErrorCallback& error_callback) {} |
ShillManagerClient::TestInterface* FakeShillManagerClient::GetTestInterface() { |
return this; |
@@ -322,86 +321,80 @@ ShillManagerClient::TestInterface* FakeShillManagerClient::GetTestInterface() { |
// ShillManagerClient::TestInterface overrides. |
void FakeShillManagerClient::AddDevice(const std::string& device_path) { |
- if (GetListProperty(shill::kDevicesProperty)->AppendIfNotPresent( |
- base::Value::CreateStringValue(device_path))) { |
- CallNotifyObserversPropertyChanged(shill::kDevicesProperty, 0); |
+ if (GetListProperty(shill::kDevicesProperty) |
+ ->AppendIfNotPresent(base::Value::CreateStringValue(device_path))) { |
+ CallNotifyObserversPropertyChanged(shill::kDevicesProperty); |
} |
} |
void FakeShillManagerClient::RemoveDevice(const std::string& device_path) { |
base::StringValue device_path_value(device_path); |
- if (GetListProperty(shill::kDevicesProperty)->Remove( |
- device_path_value, NULL)) { |
- CallNotifyObserversPropertyChanged(shill::kDevicesProperty, 0); |
+ if (GetListProperty(shill::kDevicesProperty) |
+ ->Remove(device_path_value, NULL)) { |
+ CallNotifyObserversPropertyChanged(shill::kDevicesProperty); |
} |
} |
void FakeShillManagerClient::ClearDevices() { |
GetListProperty(shill::kDevicesProperty)->Clear(); |
- CallNotifyObserversPropertyChanged(shill::kDevicesProperty, 0); |
+ CallNotifyObserversPropertyChanged(shill::kDevicesProperty); |
} |
void FakeShillManagerClient::AddTechnology(const std::string& type, |
bool enabled) { |
- if (GetListProperty(shill::kAvailableTechnologiesProperty)-> |
- AppendIfNotPresent(base::Value::CreateStringValue(type))) { |
- CallNotifyObserversPropertyChanged( |
- shill::kAvailableTechnologiesProperty, 0); |
+ if (GetListProperty(shill::kAvailableTechnologiesProperty) |
+ ->AppendIfNotPresent(base::Value::CreateStringValue(type))) { |
+ CallNotifyObserversPropertyChanged(shill::kAvailableTechnologiesProperty); |
} |
if (enabled && |
- GetListProperty(shill::kEnabledTechnologiesProperty)-> |
- AppendIfNotPresent(base::Value::CreateStringValue(type))) { |
- CallNotifyObserversPropertyChanged( |
- shill::kEnabledTechnologiesProperty, 0); |
+ GetListProperty(shill::kEnabledTechnologiesProperty) |
+ ->AppendIfNotPresent(base::Value::CreateStringValue(type))) { |
+ CallNotifyObserversPropertyChanged(shill::kEnabledTechnologiesProperty); |
} |
} |
void FakeShillManagerClient::RemoveTechnology(const std::string& type) { |
base::StringValue type_value(type); |
- if (GetListProperty(shill::kAvailableTechnologiesProperty)->Remove( |
- type_value, NULL)) { |
- CallNotifyObserversPropertyChanged( |
- shill::kAvailableTechnologiesProperty, 0); |
+ if (GetListProperty(shill::kAvailableTechnologiesProperty) |
+ ->Remove(type_value, NULL)) { |
+ CallNotifyObserversPropertyChanged(shill::kAvailableTechnologiesProperty); |
} |
- if (GetListProperty(shill::kEnabledTechnologiesProperty)->Remove( |
- type_value, NULL)) { |
- CallNotifyObserversPropertyChanged( |
- shill::kEnabledTechnologiesProperty, 0); |
+ if (GetListProperty(shill::kEnabledTechnologiesProperty) |
+ ->Remove(type_value, NULL)) { |
+ CallNotifyObserversPropertyChanged(shill::kEnabledTechnologiesProperty); |
} |
} |
void FakeShillManagerClient::SetTechnologyInitializing(const std::string& type, |
bool initializing) { |
if (initializing) { |
- if (GetListProperty(shill::kUninitializedTechnologiesProperty)-> |
- AppendIfNotPresent(base::Value::CreateStringValue(type))) { |
+ if (GetListProperty(shill::kUninitializedTechnologiesProperty) |
+ ->AppendIfNotPresent(base::Value::CreateStringValue(type))) { |
CallNotifyObserversPropertyChanged( |
- shill::kUninitializedTechnologiesProperty, 0); |
+ shill::kUninitializedTechnologiesProperty); |
} |
} else { |
- if (GetListProperty(shill::kUninitializedTechnologiesProperty)->Remove( |
- base::StringValue(type), NULL)) { |
+ if (GetListProperty(shill::kUninitializedTechnologiesProperty) |
+ ->Remove(base::StringValue(type), NULL)) { |
CallNotifyObserversPropertyChanged( |
- shill::kUninitializedTechnologiesProperty, 0); |
+ shill::kUninitializedTechnologiesProperty); |
} |
} |
} |
-void FakeShillManagerClient::ClearProperties() { |
- stub_properties_.Clear(); |
-} |
+void FakeShillManagerClient::ClearProperties() { stub_properties_.Clear(); } |
void FakeShillManagerClient::AddManagerService(const std::string& service_path, |
bool add_to_visible_list, |
bool add_to_watch_list) { |
// Always add to ServiceCompleteListProperty. |
- GetListProperty(shill::kServiceCompleteListProperty)->AppendIfNotPresent( |
- base::Value::CreateStringValue(service_path)); |
+ GetListProperty(shill::kServiceCompleteListProperty) |
+ ->AppendIfNotPresent(base::Value::CreateStringValue(service_path)); |
// If visible, add to Services and notify if new. |
if (add_to_visible_list && |
- GetListProperty(shill::kServicesProperty)->AppendIfNotPresent( |
- base::Value::CreateStringValue(service_path))) { |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty, 0); |
+ GetListProperty(shill::kServicesProperty) |
+ ->AppendIfNotPresent(base::Value::CreateStringValue(service_path))) { |
+ CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
} |
if (add_to_watch_list) |
AddServiceToWatchList(service_path); |
@@ -410,16 +403,15 @@ void FakeShillManagerClient::AddManagerService(const std::string& service_path, |
void FakeShillManagerClient::RemoveManagerService( |
const std::string& service_path) { |
base::StringValue service_path_value(service_path); |
- if (GetListProperty(shill::kServicesProperty)->Remove( |
- service_path_value, NULL)) { |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty, 0); |
+ if (GetListProperty(shill::kServicesProperty) |
+ ->Remove(service_path_value, NULL)) { |
+ CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
} |
- GetListProperty(shill::kServiceCompleteListProperty)->Remove( |
- service_path_value, NULL); |
- if (GetListProperty(shill::kServiceWatchListProperty)->Remove( |
- service_path_value, NULL)) { |
- CallNotifyObserversPropertyChanged( |
- shill::kServiceWatchListProperty, 0); |
+ GetListProperty(shill::kServiceCompleteListProperty) |
+ ->Remove(service_path_value, NULL); |
+ if (GetListProperty(shill::kServiceWatchListProperty) |
+ ->Remove(service_path_value, NULL)) { |
+ CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty); |
} |
} |
@@ -427,26 +419,22 @@ void FakeShillManagerClient::ClearManagerServices() { |
GetListProperty(shill::kServicesProperty)->Clear(); |
GetListProperty(shill::kServiceCompleteListProperty)->Clear(); |
GetListProperty(shill::kServiceWatchListProperty)->Clear(); |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty, 0); |
- CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty, 0); |
+ CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
+ CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty); |
} |
void FakeShillManagerClient::SortManagerServices() { |
- static const char* ordered_types[] = { |
- shill::kTypeEthernet, |
- shill::kTypeWifi, |
- shill::kTypeCellular, |
- shill::kTypeWimax, |
- shill::kTypeVPN |
- }; |
+ static const char* ordered_types[] = {shill::kTypeEthernet, shill::kTypeWifi, |
+ shill::kTypeCellular, shill::kTypeWimax, |
+ shill::kTypeVPN}; |
base::ListValue* service_list = GetListProperty(shill::kServicesProperty); |
if (!service_list || service_list->empty()) |
return; |
std::vector<std::string> active_services; |
std::vector<std::string> inactive_services; |
for (size_t i = 0; i < arraysize(ordered_types); ++i) { |
- AppendServicesForType(service_list, ordered_types[i], |
- &active_services, &inactive_services); |
+ AppendServicesForType( |
+ service_list, ordered_types[i], &active_services, &inactive_services); |
} |
service_list->Clear(); |
for (size_t i = 0; i < active_services.size(); ++i) |
@@ -454,15 +442,15 @@ void FakeShillManagerClient::SortManagerServices() { |
for (size_t i = 0; i < inactive_services.size(); ++i) |
service_list->AppendString(inactive_services[i]); |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty, 0); |
+ CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
} |
void FakeShillManagerClient::AddGeoNetwork( |
const std::string& technology, |
const base::DictionaryValue& network) { |
base::ListValue* list_value = NULL; |
- if (!stub_geo_networks_.GetListWithoutPathExpansion( |
- technology, &list_value)) { |
+ if (!stub_geo_networks_.GetListWithoutPathExpansion(technology, |
+ &list_value)) { |
list_value = new base::ListValue; |
stub_geo_networks_.SetWithoutPathExpansion(technology, list_value); |
} |
@@ -471,21 +459,20 @@ void FakeShillManagerClient::AddGeoNetwork( |
void FakeShillManagerClient::AddProfile(const std::string& profile_path) { |
const char* key = shill::kProfilesProperty; |
- if (GetListProperty(key)->AppendIfNotPresent( |
- new base::StringValue(profile_path))) { |
- CallNotifyObserversPropertyChanged(key, 0); |
+ if (GetListProperty(key) |
+ ->AppendIfNotPresent(new base::StringValue(profile_path))) { |
+ CallNotifyObserversPropertyChanged(key); |
} |
} |
void FakeShillManagerClient::AddServiceToWatchList( |
const std::string& service_path) { |
// Remove and insert the service, moving it to the front of the watch list. |
- GetListProperty(shill::kServiceWatchListProperty)->Remove( |
- base::StringValue(service_path), NULL); |
- GetListProperty(shill::kServiceWatchListProperty)->Insert( |
- 0, base::Value::CreateStringValue(service_path)); |
- CallNotifyObserversPropertyChanged( |
- shill::kServiceWatchListProperty, 0); |
+ GetListProperty(shill::kServiceWatchListProperty) |
+ ->Remove(base::StringValue(service_path), NULL); |
+ GetListProperty(shill::kServiceWatchListProperty) |
+ ->Insert(0, base::Value::CreateStringValue(service_path)); |
+ CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty); |
} |
void FakeShillManagerClient::PassStubProperties( |
@@ -508,22 +495,16 @@ void FakeShillManagerClient::PassStubGeoNetworks( |
} |
void FakeShillManagerClient::CallNotifyObserversPropertyChanged( |
- const std::string& property, |
- int delay_ms) { |
+ const std::string& property) { |
// Avoid unnecessary delayed task if we have no observers (e.g. during |
// initial setup). |
if (!observer_list_.might_have_observers()) |
return; |
- if (!CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableStubInteractive)) { |
- delay_ms = 0; |
- } |
- base::MessageLoop::current()->PostDelayedTask( |
+ base::MessageLoop::current()->PostTask( |
FROM_HERE, |
base::Bind(&FakeShillManagerClient::NotifyObserversPropertyChanged, |
weak_ptr_factory_.GetWeakPtr(), |
- property), |
- base::TimeDelta::FromMilliseconds(delay_ms)); |
+ property)); |
} |
void FakeShillManagerClient::NotifyObserversPropertyChanged( |
@@ -538,8 +519,8 @@ void FakeShillManagerClient::NotifyObserversPropertyChanged( |
} |
if (property == shill::kDevicesProperty) { |
base::ListValue* devices = NULL; |
- if (stub_properties_.GetListWithoutPathExpansion( |
- shill::kDevicesProperty, &devices)) { |
+ if (stub_properties_.GetListWithoutPathExpansion(shill::kDevicesProperty, |
+ &devices)) { |
FOR_EACH_OBSERVER(ShillPropertyChangedObserver, |
observer_list_, |
OnPropertyChanged(property, *devices)); |
@@ -559,8 +540,7 @@ void FakeShillManagerClient::NotifyObserversPropertyChanged( |
base::ListValue* FakeShillManagerClient::GetListProperty( |
const std::string& property) { |
base::ListValue* list_property = NULL; |
- if (!stub_properties_.GetListWithoutPathExpansion( |
- property, &list_property)) { |
+ if (!stub_properties_.GetListWithoutPathExpansion(property, &list_property)) { |
list_property = new base::ListValue; |
stub_properties_.SetWithoutPathExpansion(property, list_property); |
} |
@@ -581,10 +561,9 @@ bool FakeShillManagerClient::TechnologyEnabled(const std::string& type) const { |
return enabled; |
} |
-void FakeShillManagerClient::SetTechnologyEnabled( |
- const std::string& type, |
- const base::Closure& callback, |
- bool enabled) { |
+void FakeShillManagerClient::SetTechnologyEnabled(const std::string& type, |
+ const base::Closure& callback, |
+ bool enabled) { |
base::ListValue* enabled_list = NULL; |
stub_properties_.GetListWithoutPathExpansion( |
shill::kEnabledTechnologiesProperty, &enabled_list); |
@@ -593,12 +572,11 @@ void FakeShillManagerClient::SetTechnologyEnabled( |
enabled_list->AppendIfNotPresent(new base::StringValue(type)); |
else |
enabled_list->Remove(base::StringValue(type), NULL); |
- CallNotifyObserversPropertyChanged( |
- shill::kEnabledTechnologiesProperty, 0 /* already delayed */); |
+ CallNotifyObserversPropertyChanged(shill::kEnabledTechnologiesProperty); |
base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
// May affect available services |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty, 0); |
- CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty, 0); |
+ CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
+ CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty); |
} |
base::ListValue* FakeShillManagerClient::GetEnabledServiceList( |
@@ -609,7 +587,8 @@ base::ListValue* FakeShillManagerClient::GetEnabledServiceList( |
ShillServiceClient::TestInterface* service_client = |
DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
for (base::ListValue::const_iterator iter = service_list->begin(); |
- iter != service_list->end(); ++iter) { |
+ iter != service_list->end(); |
+ ++iter) { |
std::string service_path; |
if (!(*iter)->GetAsString(&service_path)) |
continue; |
@@ -633,13 +612,15 @@ base::ListValue* FakeShillManagerClient::GetEnabledServiceList( |
void FakeShillManagerClient::ScanCompleted(const std::string& device_path, |
const base::Closure& callback) { |
if (!device_path.empty()) { |
- DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> |
- SetDeviceProperty(device_path, |
- shill::kScanningProperty, |
- base::FundamentalValue(false)); |
- } |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty, 0); |
- CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty, 0); |
+ DBusThreadManager::Get() |
+ ->GetShillDeviceClient() |
+ ->GetTestInterface() |
+ ->SetDeviceProperty(device_path, |
+ shill::kScanningProperty, |
+ base::FundamentalValue(false)); |
+ } |
+ CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
+ CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty); |
base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
} |