Index: chromeos/dbus/dbus_thread_manager.cc |
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc |
index f2edfad992480b24ee8119dc329dc89d5be87192..efbab7eea0e8fb14fa5e982114c781ea3960336d 100644 |
--- a/chromeos/dbus/dbus_thread_manager.cc |
+++ b/chromeos/dbus/dbus_thread_manager.cc |
@@ -24,7 +24,6 @@ |
#include "chromeos/dbus/dbus_client_bundle.h" |
#include "chromeos/dbus/debug_daemon_client.h" |
#include "chromeos/dbus/easy_unlock_client.h" |
-#include "chromeos/dbus/fake_dbus_thread_manager.h" |
#include "chromeos/dbus/gsm_sms_client.h" |
#include "chromeos/dbus/image_burner_client.h" |
#include "chromeos/dbus/introspectable_client.h" |
@@ -62,18 +61,20 @@ DBusClientBundle::DBusClientTypeMask |
class DBusThreadManagerImpl : public DBusThreadManager { |
public: |
DBusThreadManagerImpl() { |
- // Create the D-Bus thread. |
- base::Thread::Options thread_options; |
- thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
- dbus_thread_.reset(new base::Thread("D-Bus thread")); |
- dbus_thread_->StartWithOptions(thread_options); |
- |
- // Create the connection to the system bus. |
- dbus::Bus::Options system_bus_options; |
- system_bus_options.bus_type = dbus::Bus::SYSTEM; |
- system_bus_options.connection_type = dbus::Bus::PRIVATE; |
- system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); |
- system_bus_ = new dbus::Bus(system_bus_options); |
+ if (!DBusThreadManager::IsUsingStub(DBusClientBundle::ALL_CLIENTS)) { |
+ // Create the D-Bus thread. |
+ base::Thread::Options thread_options; |
+ thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
+ dbus_thread_.reset(new base::Thread("D-Bus thread")); |
+ dbus_thread_->StartWithOptions(thread_options); |
+ |
+ // Create the connection to the system bus. |
+ dbus::Bus::Options system_bus_options; |
+ system_bus_options.bus_type = dbus::Bus::SYSTEM; |
+ system_bus_options.connection_type = dbus::Bus::PRIVATE; |
+ system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); |
+ system_bus_ = new dbus::Bus(system_bus_options); |
+ } |
CreateDefaultClients(); |
} |
@@ -87,13 +88,27 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
// Shut down the bus. During the browser shutdown, it's ok to shut down |
// the bus synchronously. |
- system_bus_->ShutdownOnDBusThreadAndBlock(); |
+ if (system_bus_.get()) |
hashimoto
2014/08/18 04:55:58
nit: No need to have get().
zel
2014/08/18 23:41:52
Done.
|
+ system_bus_->ShutdownOnDBusThreadAndBlock(); |
// Stop the D-Bus thread. |
- dbus_thread_->Stop(); |
+ if (dbus_thread_.get()) |
hashimoto
2014/08/18 04:55:58
ditto.
zel
2014/08/18 23:41:52
Done.
|
+ dbus_thread_->Stop(); |
+ } |
+ |
+ static DBusThreadManagerImpl* CreateDBusThreadManager() { |
+ DBusThreadManagerImpl* dbus_thread_manager = new DBusThreadManagerImpl(); |
+ g_dbus_thread_manager = dbus_thread_manager; |
+ dbus_thread_manager->InitializeClients(); |
+ dbus_thread_manager->SetupDefaultEnvironment(); |
+ return dbus_thread_manager; |
} |
void SetupDefaultEnvironment() { |
+ // Skip if running in test environment without the message loop. |
hashimoto
2014/08/18 04:55:58
Why do we need this?
Can't we add MessageLoop for
zel
2014/08/18 23:41:52
Done.
|
+ if (!base::MessageLoop::current()) |
+ return; |
+ |
return client_bundle_->SetupDefaultEnvironment(); |
} |
@@ -249,6 +264,7 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
} |
private: |
+ friend class DBusThreadManagerTestHelper; |
// Constructs all clients and stores them in the respective *_client_ member |
// variable. |
void CreateDefaultClients() { |
@@ -258,6 +274,68 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
power_policy_controller_.reset(new PowerPolicyController); |
} |
+ // InitializeClients is called after g_dbus_thread_manager is set. |
+ // NOTE: Clients that access other clients in their Init() must be |
+ // initialized in the correct order. |
+ void InitializeClients() { |
+ InitClient(GetBluetoothAdapterClient()); |
+ InitClient(GetBluetoothAgentManagerClient()); |
+ InitClient(GetBluetoothDeviceClient()); |
+ InitClient(GetBluetoothGattCharacteristicClient()); |
+ InitClient(GetBluetoothGattDescriptorClient()); |
+ InitClient(GetBluetoothGattManagerClient()); |
+ InitClient(GetBluetoothGattServiceClient()); |
+ InitClient(GetBluetoothInputClient()); |
+ InitClient(GetBluetoothProfileManagerClient()); |
+ InitClient(GetCrasAudioClient()); |
+ InitClient(GetCrosDisksClient()); |
+ InitClient(GetCryptohomeClient()); |
+ InitClient(GetDebugDaemonClient()); |
+ InitClient(GetEasyUnlockClient()); |
+ InitClient(GetGsmSMSClient()); |
+ InitClient(GetImageBurnerClient()); |
+ InitClient(GetIntrospectableClient()); |
+ InitClient(GetLorgnetteManagerClient()); |
+ InitClient(GetModemMessagingClient()); |
+ InitClient(GetPermissionBrokerClient()); |
+ InitClient(GetPowerManagerClient()); |
+ InitClient(GetSessionManagerClient()); |
+ InitClient(GetShillDeviceClient()); |
+ InitClient(GetShillIPConfigClient()); |
+ InitClient(GetShillManagerClient()); |
+ InitClient(GetShillServiceClient()); |
+ InitClient(GetShillProfileClient()); |
+ InitClient(GetSMSClient()); |
+ InitClient(GetSystemClockClient()); |
+ InitClient(GetUpdateEngineClient()); |
+ |
+ // Initialize the NFC clients in the correct order. The order of |
+ // initialization matters due to dependencies that exist between the |
+ // client objects. |
+ InitClient(GetNfcManagerClient()); |
+ InitClient(GetNfcAdapterClient()); |
+ InitClient(GetNfcDeviceClient()); |
+ InitClient(GetNfcTagClient()); |
+ InitClient(GetNfcRecordClient()); |
+ |
+ // PowerPolicyController is dependent on PowerManagerClient, so |
+ // initialize it after the main list of clients. |
+ if (GetPowerPolicyController()) { |
+ GetPowerPolicyController()->Init(this); |
+ } |
+ |
+ // This must be called after the list of clients so they've each had a |
+ // chance to register with their object g_dbus_thread_managers. |
+ if (GetSystemBus()) |
+ GetSystemBus()->GetManagedObjects(); |
+ } |
+ |
+ // Initializes |client| with the |system_bus_|. |
+ void InitClient(DBusClient* client) { |
hashimoto
2014/08/18 04:55:58
When the client can be NULL?
Do we need this metho
zel
2014/08/18 23:41:52
Removed InitClient, kept DBusClient (that's a diff
|
+ if (client) |
+ client->Init(GetSystemBus()); |
+ } |
+ |
scoped_ptr<base::Thread> dbus_thread_; |
scoped_refptr<dbus::Bus> system_bus_; |
scoped_ptr<DBusClientBundle> client_bundle_; |
@@ -275,15 +353,10 @@ bool DBusThreadManager::IsUsingStub(DBusClientBundle::DBusClientType client) { |
void DBusThreadManager::Initialize() { |
// If we initialize DBusThreadManager twice we may also be shutting it down |
// early; do not allow that. |
- CHECK(g_dbus_thread_manager == NULL); |
- |
- if (g_dbus_thread_manager_for_testing) { |
- g_dbus_thread_manager = g_dbus_thread_manager_for_testing; |
- InitializeClients(); |
- VLOG(1) << "DBusThreadManager initialized with test implementation"; |
+ if (g_dbus_thread_manager_for_testing) |
return; |
- } |
+ CHECK(g_dbus_thread_manager == NULL); |
bool use_dbus_stub = !base::SysInfo::IsRunningOnChromeOS() || |
CommandLine::ForCurrentProcess()->HasSwitch( |
chromeos::switches::kDbusStub); |
@@ -295,33 +368,36 @@ void DBusThreadManager::Initialize() { |
CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
chromeos::switches::kDbusUnstubClients)); |
} else if (use_dbus_stub) { |
- InitializeWithStub(); |
+ InitializeForTesting(); |
} else { |
InitializeRegular(); |
} |
} |
// static |
-void DBusThreadManager::SetInstanceForTesting( |
- DBusThreadManager* dbus_thread_manager) { |
+scoped_ptr<DBusThreadManagerTestHelper> |
+DBusThreadManager::InitializeForTesting() { |
CHECK(!g_dbus_thread_manager); |
CHECK(!g_dbus_thread_manager_for_testing); |
- g_dbus_thread_manager_for_testing = dbus_thread_manager; |
+ unstub_client_mask_ = DBusClientBundle::NO_CLIENTS; |
+ VLOG(1) << "DBusThreadManager created for testing"; |
+ DBusThreadManagerImpl* manager = |
+ DBusThreadManagerImpl::CreateDBusThreadManager(); |
+ g_dbus_thread_manager_for_testing = manager; |
+ return make_scoped_ptr(new DBusThreadManagerTestHelper(manager)); |
} |
// static |
-void DBusThreadManager::InitializeForTesting( |
- DBusThreadManager* dbus_thread_manager) { |
+void DBusThreadManager::InitializeWithStub() { |
unstub_client_mask_ = DBusClientBundle::NO_CLIENTS; |
- SetInstanceForTesting(dbus_thread_manager); |
- Initialize(); |
+ DBusThreadManagerImpl::CreateDBusThreadManager(); |
+ VLOG(1) << "DBusThreadManager initialized with stub implementations"; |
} |
// static |
void DBusThreadManager::InitializeRegular() { |
unstub_client_mask_ = DBusClientBundle::ALL_CLIENTS; |
- g_dbus_thread_manager = new DBusThreadManagerImpl(); |
- InitializeClients(); |
+ DBusThreadManagerImpl::CreateDBusThreadManager(); |
VLOG(1) << "DBusThreadManager initialized for Chrome OS"; |
} |
@@ -340,25 +416,8 @@ void DBusThreadManager::InitializeWithPartialStub( |
<< " cannot be parsed: " |
<< unstub_clients; |
} |
- DBusThreadManagerImpl* dbus_thread_manager = new DBusThreadManagerImpl(); |
VLOG(1) << "DBusThreadManager initialized for mixed runtime environment"; |
- g_dbus_thread_manager = dbus_thread_manager; |
- InitializeClients(); |
- dbus_thread_manager->SetupDefaultEnvironment(); |
-} |
- |
-// static |
-void DBusThreadManager::InitializeWithStub() { |
- unstub_client_mask_ = DBusClientBundle::NO_CLIENTS; |
- // If we initialize DBusThreadManager twice we may also be shutting it down |
- // early; do not allow that. |
- CHECK(g_dbus_thread_manager == NULL); |
- FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; |
- fake_dbus_thread_manager->SetFakeClients(); |
- g_dbus_thread_manager = fake_dbus_thread_manager; |
- InitializeClients(); |
- fake_dbus_thread_manager->SetupDefaultEnvironment(); |
- VLOG(1) << "DBusThreadManager initialized with stub implementation"; |
+ DBusThreadManagerImpl::CreateDBusThreadManager(); |
} |
// static |
@@ -370,7 +429,7 @@ bool DBusThreadManager::IsInitialized() { |
void DBusThreadManager::Shutdown() { |
// If we called InitializeForTesting, this may get called more than once. |
// Ensure that we only shutdown DBusThreadManager once. |
- CHECK(g_dbus_thread_manager || g_dbus_thread_manager_for_testing); |
+ CHECK(g_dbus_thread_manager); |
DBusThreadManager* dbus_thread_manager = g_dbus_thread_manager; |
g_dbus_thread_manager = NULL; |
g_dbus_thread_manager_for_testing = NULL; |
@@ -404,65 +463,205 @@ DBusThreadManager* DBusThreadManager::Get() { |
return g_dbus_thread_manager; |
} |
-// static |
-void DBusThreadManager::InitializeClients() { |
- InitClient(g_dbus_thread_manager->GetBluetoothAdapterClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothAgentManagerClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothDeviceClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothGattCharacteristicClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothGattDescriptorClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothGattManagerClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothGattServiceClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothInputClient()); |
- InitClient(g_dbus_thread_manager->GetBluetoothProfileManagerClient()); |
- InitClient(g_dbus_thread_manager->GetCrasAudioClient()); |
- InitClient(g_dbus_thread_manager->GetCrosDisksClient()); |
- InitClient(g_dbus_thread_manager->GetCryptohomeClient()); |
- InitClient(g_dbus_thread_manager->GetDebugDaemonClient()); |
- InitClient(g_dbus_thread_manager->GetEasyUnlockClient()); |
- InitClient(g_dbus_thread_manager->GetGsmSMSClient()); |
- InitClient(g_dbus_thread_manager->GetImageBurnerClient()); |
- InitClient(g_dbus_thread_manager->GetIntrospectableClient()); |
- InitClient(g_dbus_thread_manager->GetLorgnetteManagerClient()); |
- InitClient(g_dbus_thread_manager->GetModemMessagingClient()); |
- InitClient(g_dbus_thread_manager->GetPermissionBrokerClient()); |
- InitClient(g_dbus_thread_manager->GetPowerManagerClient()); |
- InitClient(g_dbus_thread_manager->GetSessionManagerClient()); |
- InitClient(g_dbus_thread_manager->GetShillDeviceClient()); |
- InitClient(g_dbus_thread_manager->GetShillIPConfigClient()); |
- InitClient(g_dbus_thread_manager->GetShillManagerClient()); |
- InitClient(g_dbus_thread_manager->GetShillServiceClient()); |
- InitClient(g_dbus_thread_manager->GetShillProfileClient()); |
- InitClient(g_dbus_thread_manager->GetSMSClient()); |
- InitClient(g_dbus_thread_manager->GetSystemClockClient()); |
- InitClient(g_dbus_thread_manager->GetUpdateEngineClient()); |
- |
- // Initialize the NFC clients in the correct order. The order of |
- // initialization matters due to dependencies that exist between the |
- // client objects. |
- InitClient(g_dbus_thread_manager->GetNfcManagerClient()); |
- InitClient(g_dbus_thread_manager->GetNfcAdapterClient()); |
- InitClient(g_dbus_thread_manager->GetNfcDeviceClient()); |
- InitClient(g_dbus_thread_manager->GetNfcTagClient()); |
- InitClient(g_dbus_thread_manager->GetNfcRecordClient()); |
- |
- // PowerPolicyController is dependent on PowerManagerClient, so |
- // initialize it after the main list of clients. |
- if (g_dbus_thread_manager->GetPowerPolicyController()) { |
- g_dbus_thread_manager->GetPowerPolicyController()->Init( |
- g_dbus_thread_manager); |
- } |
- |
- // This must be called after the list of clients so they've each had a |
- // chance to register with their object g_dbus_thread_managers. |
- if (g_dbus_thread_manager->GetSystemBus()) |
- g_dbus_thread_manager->GetSystemBus()->GetManagedObjects(); |
+DBusThreadManagerTestHelper::DBusThreadManagerTestHelper( |
+ DBusThreadManagerImpl* dbus_thread_manager) |
+ : dbus_thread_manager_(dbus_thread_manager) { |
} |
-// static |
-void DBusThreadManager::InitClient(DBusClient* client) { |
- if (client) |
- client->Init(g_dbus_thread_manager->GetSystemBus()); |
+DBusThreadManagerTestHelper::~DBusThreadManagerTestHelper() { |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothAdapterClient( |
+ scoped_ptr<BluetoothAdapterClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_adapter_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothAgentManagerClient( |
+ scoped_ptr<BluetoothAgentManagerClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_agent_manager_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothDeviceClient( |
+ scoped_ptr<BluetoothDeviceClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_device_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothGattCharacteristicClient( |
+ scoped_ptr<BluetoothGattCharacteristicClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_gatt_characteristic_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothGattDescriptorClient( |
+ scoped_ptr<BluetoothGattDescriptorClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_gatt_descriptor_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothGattManagerClient( |
+ scoped_ptr<BluetoothGattManagerClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_gatt_manager_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothGattServiceClient( |
+ scoped_ptr<BluetoothGattServiceClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_gatt_service_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothInputClient( |
+ scoped_ptr<BluetoothInputClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_input_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetBluetoothProfileManagerClient( |
+ scoped_ptr<BluetoothProfileManagerClient> client) { |
+ dbus_thread_manager_->client_bundle_->bluetooth_profile_manager_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetCrasAudioClient( |
+ scoped_ptr<CrasAudioClient> client) { |
+ dbus_thread_manager_->client_bundle_->cras_audio_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetCrosDisksClient( |
+ scoped_ptr<CrosDisksClient> client) { |
+ dbus_thread_manager_->client_bundle_->cros_disks_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetCryptohomeClient( |
+ scoped_ptr<CryptohomeClient> client) { |
+ dbus_thread_manager_->client_bundle_->cryptohome_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetDebugDaemonClient( |
+ scoped_ptr<DebugDaemonClient> client) { |
+ dbus_thread_manager_->client_bundle_->debug_daemon_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetEasyUnlockClient( |
+ scoped_ptr<EasyUnlockClient> client) { |
+ dbus_thread_manager_->client_bundle_->easy_unlock_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetLorgnetteManagerClient( |
+ scoped_ptr<LorgnetteManagerClient> client) { |
+ dbus_thread_manager_->client_bundle_->lorgnette_manager_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetShillDeviceClient( |
+ scoped_ptr<ShillDeviceClient> client) { |
+ dbus_thread_manager_->client_bundle_->shill_device_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetShillIPConfigClient( |
+ scoped_ptr<ShillIPConfigClient> client) { |
+ dbus_thread_manager_->client_bundle_->shill_ipconfig_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetShillManagerClient( |
+ scoped_ptr<ShillManagerClient> client) { |
+ dbus_thread_manager_->client_bundle_->shill_manager_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetShillServiceClient( |
+ scoped_ptr<ShillServiceClient> client) { |
+ dbus_thread_manager_->client_bundle_->shill_service_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetShillProfileClient( |
+ scoped_ptr<ShillProfileClient> client) { |
+ dbus_thread_manager_->client_bundle_->shill_profile_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetGsmSMSClient( |
+ scoped_ptr<GsmSMSClient> client) { |
+ dbus_thread_manager_->client_bundle_->gsm_sms_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetImageBurnerClient( |
+ scoped_ptr<ImageBurnerClient> client) { |
+ dbus_thread_manager_->client_bundle_->image_burner_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetIntrospectableClient( |
+ scoped_ptr<IntrospectableClient> client) { |
+ dbus_thread_manager_->client_bundle_->introspectable_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetModemMessagingClient( |
+ scoped_ptr<ModemMessagingClient> client) { |
+ dbus_thread_manager_->client_bundle_->modem_messaging_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetNfcAdapterClient( |
+ scoped_ptr<NfcAdapterClient> client) { |
+ dbus_thread_manager_->client_bundle_->nfc_adapter_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetNfcDeviceClient( |
+ scoped_ptr<NfcDeviceClient> client) { |
+ dbus_thread_manager_->client_bundle_->nfc_device_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetNfcManagerClient( |
+ scoped_ptr<NfcManagerClient> client) { |
+ dbus_thread_manager_->client_bundle_->nfc_manager_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetNfcRecordClient( |
+ scoped_ptr<NfcRecordClient> client) { |
+ dbus_thread_manager_->client_bundle_->nfc_record_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetNfcTagClient( |
+ scoped_ptr<NfcTagClient> client) { |
+ dbus_thread_manager_->client_bundle_->nfc_tag_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetPermissionBrokerClient( |
+ scoped_ptr<PermissionBrokerClient> client) { |
+ dbus_thread_manager_->client_bundle_->permission_broker_client_ = |
+ client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetPowerManagerClient( |
+ scoped_ptr<PowerManagerClient> client) { |
+ dbus_thread_manager_->power_policy_controller_.reset(); |
+ dbus_thread_manager_->client_bundle_->power_manager_client_ = client.Pass(); |
+ dbus_thread_manager_->power_policy_controller_.reset( |
+ new PowerPolicyController); |
+ dbus_thread_manager_->power_policy_controller_->Init(dbus_thread_manager_); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetPowerPolicyController( |
+ scoped_ptr<PowerPolicyController> client) { |
+ dbus_thread_manager_->power_policy_controller_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetSessionManagerClient( |
+ scoped_ptr<SessionManagerClient> client) { |
+ dbus_thread_manager_->client_bundle_->session_manager_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetSMSClient(scoped_ptr<SMSClient> client) { |
+ dbus_thread_manager_->client_bundle_->sms_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetSystemClockClient( |
+ scoped_ptr<SystemClockClient> client) { |
+ dbus_thread_manager_->client_bundle_->system_clock_client_ = client.Pass(); |
+} |
+ |
+void DBusThreadManagerTestHelper::SetUpdateEngineClient( |
+ scoped_ptr<UpdateEngineClient> client) { |
+ dbus_thread_manager_->client_bundle_->update_engine_client_ = client.Pass(); |
} |
} // namespace chromeos |