Index: chromeos/dbus/fake_shill_service_client.cc |
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc |
index c968d80ec67892806d2c9a00518968a479fc2d2c..ea73a4911c781a6140b433740e6388695024c447 100644 |
--- a/chromeos/dbus/fake_shill_service_client.cc |
+++ b/chromeos/dbus/fake_shill_service_client.cc |
@@ -6,16 +6,14 @@ |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
-#include "base/command_line.h" |
#include "base/message_loop/message_loop.h" |
#include "base/stl_util.h" |
#include "base/strings/string_util.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_manager_client.h" |
#include "chromeos/dbus/shill_property_changed_observer.h" |
-#include "chromeos/dbus/shill_stub_helper.h" |
#include "chromeos/network/shill_property_util.h" |
#include "dbus/bus.h" |
#include "dbus/message.h" |
@@ -38,6 +36,11 @@ void PassStubServiceProperties( |
callback.Run(call_status, *properties); |
} |
+int GetInteractiveDelay() { |
+ return DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
+ GetInteractiveDelay(); |
+} |
+ |
} // namespace |
FakeShillServiceClient::FakeShillServiceClient() : weak_ptr_factory_(this) { |
@@ -52,6 +55,8 @@ FakeShillServiceClient::~FakeShillServiceClient() { |
// ShillServiceClient overrides. |
void FakeShillServiceClient::Init(dbus::Bus* bus) { |
+ // Note: FakeShillManagerClient sets up default services before this is |
+ // called. |
} |
void FakeShillServiceClient::AddPropertyChangedObserver( |
@@ -187,18 +192,12 @@ void FakeShillServiceClient::Connect(const dbus::ObjectPath& service_path, |
associating_value); |
// Stay Associating until the state is changed again after a delay. |
- base::TimeDelta delay; |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableStubInteractive)) { |
- const int kConnectDelaySeconds = 5; |
- delay = base::TimeDelta::FromSeconds(kConnectDelaySeconds); |
- } |
base::MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&FakeShillServiceClient::ContinueConnect, |
weak_ptr_factory_.GetWeakPtr(), |
service_path.value()), |
- delay); |
+ base::TimeDelta::FromSeconds(GetInteractiveDelay())); |
callback.Run(); |
} |
@@ -211,12 +210,6 @@ void FakeShillServiceClient::Disconnect(const dbus::ObjectPath& service_path, |
error_callback.Run("Error.InvalidService", "Invalid Service"); |
return; |
} |
- base::TimeDelta delay; |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableStubInteractive)) { |
- const int kConnectDelaySeconds = 2; |
- delay = base::TimeDelta::FromSeconds(kConnectDelaySeconds); |
- } |
// Set Idle after a delay |
base::StringValue idle_value(shill::kStateIdle); |
base::MessageLoop::current()->PostDelayedTask( |
@@ -228,7 +221,7 @@ void FakeShillServiceClient::Disconnect(const dbus::ObjectPath& service_path, |
idle_value, |
base::Bind(&base::DoNothing), |
error_callback), |
- delay); |
+ base::TimeDelta::FromSeconds(GetInteractiveDelay())); |
callback.Run(); |
} |
@@ -252,12 +245,6 @@ void FakeShillServiceClient::ActivateCellularModem( |
SetServiceProperty(service_path.value(), |
shill::kActivationStateProperty, |
base::StringValue(shill::kActivationStateActivating)); |
- base::TimeDelta delay; |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableStubInteractive)) { |
- const int kConnectDelaySeconds = 2; |
- delay = base::TimeDelta::FromSeconds(kConnectDelaySeconds); |
- } |
// Set Activated after a delay |
base::MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
@@ -265,7 +252,7 @@ void FakeShillServiceClient::ActivateCellularModem( |
weak_ptr_factory_.GetWeakPtr(), |
service_path, |
error_callback), |
- delay); |
+ base::TimeDelta::FromSeconds(GetInteractiveDelay())); |
base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
} |
@@ -318,12 +305,7 @@ void FakeShillServiceClient::AddService(const std::string& service_path, |
const std::string& state, |
bool add_to_visible_list, |
bool add_to_watch_list) { |
- std::string nstate = state; |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kDefaultStubNetworkStateIdle)) { |
- nstate = shill::kStateIdle; |
- } |
- AddServiceWithIPConfig(service_path, name, type, nstate, "", |
+ AddServiceWithIPConfig(service_path, name, type, state, "", |
add_to_visible_list, add_to_watch_list); |
} |
@@ -337,6 +319,8 @@ void FakeShillServiceClient::AddServiceWithIPConfig( |
bool add_to_watch_list) { |
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
AddManagerService(service_path, add_to_visible_list, add_to_watch_list); |
+ ShillDeviceClient::TestInterface* device_client = |
+ DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); |
base::DictionaryValue* properties = |
GetModifiableServiceProperties(service_path, true); |
@@ -348,7 +332,7 @@ void FakeShillServiceClient::AddServiceWithIPConfig( |
properties->SetWithoutPathExpansion( |
shill::kDeviceProperty, |
base::Value::CreateStringValue( |
- shill_stub_helper::DevicePathForType(type))); |
+ device_client->GetDevicePathForType(type))); |
properties->SetWithoutPathExpansion( |
shill::kTypeProperty, |
base::Value::CreateStringValue(type)); |