Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: chromeos/dbus/fake_dbus_thread_manager.cc

Issue 49773003: ChromeOS: Remove MockDBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/fake_dbus_thread_manager.cc
diff --git a/chromeos/dbus/fake_dbus_thread_manager.cc b/chromeos/dbus/fake_dbus_thread_manager.cc
index 29752b80676e4cb389e49c6b5f353e28130191d1..a18c40621dc95a2b64932ca360c55943eb7c47e9 100644
--- a/chromeos/dbus/fake_dbus_thread_manager.cc
+++ b/chromeos/dbus/fake_dbus_thread_manager.cc
@@ -4,55 +4,43 @@
#include "chromeos/dbus/fake_dbus_thread_manager.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
+#include "chromeos/dbus/bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/cras_audio_client.h"
+#include "chromeos/dbus/cros_disks_client.h"
+#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/dbus_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/dbus_thread_manager_observer.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
-#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
-#include "chromeos/dbus/fake_cros_disks_client.h"
-#include "chromeos/dbus/fake_cryptohome_client.h"
-#include "chromeos/dbus/fake_gsm_sms_client.h"
-#include "chromeos/dbus/fake_image_burner_client.h"
-#include "chromeos/dbus/fake_nfc_adapter_client.h"
-#include "chromeos/dbus/fake_nfc_device_client.h"
-#include "chromeos/dbus/fake_nfc_manager_client.h"
-#include "chromeos/dbus/fake_nfc_tag_client.h"
-#include "chromeos/dbus/fake_power_manager_client.h"
-#include "chromeos/dbus/fake_session_manager_client.h"
-#include "chromeos/dbus/fake_shill_device_client.h"
-#include "chromeos/dbus/fake_shill_manager_client.h"
-#include "chromeos/dbus/fake_system_clock_client.h"
-#include "chromeos/dbus/fake_update_engine_client.h"
-#include "chromeos/dbus/ibus/mock_ibus_client.h"
+#include "chromeos/dbus/debug_daemon_client.h"
+#include "chromeos/dbus/gsm_sms_client.h"
+#include "chromeos/dbus/ibus/ibus_client.h"
+#include "chromeos/dbus/image_burner_client.h"
+#include "chromeos/dbus/introspectable_client.h"
+#include "chromeos/dbus/modem_messaging_client.h"
+#include "chromeos/dbus/nfc_adapter_client.h"
+#include "chromeos/dbus/nfc_device_client.h"
+#include "chromeos/dbus/nfc_manager_client.h"
+#include "chromeos/dbus/nfc_tag_client.h"
+#include "chromeos/dbus/permission_broker_client.h"
+#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/dbus/power_policy_controller.h"
+#include "chromeos/dbus/session_manager_client.h"
+#include "chromeos/dbus/shill_device_client.h"
+#include "chromeos/dbus/shill_ipconfig_client.h"
+#include "chromeos/dbus/shill_manager_client.h"
+#include "chromeos/dbus/shill_profile_client.h"
+#include "chromeos/dbus/shill_service_client.h"
+#include "chromeos/dbus/sms_client.h"
+#include "chromeos/dbus/system_clock_client.h"
+#include "chromeos/dbus/update_engine_client.h"
namespace chromeos {
-FakeDBusThreadManager::FakeDBusThreadManager()
- : fake_bluetooth_adapter_client_(new FakeBluetoothAdapterClient()),
- fake_bluetooth_agent_manager_client_(new FakeBluetoothAgentManagerClient()),
- fake_bluetooth_device_client_(new FakeBluetoothDeviceClient()),
- fake_bluetooth_input_client_(new FakeBluetoothInputClient()),
- fake_bluetooth_profile_manager_client_(
- new FakeBluetoothProfileManagerClient()),
- fake_cros_disks_client_(new FakeCrosDisksClient),
- fake_cryptohome_client_(new FakeCryptohomeClient),
- fake_gsm_sms_client_(new FakeGsmSMSClient),
- fake_image_burner_client_(new FakeImageBurnerClient),
- fake_nfc_adapter_client_(new FakeNfcAdapterClient()),
- fake_nfc_device_client_(new FakeNfcDeviceClient()),
- fake_nfc_manager_client_(new FakeNfcManagerClient()),
- fake_nfc_tag_client_(new FakeNfcTagClient()),
- fake_session_manager_client_(new FakeSessionManagerClient),
- fake_shill_device_client_(new FakeShillDeviceClient),
- fake_shill_manager_client_(new FakeShillManagerClient),
- fake_system_clock_client_(new FakeSystemClockClient),
- fake_power_manager_client_(new FakePowerManagerClient),
- fake_update_engine_client_(new FakeUpdateEngineClient),
- ibus_bus_(NULL) {
- power_policy_controller_.reset(
- new PowerPolicyController(this, fake_power_manager_client_.get()));
+FakeDBusThreadManager::FakeDBusThreadManager() {
}
FakeDBusThreadManager::~FakeDBusThreadManager() {
@@ -60,6 +48,154 @@ FakeDBusThreadManager::~FakeDBusThreadManager() {
OnDBusThreadManagerDestroying(this));
}
+void FakeDBusThreadManager::SetBluetoothAdapterClient(
+ scoped_ptr<BluetoothAdapterClient> client) {
+ bluetooth_adapter_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetBluetoothAgentManagerClient(
+ scoped_ptr<BluetoothAgentManagerClient> client) {
+ bluetooth_agent_manager_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetBluetoothDeviceClient(
+ scoped_ptr<BluetoothDeviceClient> client) {
+ bluetooth_device_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetBluetoothInputClient(
+ scoped_ptr<BluetoothInputClient> client) {
+ bluetooth_input_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetBluetoothProfileManagerClient(
+ scoped_ptr<BluetoothProfileManagerClient> client) {
+ bluetooth_profile_manager_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetCrasAudioClient(
+ scoped_ptr<CrasAudioClient> client) {
+ cras_audio_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetCrosDisksClient(
+ scoped_ptr<CrosDisksClient> client) {
+ cros_disks_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetCryptohomeClient(
+ scoped_ptr<CryptohomeClient> client) {
+ cryptohome_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetDebugDaemonClient(
+ scoped_ptr<DebugDaemonClient> client) {
+ debug_daemon_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetShillDeviceClient(
+ scoped_ptr<ShillDeviceClient> client) {
+ shill_device_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetShillIPConfigClient(
+ scoped_ptr<ShillIPConfigClient> client) {
+ shill_ipconfig_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetShillManagerClient(
+ scoped_ptr<ShillManagerClient> client) {
+ shill_manager_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetShillServiceClient(
+ scoped_ptr<ShillServiceClient> client) {
+ shill_service_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetShillProfileClient(
+ scoped_ptr<ShillProfileClient> client) {
+ shill_profile_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetGsmSMSClient(
+ scoped_ptr<GsmSMSClient> client) {
+ gsm_sms_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetImageBurnerClient(
+ scoped_ptr<ImageBurnerClient> client) {
+ image_burner_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetIntrospectableClient(
+ scoped_ptr<IntrospectableClient> client) {
+ introspectable_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetModemMessagingClient(
+ scoped_ptr<ModemMessagingClient> client) {
+ modem_messaging_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetNfcAdapterClient(
+ scoped_ptr<NfcAdapterClient> client) {
+ nfc_adapter_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetNfcDeviceClient(
+ scoped_ptr<NfcDeviceClient> client) {
+ nfc_device_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetNfcManagerClient(
+ scoped_ptr<NfcManagerClient> client) {
+ nfc_manager_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetNfcTagClient(
+ scoped_ptr<NfcTagClient> client) {
+ nfc_tag_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetPermissionBrokerClient(
+ scoped_ptr<PermissionBrokerClient> client) {
+ permission_broker_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetPowerManagerClient(
+ scoped_ptr<PowerManagerClient> client) {
+ power_manager_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetPowerPolicyController(
+ scoped_ptr<PowerPolicyController> client) {
+ power_policy_controller_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetSessionManagerClient(
+ scoped_ptr<SessionManagerClient> client) {
+ session_manager_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetSMSClient(scoped_ptr<SMSClient> client) {
+ sms_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetSystemClockClient(
+ scoped_ptr<SystemClockClient> client) {
+ system_clock_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetUpdateEngineClient(
+ scoped_ptr<UpdateEngineClient> client) {
+ update_engine_client_ = client.Pass();
+}
+
+void FakeDBusThreadManager::SetIBusClient(scoped_ptr<IBusClient> client) {
+ ibus_client_ = client.Pass();
+}
+
void FakeDBusThreadManager::AddObserver(
DBusThreadManagerObserver* observer) {
DCHECK(observer);
@@ -75,9 +211,6 @@ void FakeDBusThreadManager::RemoveObserver(
void FakeDBusThreadManager::InitIBusBus(
const std::string& ibus_address,
const base::Closure& closure) {
- // Non-null bus address is used to ensure the connection to ibus-daemon.
- ibus_bus_ = reinterpret_cast<dbus::Bus*>(0xdeadbeef);
- mock_ibus_client_.reset(new MockIBusClient);
}
dbus::Bus* FakeDBusThreadManager::GetSystemBus() {
@@ -86,118 +219,111 @@ dbus::Bus* FakeDBusThreadManager::GetSystemBus() {
BluetoothAdapterClient*
FakeDBusThreadManager::GetBluetoothAdapterClient() {
- return fake_bluetooth_adapter_client_.get();
+ return bluetooth_adapter_client_.get();
}
BluetoothAgentManagerClient*
FakeDBusThreadManager::GetBluetoothAgentManagerClient() {
- return fake_bluetooth_agent_manager_client_.get();
+ return bluetooth_agent_manager_client_.get();
}
BluetoothDeviceClient*
FakeDBusThreadManager::GetBluetoothDeviceClient() {
- return fake_bluetooth_device_client_.get();
+ return bluetooth_device_client_.get();
}
BluetoothInputClient*
FakeDBusThreadManager::GetBluetoothInputClient() {
- return fake_bluetooth_input_client_.get();
+ return bluetooth_input_client_.get();
}
BluetoothProfileManagerClient*
FakeDBusThreadManager::GetBluetoothProfileManagerClient() {
- return fake_bluetooth_profile_manager_client_.get();
+ return bluetooth_profile_manager_client_.get();
}
CrasAudioClient* FakeDBusThreadManager::GetCrasAudioClient() {
- return NULL;
+ return cras_audio_client_.get();
}
CrosDisksClient* FakeDBusThreadManager::GetCrosDisksClient() {
- return fake_cros_disks_client_.get();
+ return cros_disks_client_.get();
}
CryptohomeClient* FakeDBusThreadManager::GetCryptohomeClient() {
- return fake_cryptohome_client_.get();
+ return cryptohome_client_.get();
}
DebugDaemonClient* FakeDBusThreadManager::GetDebugDaemonClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return debug_daemon_client_.get();
}
ShillDeviceClient*
FakeDBusThreadManager::GetShillDeviceClient() {
- return fake_shill_device_client_.get();
+ return shill_device_client_.get();
}
ShillIPConfigClient*
FakeDBusThreadManager::GetShillIPConfigClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return shill_ipconfig_client_.get();
}
ShillManagerClient*
FakeDBusThreadManager::GetShillManagerClient() {
- return fake_shill_manager_client_.get();
+ return shill_manager_client_.get();
}
ShillProfileClient*
FakeDBusThreadManager::GetShillProfileClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return shill_profile_client_.get();
}
ShillServiceClient*
FakeDBusThreadManager::GetShillServiceClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return shill_service_client_.get();
}
GsmSMSClient* FakeDBusThreadManager::GetGsmSMSClient() {
- return fake_gsm_sms_client_.get();
+ return gsm_sms_client_.get();
}
ImageBurnerClient* FakeDBusThreadManager::GetImageBurnerClient() {
- return fake_image_burner_client_.get();
+ return image_burner_client_.get();
}
IntrospectableClient*
FakeDBusThreadManager::GetIntrospectableClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return introspectable_client_.get();
}
ModemMessagingClient*
FakeDBusThreadManager::GetModemMessagingClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return modem_messaging_client_.get();
}
NfcAdapterClient* FakeDBusThreadManager::GetNfcAdapterClient() {
- return fake_nfc_adapter_client_.get();
+ return nfc_adapter_client_.get();
}
NfcDeviceClient* FakeDBusThreadManager::GetNfcDeviceClient() {
- return fake_nfc_device_client_.get();
+ return nfc_device_client_.get();
}
NfcManagerClient* FakeDBusThreadManager::GetNfcManagerClient() {
- return fake_nfc_manager_client_.get();
+ return nfc_manager_client_.get();
}
NfcTagClient* FakeDBusThreadManager::GetNfcTagClient() {
- return fake_nfc_tag_client_.get();
+ return nfc_tag_client_.get();
}
PermissionBrokerClient*
FakeDBusThreadManager::GetPermissionBrokerClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return permission_broker_client_.get();
}
PowerManagerClient* FakeDBusThreadManager::GetPowerManagerClient() {
- return fake_power_manager_client_.get();
+ return power_manager_client_.get();
}
PowerPolicyController*
@@ -207,24 +333,23 @@ FakeDBusThreadManager::GetPowerPolicyController() {
SessionManagerClient*
FakeDBusThreadManager::GetSessionManagerClient() {
- return fake_session_manager_client_.get();
+ return session_manager_client_.get();
}
SMSClient* FakeDBusThreadManager::GetSMSClient() {
- NOTIMPLEMENTED();
- return NULL;
+ return sms_client_.get();
}
SystemClockClient* FakeDBusThreadManager::GetSystemClockClient() {
- return fake_system_clock_client_.get();
+ return system_clock_client_.get();
}
UpdateEngineClient* FakeDBusThreadManager::GetUpdateEngineClient() {
- return fake_update_engine_client_.get();
+ return update_engine_client_.get();
}
IBusClient* FakeDBusThreadManager::GetIBusClient() {
- return mock_ibus_client_.get();
+ return ibus_client_.get();
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698