diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-15 03:32:02 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-15 03:32:02 +0000 |
commit | 71af898b4fc0bd528948adf220a586f2b7d3ace4 (patch) | |
tree | 943cccf84c1c021e9185c7d2658597ae5f20e0a8 | |
parent | f9b928388cfc6704c48f68d79151e51d77d9254e (diff) | |
download | chromium_src-71af898b4fc0bd528948adf220a586f2b7d3ace4.zip chromium_src-71af898b4fc0bd528948adf220a586f2b7d3ace4.tar.gz chromium_src-71af898b4fc0bd528948adf220a586f2b7d3ace4.tar.bz2 |
Part 2: Merged MixedDBusThreadManager functionality into DBusClientBundle.
BUG=401192
TEST=existing tests
Review URL: https://codereview.chromium.org/472953002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289768 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chromeos/chromeos.gyp | 2 | ||||
-rw-r--r-- | chromeos/dbus/dbus_client_bundle.cc | 122 | ||||
-rw-r--r-- | chromeos/dbus/dbus_client_bundle.h | 3 | ||||
-rw-r--r-- | chromeos/dbus/dbus_thread_manager.cc | 17 | ||||
-rw-r--r-- | chromeos/dbus/mixed_dbus_thread_manager.cc | 205 | ||||
-rw-r--r-- | chromeos/dbus/mixed_dbus_thread_manager.h | 81 |
6 files changed, 122 insertions, 308 deletions
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp index 0cf0cf2..d038ec5 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp @@ -205,8 +205,6 @@ 'dbus/introspectable_client.h', 'dbus/lorgnette_manager_client.cc', 'dbus/lorgnette_manager_client.h', - 'dbus/mixed_dbus_thread_manager.cc', - 'dbus/mixed_dbus_thread_manager.h', 'dbus/modem_messaging_client.cc', 'dbus/modem_messaging_client.h', 'dbus/nfc_adapter_client.cc', diff --git a/chromeos/dbus/dbus_client_bundle.cc b/chromeos/dbus/dbus_client_bundle.cc index b5ccb8e..4ab8f3e 100644 --- a/chromeos/dbus/dbus_client_bundle.cc +++ b/chromeos/dbus/dbus_client_bundle.cc @@ -4,8 +4,10 @@ #include "chromeos/dbus/dbus_client_bundle.h" +#include "base/command_line.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" +#include "chromeos/chromeos_switches.h" #include "chromeos/dbus/bluetooth_adapter_client.h" #include "chromeos/dbus/bluetooth_agent_manager_client.h" #include "chromeos/dbus/bluetooth_device_client.h" @@ -16,11 +18,42 @@ #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/cras_audio_client_stub_impl.h" #include "chromeos/dbus/cros_disks_client.h" #include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/debug_daemon_client.h" #include "chromeos/dbus/easy_unlock_client.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_gatt_characteristic_client.h" +#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" +#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h" +#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" +#include "chromeos/dbus/fake_bluetooth_input_client.h" +#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" +#include "chromeos/dbus/fake_cryptohome_client.h" +#include "chromeos/dbus/fake_debug_daemon_client.h" +#include "chromeos/dbus/fake_easy_unlock_client.h" +#include "chromeos/dbus/fake_gsm_sms_client.h" +#include "chromeos/dbus/fake_image_burner_client.h" +#include "chromeos/dbus/fake_introspectable_client.h" +#include "chromeos/dbus/fake_lorgnette_manager_client.h" +#include "chromeos/dbus/fake_modem_messaging_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_record_client.h" +#include "chromeos/dbus/fake_nfc_tag_client.h" +#include "chromeos/dbus/fake_permission_broker_client.h" +#include "chromeos/dbus/fake_shill_device_client.h" +#include "chromeos/dbus/fake_shill_ipconfig_client.h" +#include "chromeos/dbus/fake_shill_manager_client.h" +#include "chromeos/dbus/fake_shill_profile_client.h" +#include "chromeos/dbus/fake_shill_service_client.h" +#include "chromeos/dbus/fake_sms_client.h" +#include "chromeos/dbus/fake_system_clock_client.h" #include "chromeos/dbus/gsm_sms_client.h" #include "chromeos/dbus/image_burner_client.h" #include "chromeos/dbus/introspectable_client.h" @@ -89,8 +122,6 @@ DBusClientBundle::DBusClientType GetDBusClientType( } // namespace DBusClientBundle::DBusClientBundle() { - const DBusClientImplementationType type = REAL_DBUS_CLIENT_IMPLEMENTATION; - if (!DBusThreadManager::IsUsingStub(BLUETOOTH)) { bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create()); bluetooth_agent_manager_client_.reset( @@ -107,25 +138,50 @@ DBusClientBundle::DBusClientBundle() { BluetoothGattManagerClient::Create()); bluetooth_gatt_service_client_.reset( BluetoothGattServiceClient::Create()); + } else { + bluetooth_adapter_client_.reset(new FakeBluetoothAdapterClient); + bluetooth_agent_manager_client_.reset(new FakeBluetoothAgentManagerClient); + bluetooth_device_client_.reset(new FakeBluetoothDeviceClient); + bluetooth_input_client_.reset(new FakeBluetoothInputClient); + bluetooth_profile_manager_client_.reset( + new FakeBluetoothProfileManagerClient); + bluetooth_gatt_characteristic_client_.reset( + new FakeBluetoothGattCharacteristicClient); + bluetooth_gatt_descriptor_client_.reset( + new FakeBluetoothGattDescriptorClient); + bluetooth_gatt_manager_client_.reset(new FakeBluetoothGattManagerClient); + bluetooth_gatt_service_client_.reset(new FakeBluetoothGattServiceClient); } if (!DBusThreadManager::IsUsingStub(CRAS)) cras_audio_client_.reset(CrasAudioClient::Create()); + else + cras_audio_client_.reset(new CrasAudioClientStubImpl); - if (!DBusThreadManager::IsUsingStub(CROS_DISKS)) - cros_disks_client_.reset(CrosDisksClient::Create(type)); + cros_disks_client_.reset(CrosDisksClient::Create( + DBusThreadManager::IsUsingStub(CROS_DISKS) ? + STUB_DBUS_CLIENT_IMPLEMENTATION : + REAL_DBUS_CLIENT_IMPLEMENTATION)); if (!DBusThreadManager::IsUsingStub(CRYPTOHOME)) cryptohome_client_.reset(CryptohomeClient::Create()); + else + cryptohome_client_.reset(new FakeCryptohomeClient); if (!DBusThreadManager::IsUsingStub(DEBUG_DAEMON)) debug_daemon_client_.reset(DebugDaemonClient::Create()); + else + debug_daemon_client_.reset(new FakeDebugDaemonClient); if (!DBusThreadManager::IsUsingStub(EASY_UNLOCK)) easy_unlock_client_.reset(EasyUnlockClient::Create()); + else + easy_unlock_client_.reset(new FakeEasyUnlockClient); if (!DBusThreadManager::IsUsingStub(LORGNETTE_MANAGER)) lorgnette_manager_client_.reset(LorgnetteManagerClient::Create()); + else + lorgnette_manager_client_.reset(new FakeLorgnetteManagerClient); if (!DBusThreadManager::IsUsingStub(SHILL)) { shill_manager_client_.reset(ShillManagerClient::Create()); @@ -133,19 +189,38 @@ DBusClientBundle::DBusClientBundle() { shill_ipconfig_client_.reset(ShillIPConfigClient::Create()); shill_service_client_.reset(ShillServiceClient::Create()); shill_profile_client_.reset(ShillProfileClient::Create()); + } else { + shill_manager_client_.reset(new FakeShillManagerClient); + shill_device_client_.reset(new FakeShillDeviceClient); + shill_ipconfig_client_.reset(new FakeShillIPConfigClient); + shill_service_client_.reset(new FakeShillServiceClient); + shill_profile_client_.reset(new FakeShillProfileClient); } - if (!DBusThreadManager::IsUsingStub(GSM_SMS)) + if (!DBusThreadManager::IsUsingStub(GSM_SMS)) { gsm_sms_client_.reset(GsmSMSClient::Create()); + } else { + FakeGsmSMSClient* gsm_sms_client = new FakeGsmSMSClient(); + gsm_sms_client->set_sms_test_message_switch_present( + CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kSmsTestMessages)); + gsm_sms_client_.reset(gsm_sms_client); + } if (!DBusThreadManager::IsUsingStub(IMAGE_BURNER)) image_burner_client_.reset(ImageBurnerClient::Create()); + else + image_burner_client_.reset(new FakeImageBurnerClient); if (!DBusThreadManager::IsUsingStub(INTROSPECTABLE)) introspectable_client_.reset(IntrospectableClient::Create()); + else + introspectable_client_.reset(new FakeIntrospectableClient); if (!DBusThreadManager::IsUsingStub(MODEM_MESSAGING)) modem_messaging_client_.reset(ModemMessagingClient::Create()); + else + modem_messaging_client_.reset(ModemMessagingClient::Create()); // Create the NFC clients in the correct order based on their dependencies. if (!DBusThreadManager::IsUsingStub(NFC)) { @@ -157,30 +232,55 @@ DBusClientBundle::DBusClientBundle() { nfc_tag_client_.reset(NfcTagClient::Create(nfc_adapter_client_.get())); nfc_record_client_.reset(NfcRecordClient::Create(nfc_device_client_.get(), nfc_tag_client_.get())); + } else { + nfc_manager_client_.reset(new FakeNfcManagerClient); + nfc_adapter_client_.reset(new FakeNfcAdapterClient); + nfc_device_client_.reset(new FakeNfcDeviceClient); + nfc_tag_client_.reset(new FakeNfcTagClient); + nfc_record_client_.reset(new FakeNfcRecordClient); } if (!DBusThreadManager::IsUsingStub(PERMISSION_BROKER)) permission_broker_client_.reset(PermissionBrokerClient::Create()); + else + permission_broker_client_.reset(new FakePermissionBrokerClient); - if (!DBusThreadManager::IsUsingStub(POWER_MANAGER)) - power_manager_client_.reset(PowerManagerClient::Create(type)); + power_manager_client_.reset(PowerManagerClient::Create( + DBusThreadManager::IsUsingStub(CROS_DISKS) ? + STUB_DBUS_CLIENT_IMPLEMENTATION : + REAL_DBUS_CLIENT_IMPLEMENTATION)); - if (!DBusThreadManager::IsUsingStub(SESSION_MANAGER)) - session_manager_client_.reset(SessionManagerClient::Create(type)); + session_manager_client_.reset(SessionManagerClient::Create( + DBusThreadManager::IsUsingStub(CROS_DISKS) ? + STUB_DBUS_CLIENT_IMPLEMENTATION : + REAL_DBUS_CLIENT_IMPLEMENTATION)); if (!DBusThreadManager::IsUsingStub(SMS)) sms_client_.reset(SMSClient::Create()); + else + sms_client_.reset(new FakeSMSClient); if (!DBusThreadManager::IsUsingStub(SYSTEM_CLOCK)) system_clock_client_.reset(SystemClockClient::Create()); + else + system_clock_client_.reset(new FakeSystemClockClient); - if (!DBusThreadManager::IsUsingStub(UPDATE_ENGINE)) - update_engine_client_.reset(UpdateEngineClient::Create(type)); + update_engine_client_.reset(UpdateEngineClient::Create( + DBusThreadManager::IsUsingStub(CROS_DISKS) ? + STUB_DBUS_CLIENT_IMPLEMENTATION : + REAL_DBUS_CLIENT_IMPLEMENTATION)); } DBusClientBundle::~DBusClientBundle() { } +void DBusClientBundle::SetupDefaultEnvironment() { + ShillManagerClient::TestInterface* manager = + shill_manager_client_->GetTestInterface(); + if (manager) + manager->SetupDefaultEnvironment(); +} + // static DBusClientBundle::DBusClientTypeMask DBusClientBundle::ParseUnstubList( const std::string& unstub_list) { diff --git a/chromeos/dbus/dbus_client_bundle.h b/chromeos/dbus/dbus_client_bundle.h index 44f3f7b..9d5d22d 100644 --- a/chromeos/dbus/dbus_client_bundle.h +++ b/chromeos/dbus/dbus_client_bundle.h @@ -82,6 +82,9 @@ class CHROMEOS_EXPORT DBusClientBundle { DBusClientBundle(); virtual ~DBusClientBundle(); + // Initialize proper runtime environment for its dbus clients. + void SetupDefaultEnvironment(); + // Parses command line param values for dbus subsystem that should be // un-stubbed. static DBusClientTypeMask ParseUnstubList(const std::string& unstub_list); diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index 08044b5..f2edfad 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc @@ -29,7 +29,6 @@ #include "chromeos/dbus/image_burner_client.h" #include "chromeos/dbus/introspectable_client.h" #include "chromeos/dbus/lorgnette_manager_client.h" -#include "chromeos/dbus/mixed_dbus_thread_manager.h" #include "chromeos/dbus/modem_messaging_client.h" #include "chromeos/dbus/nfc_adapter_client.h" #include "chromeos/dbus/nfc_device_client.h" @@ -94,6 +93,10 @@ class DBusThreadManagerImpl : public DBusThreadManager { dbus_thread_->Stop(); } + void SetupDefaultEnvironment() { + return client_bundle_->SetupDefaultEnvironment(); + } + virtual dbus::Bus* GetSystemBus() OVERRIDE { return system_bus_.get(); } @@ -252,8 +255,7 @@ class DBusThreadManagerImpl : public DBusThreadManager { client_bundle_.reset(new DBusClientBundle()); // TODO(crbug.com/345586): Move PowerPolicyController out of // DBusThreadManagerImpl. - if (!DBusThreadManager::IsUsingStub(DBusClientBundle::POWER_MANAGER)) - power_policy_controller_.reset(new PowerPolicyController); + power_policy_controller_.reset(new PowerPolicyController); } scoped_ptr<base::Thread> dbus_thread_; @@ -338,14 +340,11 @@ void DBusThreadManager::InitializeWithPartialStub( << " cannot be parsed: " << unstub_clients; } - DBusThreadManager* real_thread_manager = new DBusThreadManagerImpl(); - FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; - fake_dbus_thread_manager->SetFakeClients(); + DBusThreadManagerImpl* dbus_thread_manager = new DBusThreadManagerImpl(); VLOG(1) << "DBusThreadManager initialized for mixed runtime environment"; - g_dbus_thread_manager = new MixedDBusThreadManager(real_thread_manager, - fake_dbus_thread_manager); + g_dbus_thread_manager = dbus_thread_manager; InitializeClients(); - fake_dbus_thread_manager->SetupDefaultEnvironment(); + dbus_thread_manager->SetupDefaultEnvironment(); } // static diff --git a/chromeos/dbus/mixed_dbus_thread_manager.cc b/chromeos/dbus/mixed_dbus_thread_manager.cc deleted file mode 100644 index 3ca5d09..0000000 --- a/chromeos/dbus/mixed_dbus_thread_manager.cc +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/dbus/mixed_dbus_thread_manager.h" - -namespace chromeos { - -MixedDBusThreadManager::MixedDBusThreadManager( - DBusThreadManager* real_thread_manager, - DBusThreadManager* fake_thread_manager) - : real_thread_manager_(real_thread_manager), - fake_thread_manager_(fake_thread_manager) { -} - -MixedDBusThreadManager::~MixedDBusThreadManager() { -} - -// DBusThreadManager overrides. - dbus::Bus* MixedDBusThreadManager::GetSystemBus() { - return real_thread_manager_->GetSystemBus(); -} - - BluetoothAdapterClient* MixedDBusThreadManager::GetBluetoothAdapterClient() { - return GetThreadManager( - DBusClientBundle::BLUETOOTH)->GetBluetoothAdapterClient(); -} - - BluetoothAgentManagerClient* - MixedDBusThreadManager::GetBluetoothAgentManagerClient() { - return GetThreadManager( - DBusClientBundle::BLUETOOTH)->GetBluetoothAgentManagerClient(); -} - - BluetoothDeviceClient* MixedDBusThreadManager::GetBluetoothDeviceClient() { - return GetThreadManager( - DBusClientBundle::BLUETOOTH)->GetBluetoothDeviceClient(); -} - - BluetoothGattCharacteristicClient* - MixedDBusThreadManager::GetBluetoothGattCharacteristicClient() { - return GetThreadManager(DBusClientBundle::BLUETOOTH)-> - GetBluetoothGattCharacteristicClient(); -} - - BluetoothGattDescriptorClient* - MixedDBusThreadManager::GetBluetoothGattDescriptorClient() { - return GetThreadManager(DBusClientBundle::BLUETOOTH)-> - GetBluetoothGattDescriptorClient(); -} - - BluetoothGattManagerClient* - MixedDBusThreadManager::GetBluetoothGattManagerClient() { - return GetThreadManager( - DBusClientBundle::BLUETOOTH)->GetBluetoothGattManagerClient(); -} - - BluetoothGattServiceClient* - MixedDBusThreadManager::GetBluetoothGattServiceClient() { - return GetThreadManager( - DBusClientBundle::BLUETOOTH)->GetBluetoothGattServiceClient(); -} - - BluetoothInputClient* MixedDBusThreadManager::GetBluetoothInputClient() { - return GetThreadManager( - DBusClientBundle::BLUETOOTH)->GetBluetoothInputClient(); -} - - BluetoothProfileManagerClient* - MixedDBusThreadManager::GetBluetoothProfileManagerClient() { - return GetThreadManager( - DBusClientBundle::BLUETOOTH)->GetBluetoothProfileManagerClient(); -} - - CrasAudioClient* MixedDBusThreadManager::GetCrasAudioClient() { - return GetThreadManager( - DBusClientBundle::CRAS)->GetCrasAudioClient(); -} - - CrosDisksClient* MixedDBusThreadManager::GetCrosDisksClient() { - return GetThreadManager(DBusClientBundle::CROS_DISKS)->GetCrosDisksClient(); -} - - CryptohomeClient* MixedDBusThreadManager::GetCryptohomeClient() { - return GetThreadManager( - DBusClientBundle::CRYPTOHOME)->GetCryptohomeClient(); -} - - DebugDaemonClient* MixedDBusThreadManager::GetDebugDaemonClient() { - return GetThreadManager( - DBusClientBundle::DEBUG_DAEMON)->GetDebugDaemonClient(); -} - - EasyUnlockClient* MixedDBusThreadManager::GetEasyUnlockClient() { - return GetThreadManager( - DBusClientBundle::EASY_UNLOCK)->GetEasyUnlockClient(); -} - - LorgnetteManagerClient* MixedDBusThreadManager::GetLorgnetteManagerClient() { - return GetThreadManager( - DBusClientBundle::LORGNETTE_MANAGER)->GetLorgnetteManagerClient(); -} - - ShillDeviceClient* MixedDBusThreadManager::GetShillDeviceClient() { - return GetThreadManager(DBusClientBundle::SHILL)->GetShillDeviceClient(); -} - -ShillIPConfigClient* MixedDBusThreadManager::GetShillIPConfigClient() { - return GetThreadManager(DBusClientBundle::SHILL)->GetShillIPConfigClient(); -} - -ShillManagerClient* MixedDBusThreadManager::GetShillManagerClient() { - return GetThreadManager(DBusClientBundle::SHILL)->GetShillManagerClient(); -} - -ShillProfileClient* MixedDBusThreadManager::GetShillProfileClient() { - return GetThreadManager(DBusClientBundle::SHILL)->GetShillProfileClient(); -} - -ShillServiceClient* MixedDBusThreadManager::GetShillServiceClient() { - return GetThreadManager(DBusClientBundle::SHILL)->GetShillServiceClient(); -} - -GsmSMSClient* MixedDBusThreadManager::GetGsmSMSClient() { - return GetThreadManager(DBusClientBundle::GSM_SMS)->GetGsmSMSClient(); -} - -ImageBurnerClient* MixedDBusThreadManager::GetImageBurnerClient() { - return GetThreadManager( - DBusClientBundle::IMAGE_BURNER)->GetImageBurnerClient(); -} - -IntrospectableClient* MixedDBusThreadManager::GetIntrospectableClient() { - return GetThreadManager( - DBusClientBundle::INTROSPECTABLE)->GetIntrospectableClient(); -} - -ModemMessagingClient* MixedDBusThreadManager::GetModemMessagingClient() { - return GetThreadManager( - DBusClientBundle::MODEM_MESSAGING)->GetModemMessagingClient(); -} - -NfcAdapterClient* MixedDBusThreadManager::GetNfcAdapterClient() { - return GetThreadManager(DBusClientBundle::NFC)->GetNfcAdapterClient(); -} - -NfcDeviceClient* MixedDBusThreadManager::GetNfcDeviceClient() { - return GetThreadManager(DBusClientBundle::NFC)->GetNfcDeviceClient(); -} - -NfcManagerClient* MixedDBusThreadManager::GetNfcManagerClient() { - return GetThreadManager(DBusClientBundle::NFC)->GetNfcManagerClient(); -} - -NfcRecordClient* MixedDBusThreadManager::GetNfcRecordClient() { - return GetThreadManager(DBusClientBundle::NFC)->GetNfcRecordClient(); -} - -NfcTagClient* MixedDBusThreadManager::GetNfcTagClient() { - return GetThreadManager(DBusClientBundle::NFC)->GetNfcTagClient(); -} - -PermissionBrokerClient* MixedDBusThreadManager::GetPermissionBrokerClient() { - return GetThreadManager( - DBusClientBundle::PERMISSION_BROKER)->GetPermissionBrokerClient(); -} - -PowerManagerClient* MixedDBusThreadManager::GetPowerManagerClient() { - return GetThreadManager( - DBusClientBundle::POWER_MANAGER)->GetPowerManagerClient(); -} - -PowerPolicyController* MixedDBusThreadManager::GetPowerPolicyController() { - return GetThreadManager( - DBusClientBundle::POWER_MANAGER)->GetPowerPolicyController(); -} - -SessionManagerClient* MixedDBusThreadManager::GetSessionManagerClient() { - return GetThreadManager( - DBusClientBundle::SESSION_MANAGER)->GetSessionManagerClient(); -} - -SMSClient* MixedDBusThreadManager::GetSMSClient() { - return GetThreadManager(DBusClientBundle::SMS)->GetSMSClient(); -} - -SystemClockClient* MixedDBusThreadManager::GetSystemClockClient() { - return GetThreadManager( - DBusClientBundle::SYSTEM_CLOCK)->GetSystemClockClient(); -} - -UpdateEngineClient* MixedDBusThreadManager::GetUpdateEngineClient() { - return GetThreadManager( - DBusClientBundle::UPDATE_ENGINE)->GetUpdateEngineClient(); -} - -DBusThreadManager* MixedDBusThreadManager::GetThreadManager( - DBusClientBundle::DBusClientType client) { - if (DBusThreadManager::IsUsingStub(client)) - return fake_thread_manager_.get(); - - return real_thread_manager_.get(); -} - -} // namespace chromeos diff --git a/chromeos/dbus/mixed_dbus_thread_manager.h b/chromeos/dbus/mixed_dbus_thread_manager.h deleted file mode 100644 index 7ae8bb9..0000000 --- a/chromeos/dbus/mixed_dbus_thread_manager.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_DBUS_MIXED_DBUS_THREAD_MANAGER_H_ -#define CHROMEOS_DBUS_MIXED_DBUS_THREAD_MANAGER_H_ - -#include "base/memory/scoped_ptr.h" -#include "chromeos/chromeos_export.h" -#include "chromeos/dbus/dbus_thread_manager.h" - -namespace chromeos { - -// This class permits mixing DBusThreadManagerImpl and FakeDBusThreadManager -// implementation and allow us to selectively activate some dbus clients while -// others remain stubbed out. -class CHROMEOS_EXPORT MixedDBusThreadManager : public DBusThreadManager { - public: - explicit MixedDBusThreadManager( - DBusThreadManager* real_thread_manager, - DBusThreadManager* fake_thread_manager); - - virtual ~MixedDBusThreadManager(); - - // DBusThreadManager overrides. - virtual dbus::Bus* GetSystemBus() OVERRIDE; - virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE; - virtual BluetoothAgentManagerClient* - GetBluetoothAgentManagerClient() OVERRIDE; - virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE; - virtual BluetoothGattCharacteristicClient* - GetBluetoothGattCharacteristicClient() OVERRIDE; - virtual BluetoothGattDescriptorClient* - GetBluetoothGattDescriptorClient() OVERRIDE; - virtual BluetoothGattManagerClient* GetBluetoothGattManagerClient() OVERRIDE; - virtual BluetoothGattServiceClient* GetBluetoothGattServiceClient() OVERRIDE; - virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE; - virtual BluetoothProfileManagerClient* - GetBluetoothProfileManagerClient() OVERRIDE; - virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE; - virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE; - virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE; - virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE; - virtual EasyUnlockClient* GetEasyUnlockClient() OVERRIDE; - virtual LorgnetteManagerClient* GetLorgnetteManagerClient() OVERRIDE; - virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE; - virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE; - virtual ShillManagerClient* GetShillManagerClient() OVERRIDE; - virtual ShillProfileClient* GetShillProfileClient() OVERRIDE; - virtual ShillServiceClient* GetShillServiceClient() OVERRIDE; - virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE; - virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE; - virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE; - virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE; - virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE; - virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE; - virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE; - virtual NfcRecordClient* GetNfcRecordClient() OVERRIDE; - virtual NfcTagClient* GetNfcTagClient() OVERRIDE; - virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE; - virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE; - virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE; - virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE; - virtual SMSClient* GetSMSClient() OVERRIDE; - virtual SystemClockClient* GetSystemClockClient() OVERRIDE; - virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE; - - private: - // Returns either the real or fake DBusThreadManager implementation based on - // |client| and |unstub_mask_|. - DBusThreadManager* GetThreadManager(DBusClientBundle::DBusClientType client); - - scoped_ptr<DBusThreadManager> real_thread_manager_; - scoped_ptr<DBusThreadManager> fake_thread_manager_; - - DISALLOW_COPY_AND_ASSIGN(MixedDBusThreadManager); -}; - -} // namespace chromeos - -#endif // CHROMEOS_DBUS_MIXED_DBUS_THREAD_MANAGER_H_ |