diff options
author | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 09:59:45 +0000 |
---|---|---|
committer | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 09:59:45 +0000 |
commit | 6489b459d871f319d20c1ba37aa0ac2ed8bed78a (patch) | |
tree | 19cac61fca2f519cf5c7986e09b82f44218769c5 /chromeos | |
parent | 5d2cfdfe2bf4a5010fb00f8f03bf277d14f5641c (diff) | |
download | chromium_src-6489b459d871f319d20c1ba37aa0ac2ed8bed78a.zip chromium_src-6489b459d871f319d20c1ba37aa0ac2ed8bed78a.tar.gz chromium_src-6489b459d871f319d20c1ba37aa0ac2ed8bed78a.tar.bz2 |
Remove fake client creation from DBusClients' Create() functions.
The DBusClient interfaces shouldn't provide functionality related to testing code (like Stubs/fake implementations).
Instead fake clients are now directly created without relying on the static Create() functions. The now unused DBusClientImplementationType argument of the Create() functions could be removed.
BUG=275286
R=satorux@chromium.org
Review URL: https://codereview.chromium.org/91413002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
61 files changed, 136 insertions, 289 deletions
diff --git a/chromeos/dbus/bluetooth_adapter_client.cc b/chromeos/dbus/bluetooth_adapter_client.cc index d7c383f..afc379b 100644 --- a/chromeos/dbus/bluetooth_adapter_client.cc +++ b/chromeos/dbus/bluetooth_adapter_client.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/logging.h" -#include "chromeos/dbus/fake_bluetooth_adapter_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_manager.h" @@ -258,12 +257,8 @@ BluetoothAdapterClient::BluetoothAdapterClient() { BluetoothAdapterClient::~BluetoothAdapterClient() { } -BluetoothAdapterClient* BluetoothAdapterClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new BluetoothAdapterClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeBluetoothAdapterClient(); +BluetoothAdapterClient* BluetoothAdapterClient::Create() { + return new BluetoothAdapterClientImpl; } } // namespace chromeos diff --git a/chromeos/dbus/bluetooth_adapter_client.h b/chromeos/dbus/bluetooth_adapter_client.h index 5873e6b..298c4af 100644 --- a/chromeos/dbus/bluetooth_adapter_client.h +++ b/chromeos/dbus/bluetooth_adapter_client.h @@ -13,7 +13,6 @@ #include "base/values.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -139,7 +138,7 @@ class CHROMEOS_EXPORT BluetoothAdapterClient : public DBusClient { const ErrorCallback& error_callback) = 0; // Creates the instance. - static BluetoothAdapterClient* Create(DBusClientImplementationType type); + static BluetoothAdapterClient* Create(); // Constants used to indicate exceptional error conditions. static const char kNoResponseError[]; diff --git a/chromeos/dbus/bluetooth_agent_manager_client.cc b/chromeos/dbus/bluetooth_agent_manager_client.cc index 5bf534f..a07be49 100644 --- a/chromeos/dbus/bluetooth_agent_manager_client.cc +++ b/chromeos/dbus/bluetooth_agent_manager_client.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/logging.h" -#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -143,12 +142,8 @@ BluetoothAgentManagerClient::BluetoothAgentManagerClient() { BluetoothAgentManagerClient::~BluetoothAgentManagerClient() { } -BluetoothAgentManagerClient* BluetoothAgentManagerClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new BluetoothAgentManagerClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeBluetoothAgentManagerClient(); +BluetoothAgentManagerClient* BluetoothAgentManagerClient::Create() { + return new BluetoothAgentManagerClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/bluetooth_agent_manager_client.h b/chromeos/dbus/bluetooth_agent_manager_client.h index b3e481e..96ef5d0 100644 --- a/chromeos/dbus/bluetooth_agent_manager_client.h +++ b/chromeos/dbus/bluetooth_agent_manager_client.h @@ -12,7 +12,6 @@ #include "base/values.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" namespace chromeos { @@ -52,7 +51,7 @@ class CHROMEOS_EXPORT BluetoothAgentManagerClient : public DBusClient { const ErrorCallback& error_callback) = 0; // Creates the instance. - static BluetoothAgentManagerClient* Create(DBusClientImplementationType type); + static BluetoothAgentManagerClient* Create(); // Constants used to indicate exceptional error conditions. static const char kNoResponseError[]; diff --git a/chromeos/dbus/bluetooth_device_client.cc b/chromeos/dbus/bluetooth_device_client.cc index 605872c..033daf3 100644 --- a/chromeos/dbus/bluetooth_device_client.cc +++ b/chromeos/dbus/bluetooth_device_client.cc @@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/logging.h" #include "base/stl_util.h" -#include "chromeos/dbus/fake_bluetooth_device_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_manager.h" @@ -348,12 +347,8 @@ BluetoothDeviceClient::BluetoothDeviceClient() { BluetoothDeviceClient::~BluetoothDeviceClient() { } -BluetoothDeviceClient* BluetoothDeviceClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new BluetoothDeviceClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeBluetoothDeviceClient(); +BluetoothDeviceClient* BluetoothDeviceClient::Create() { + return new BluetoothDeviceClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/bluetooth_device_client.h b/chromeos/dbus/bluetooth_device_client.h index fcb0483..11f5a1c 100644 --- a/chromeos/dbus/bluetooth_device_client.h +++ b/chromeos/dbus/bluetooth_device_client.h @@ -13,7 +13,6 @@ #include "base/values.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -171,7 +170,7 @@ class CHROMEOS_EXPORT BluetoothDeviceClient : public DBusClient { const ErrorCallback& error_callback) = 0; // Creates the instance. - static BluetoothDeviceClient* Create(DBusClientImplementationType type); + static BluetoothDeviceClient* Create(); // Constants used to indicate exceptional error conditions. static const char kNoResponseError[]; diff --git a/chromeos/dbus/bluetooth_input_client.cc b/chromeos/dbus/bluetooth_input_client.cc index ddbc7a4..0cc59a8 100644 --- a/chromeos/dbus/bluetooth_input_client.cc +++ b/chromeos/dbus/bluetooth_input_client.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "base/stl_util.h" -#include "chromeos/dbus/fake_bluetooth_input_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_manager.h" @@ -135,12 +134,8 @@ BluetoothInputClient::BluetoothInputClient() { BluetoothInputClient::~BluetoothInputClient() { } -BluetoothInputClient* BluetoothInputClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new BluetoothInputClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeBluetoothInputClient(); +BluetoothInputClient* BluetoothInputClient::Create() { + return new BluetoothInputClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/bluetooth_input_client.h b/chromeos/dbus/bluetooth_input_client.h index 0e0bee5..5e4b8d5 100644 --- a/chromeos/dbus/bluetooth_input_client.h +++ b/chromeos/dbus/bluetooth_input_client.h @@ -12,7 +12,6 @@ #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -68,7 +67,7 @@ class CHROMEOS_EXPORT BluetoothInputClient : public DBusClient { virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; // Creates the instance. - static BluetoothInputClient* Create(DBusClientImplementationType type); + static BluetoothInputClient* Create(); protected: BluetoothInputClient(); diff --git a/chromeos/dbus/bluetooth_profile_manager_client.cc b/chromeos/dbus/bluetooth_profile_manager_client.cc index aebd0d8..ee2fe2b 100644 --- a/chromeos/dbus/bluetooth_profile_manager_client.cc +++ b/chromeos/dbus/bluetooth_profile_manager_client.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/logging.h" -#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -234,12 +233,8 @@ BluetoothProfileManagerClient::BluetoothProfileManagerClient() { BluetoothProfileManagerClient::~BluetoothProfileManagerClient() { } -BluetoothProfileManagerClient* BluetoothProfileManagerClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new BluetoothProfileManagerClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeBluetoothProfileManagerClient(); +BluetoothProfileManagerClient* BluetoothProfileManagerClient::Create() { + return new BluetoothProfileManagerClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/bluetooth_profile_manager_client.h b/chromeos/dbus/bluetooth_profile_manager_client.h index 771fbaf..4301ce9 100644 --- a/chromeos/dbus/bluetooth_profile_manager_client.h +++ b/chromeos/dbus/bluetooth_profile_manager_client.h @@ -12,7 +12,6 @@ #include "base/values.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" namespace chromeos { @@ -95,8 +94,7 @@ class CHROMEOS_EXPORT BluetoothProfileManagerClient : public DBusClient { // Creates the instance. - static BluetoothProfileManagerClient* Create( - DBusClientImplementationType type); + static BluetoothProfileManagerClient* Create(); // Constants used to indicate exceptional error conditions. static const char kNoResponseError[]; diff --git a/chromeos/dbus/cras_audio_client.cc b/chromeos/dbus/cras_audio_client.cc index 60443a2..42867db 100644 --- a/chromeos/dbus/cras_audio_client.cc +++ b/chromeos/dbus/cras_audio_client.cc @@ -401,12 +401,8 @@ CrasAudioClient::~CrasAudioClient() { } // static -CrasAudioClient* CrasAudioClient::Create(DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) { - return new CrasAudioClientImpl(); - } - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new CrasAudioClientStubImpl(); +CrasAudioClient* CrasAudioClient::Create() { + return new CrasAudioClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/cras_audio_client.h b/chromeos/dbus/cras_audio_client.h index 6d5def2..356c5ce 100644 --- a/chromeos/dbus/cras_audio_client.h +++ b/chromeos/dbus/cras_audio_client.h @@ -10,7 +10,6 @@ #include "chromeos/chromeos_export.h" #include "chromeos/dbus/audio_node.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/volume_state.h" namespace chromeos { @@ -97,7 +96,7 @@ class CHROMEOS_EXPORT CrasAudioClient : public DBusClient { virtual void SetActiveInputNode(uint64 node_id) = 0; // Creates the instance. - static CrasAudioClient* Create(DBusClientImplementationType type); + static CrasAudioClient* Create(); protected: // Create() should be used instead. diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc index 7165aa7..f0bbd18 100644 --- a/chromeos/dbus/cryptohome_client.cc +++ b/chromeos/dbus/cryptohome_client.cc @@ -10,7 +10,6 @@ #include "base/message_loop/message_loop.h" #include "chromeos/cryptohome/async_method_caller.h" #include "chromeos/dbus/blocking_method_caller.h" -#include "chromeos/dbus/fake_cryptohome_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -946,11 +945,8 @@ CryptohomeClient::CryptohomeClient() {} CryptohomeClient::~CryptohomeClient() {} // static -CryptohomeClient* CryptohomeClient::Create(DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new CryptohomeClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeCryptohomeClient(); +CryptohomeClient* CryptohomeClient::Create() { + return new CryptohomeClientImpl(); } // static diff --git a/chromeos/dbus/cryptohome_client.h b/chromeos/dbus/cryptohome_client.h index 2fcb975..81025a3 100644 --- a/chromeos/dbus/cryptohome_client.h +++ b/chromeos/dbus/cryptohome_client.h @@ -13,7 +13,6 @@ #include "chromeos/attestation/attestation_constants.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/dbus_method_call_status.h" namespace chromeos { @@ -64,7 +63,7 @@ class CHROMEOS_EXPORT CryptohomeClient : public DBusClient { // Factory function, creates a new instance and returns ownership. // For normal usage, access the singleton via DBusThreadManager::Get(). - static CryptohomeClient* Create(DBusClientImplementationType type); + static CryptohomeClient* Create(); // Returns the sanitized |username| that the stub implementation would return. static std::string GetStubSanitizedUsername(const std::string& username); diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index 87c61ad..7a8a417 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc @@ -20,7 +20,6 @@ #include "chromeos/dbus/cros_disks_client.h" #include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/dbus_thread_manager_observer.h" #include "chromeos/dbus/debug_daemon_client.h" #include "chromeos/dbus/fake_dbus_thread_manager.h" @@ -224,9 +223,8 @@ class DBusThreadManagerImpl : public DBusThreadManager { } private: - // Constructs all clients -- stub or real implementation according to - // |client_type| and |client_type_override| -- and stores them in the - // respective *_client_ member variable. + // Constructs all clients and stores them in the respective *_client_ member + // variable. void CreateDefaultClients() { DBusClientImplementationType client_type = REAL_DBUS_CLIENT_IMPLEMENTATION; DBusClientImplementationType client_type_override = @@ -238,49 +236,41 @@ class DBusThreadManagerImpl : public DBusThreadManager { client_type_override = STUB_DBUS_CLIENT_IMPLEMENTATION; } - bluetooth_adapter_client_.reset( - BluetoothAdapterClient::Create(client_type)); + bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create()); bluetooth_agent_manager_client_.reset( - BluetoothAgentManagerClient::Create(client_type)); - bluetooth_device_client_.reset(BluetoothDeviceClient::Create(client_type)); - bluetooth_input_client_.reset(BluetoothInputClient::Create(client_type)); + BluetoothAgentManagerClient::Create()); + bluetooth_device_client_.reset(BluetoothDeviceClient::Create()); + bluetooth_input_client_.reset(BluetoothInputClient::Create()); bluetooth_profile_manager_client_.reset( - BluetoothProfileManagerClient::Create(client_type)); - cras_audio_client_.reset(CrasAudioClient::Create(client_type)); + BluetoothProfileManagerClient::Create()); + cras_audio_client_.reset(CrasAudioClient::Create()); cros_disks_client_.reset(CrosDisksClient::Create(client_type)); - cryptohome_client_.reset(CryptohomeClient::Create(client_type)); + cryptohome_client_.reset(CryptohomeClient::Create()); debug_daemon_client_.reset(DebugDaemonClient::Create()); - shill_manager_client_.reset( - ShillManagerClient::Create(client_type_override)); - shill_device_client_.reset( - ShillDeviceClient::Create(client_type_override)); - shill_ipconfig_client_.reset( - ShillIPConfigClient::Create(client_type_override)); - shill_service_client_.reset( - ShillServiceClient::Create(client_type_override)); - shill_profile_client_.reset( - ShillProfileClient::Create(client_type_override)); - gsm_sms_client_.reset(GsmSMSClient::Create(client_type_override)); - image_burner_client_.reset(ImageBurnerClient::Create(client_type)); + shill_manager_client_.reset(ShillManagerClient::Create()); + shill_device_client_.reset(ShillDeviceClient::Create()); + shill_ipconfig_client_.reset(ShillIPConfigClient::Create()); + shill_service_client_.reset(ShillServiceClient::Create()); + shill_profile_client_.reset(ShillProfileClient::Create()); + gsm_sms_client_.reset(GsmSMSClient::Create()); + image_burner_client_.reset(ImageBurnerClient::Create()); introspectable_client_.reset(IntrospectableClient::Create()); modem_messaging_client_.reset(ModemMessagingClient::Create()); // Create the NFC clients in the correct order based on their dependencies. - nfc_manager_client_.reset(NfcManagerClient::Create(client_type)); + nfc_manager_client_.reset(NfcManagerClient::Create()); nfc_adapter_client_.reset( - NfcAdapterClient::Create(client_type, nfc_manager_client_.get())); + NfcAdapterClient::Create(nfc_manager_client_.get())); nfc_device_client_.reset( - NfcDeviceClient::Create(client_type, nfc_adapter_client_.get())); - nfc_tag_client_.reset( - NfcTagClient::Create(client_type, nfc_adapter_client_.get())); - nfc_record_client_.reset( - NfcRecordClient::Create( - client_type, nfc_device_client_.get(), nfc_tag_client_.get())); + NfcDeviceClient::Create(nfc_adapter_client_.get())); + nfc_tag_client_.reset(NfcTagClient::Create(nfc_adapter_client_.get())); + nfc_record_client_.reset(NfcRecordClient::Create(nfc_device_client_.get(), + nfc_tag_client_.get())); permission_broker_client_.reset(PermissionBrokerClient::Create()); power_manager_client_.reset( PowerManagerClient::Create(client_type_override)); session_manager_client_.reset(SessionManagerClient::Create(client_type)); sms_client_.reset(SMSClient::Create()); - system_clock_client_.reset(SystemClockClient::Create(client_type)); + system_clock_client_.reset(SystemClockClient::Create()); update_engine_client_.reset(UpdateEngineClient::Create(client_type)); power_policy_controller_.reset(new PowerPolicyController); diff --git a/chromeos/dbus/debug_daemon_client.h b/chromeos/dbus/debug_daemon_client.h index a7091a4..871f8b2 100644 --- a/chromeos/dbus/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon_client.h @@ -10,7 +10,6 @@ #include "base/platform_file.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include <map> diff --git a/chromeos/dbus/fake_bluetooth_adapter_client.h b/chromeos/dbus/fake_bluetooth_adapter_client.h index 051368f..11d22dc 100644 --- a/chromeos/dbus/fake_bluetooth_adapter_client.h +++ b/chromeos/dbus/fake_bluetooth_adapter_client.h @@ -12,7 +12,6 @@ #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/bluetooth_adapter_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" diff --git a/chromeos/dbus/fake_bluetooth_agent_manager_client.h b/chromeos/dbus/fake_bluetooth_agent_manager_client.h index 98ecdb2..fb0fe45 100644 --- a/chromeos/dbus/fake_bluetooth_agent_manager_client.h +++ b/chromeos/dbus/fake_bluetooth_agent_manager_client.h @@ -10,7 +10,6 @@ #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/bluetooth_agent_manager_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" diff --git a/chromeos/dbus/fake_bluetooth_agent_service_provider.h b/chromeos/dbus/fake_bluetooth_agent_service_provider.h index 82a401b..9536414 100644 --- a/chromeos/dbus/fake_bluetooth_agent_service_provider.h +++ b/chromeos/dbus/fake_bluetooth_agent_service_provider.h @@ -10,7 +10,6 @@ #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/bluetooth_agent_service_provider.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" diff --git a/chromeos/dbus/fake_bluetooth_device_client.h b/chromeos/dbus/fake_bluetooth_device_client.h index ccb68b7..95b21ba 100644 --- a/chromeos/dbus/fake_bluetooth_device_client.h +++ b/chromeos/dbus/fake_bluetooth_device_client.h @@ -15,7 +15,6 @@ #include "chromeos/dbus/bluetooth_agent_service_provider.h" #include "chromeos/dbus/bluetooth_device_client.h" #include "chromeos/dbus/bluetooth_profile_service_provider.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" diff --git a/chromeos/dbus/fake_bluetooth_input_client.h b/chromeos/dbus/fake_bluetooth_input_client.h index 3a284ae..a2aa620 100644 --- a/chromeos/dbus/fake_bluetooth_input_client.h +++ b/chromeos/dbus/fake_bluetooth_input_client.h @@ -9,7 +9,6 @@ #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/bluetooth_input_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" diff --git a/chromeos/dbus/fake_bluetooth_profile_manager_client.h b/chromeos/dbus/fake_bluetooth_profile_manager_client.h index c7fb935..3a93d40 100644 --- a/chromeos/dbus/fake_bluetooth_profile_manager_client.h +++ b/chromeos/dbus/fake_bluetooth_profile_manager_client.h @@ -13,7 +13,6 @@ #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/bluetooth_profile_manager_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" #include "dbus/property.h" diff --git a/chromeos/dbus/fake_bluetooth_profile_service_provider.h b/chromeos/dbus/fake_bluetooth_profile_service_provider.h index 14ffd25..9cb4fd8 100644 --- a/chromeos/dbus/fake_bluetooth_profile_service_provider.h +++ b/chromeos/dbus/fake_bluetooth_profile_service_provider.h @@ -10,7 +10,6 @@ #include "base/memory/scoped_ptr.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/bluetooth_profile_service_provider.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/file_descriptor.h" #include "dbus/object_path.h" diff --git a/chromeos/dbus/fake_dbus_thread_manager.cc b/chromeos/dbus/fake_dbus_thread_manager.cc index b32bef00..3dfffef 100644 --- a/chromeos/dbus/fake_dbus_thread_manager.cc +++ b/chromeos/dbus/fake_dbus_thread_manager.cc @@ -4,18 +4,22 @@ #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 "base/command_line.h" +#include "chromeos/chromeos_switches.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_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_cryptohome_client.h" #include "chromeos/dbus/fake_debug_daemon_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_modem_messaging_client.h" #include "chromeos/dbus/fake_nfc_adapter_client.h" @@ -24,18 +28,16 @@ #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/gsm_sms_client.h" -#include "chromeos/dbus/image_burner_client.h" +#include "chromeos/dbus/fake_system_clock_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/system_clock_client.h" #include "chromeos/dbus/update_engine_client.h" namespace chromeos { @@ -51,37 +53,41 @@ FakeDBusThreadManager::~FakeDBusThreadManager() { void FakeDBusThreadManager::SetFakeClients() { const DBusClientImplementationType client_type = STUB_DBUS_CLIENT_IMPLEMENTATION; - SetBluetoothAdapterClient(scoped_ptr<BluetoothAdapterClient>( - BluetoothAdapterClient::Create(client_type))); + SetBluetoothAdapterClient( + scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); SetBluetoothAgentManagerClient(scoped_ptr<BluetoothAgentManagerClient>( - BluetoothAgentManagerClient::Create(client_type))); - SetBluetoothDeviceClient(scoped_ptr<BluetoothDeviceClient>( - BluetoothDeviceClient::Create(client_type))); - SetBluetoothInputClient(scoped_ptr<BluetoothInputClient>( - BluetoothInputClient::Create(client_type))); + new FakeBluetoothAgentManagerClient)); + SetBluetoothDeviceClient( + scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); + SetBluetoothInputClient( + scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); SetBluetoothProfileManagerClient(scoped_ptr<BluetoothProfileManagerClient>( - BluetoothProfileManagerClient::Create(client_type))); - SetCrasAudioClient( - scoped_ptr<CrasAudioClient>(CrasAudioClient::Create(client_type))); + new FakeBluetoothProfileManagerClient)); SetCrosDisksClient( scoped_ptr<CrosDisksClient>(CrosDisksClient::Create(client_type))); - SetCryptohomeClient( - scoped_ptr<CryptohomeClient>(CryptohomeClient::Create(client_type))); + SetCrasAudioClient(scoped_ptr<CrasAudioClient>(new CrasAudioClientStubImpl)); + SetCryptohomeClient(scoped_ptr<CryptohomeClient>(new FakeCryptohomeClient)); SetDebugDaemonClient( scoped_ptr<DebugDaemonClient>(new FakeDebugDaemonClient)); SetShillManagerClient( - scoped_ptr<ShillManagerClient>(ShillManagerClient::Create(client_type))); + scoped_ptr<ShillManagerClient>(new FakeShillManagerClient)); SetShillDeviceClient( - scoped_ptr<ShillDeviceClient>(ShillDeviceClient::Create(client_type))); - SetShillIPConfigClient(scoped_ptr<ShillIPConfigClient>( - ShillIPConfigClient::Create(client_type))); + scoped_ptr<ShillDeviceClient>(new FakeShillDeviceClient)); + SetShillIPConfigClient( + scoped_ptr<ShillIPConfigClient>(new FakeShillIPConfigClient)); SetShillServiceClient( - scoped_ptr<ShillServiceClient>(ShillServiceClient::Create(client_type))); + scoped_ptr<ShillServiceClient>(new FakeShillServiceClient)); SetShillProfileClient( - scoped_ptr<ShillProfileClient>(ShillProfileClient::Create(client_type))); - SetGsmSMSClient(scoped_ptr<GsmSMSClient>(GsmSMSClient::Create(client_type))); + scoped_ptr<ShillProfileClient>(new FakeShillProfileClient)); + + FakeGsmSMSClient* gsm_sms_client = new FakeGsmSMSClient(); + gsm_sms_client->set_sms_test_message_switch_present( + CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kSmsTestMessages)); + SetGsmSMSClient(scoped_ptr<GsmSMSClient>(gsm_sms_client)); + SetImageBurnerClient( - scoped_ptr<ImageBurnerClient>(ImageBurnerClient::Create(client_type))); + scoped_ptr<ImageBurnerClient>(new FakeImageBurnerClient)); SetIntrospectableClient( scoped_ptr<IntrospectableClient>(new FakeIntrospectableClient)); SetModemMessagingClient( @@ -99,7 +105,7 @@ void FakeDBusThreadManager::SetFakeClients() { SessionManagerClient::Create(client_type))); SetSMSClient(scoped_ptr<SMSClient>(new FakeSMSClient)); SetSystemClockClient( - scoped_ptr<SystemClockClient>(SystemClockClient::Create(client_type))); + scoped_ptr<SystemClockClient>(new FakeSystemClockClient)); SetUpdateEngineClient( scoped_ptr<UpdateEngineClient>(UpdateEngineClient::Create(client_type))); diff --git a/chromeos/dbus/gsm_sms_client.cc b/chromeos/dbus/gsm_sms_client.cc index 4fead8d..0c730f4 100644 --- a/chromeos/dbus/gsm_sms_client.cc +++ b/chromeos/dbus/gsm_sms_client.cc @@ -8,15 +8,12 @@ #include <vector> #include "base/bind.h" -#include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/values.h" -#include "chromeos/chromeos_switches.h" -#include "chromeos/dbus/fake_gsm_sms_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_proxy.h" @@ -247,16 +244,8 @@ GsmSMSClient::GsmSMSClient() {} GsmSMSClient::~GsmSMSClient() {} // static -GsmSMSClient* GsmSMSClient::Create(DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new GsmSMSClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - - FakeGsmSMSClient* fake = new FakeGsmSMSClient(); - fake->set_sms_test_message_switch_present( - CommandLine::ForCurrentProcess()->HasSwitch( - chromeos::switches::kSmsTestMessages)); - return fake; +GsmSMSClient* GsmSMSClient::Create() { + return new GsmSMSClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/gsm_sms_client.h b/chromeos/dbus/gsm_sms_client.h index af30753..d90c96a 100644 --- a/chromeos/dbus/gsm_sms_client.h +++ b/chromeos/dbus/gsm_sms_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" namespace base { class DictionaryValue; @@ -39,7 +38,7 @@ class CHROMEOS_EXPORT GsmSMSClient : public DBusClient { // Factory function, creates a new instance and returns ownership. // For normal usage, access the singleton via DBusThreadManager::Get(). - static GsmSMSClient* Create(DBusClientImplementationType type); + static GsmSMSClient* Create(); // Sets SmsReceived signal handler. virtual void SetSmsReceivedHandler(const std::string& service_name, diff --git a/chromeos/dbus/gsm_sms_client_unittest.cc b/chromeos/dbus/gsm_sms_client_unittest.cc index 8a956c4..babe0ed 100644 --- a/chromeos/dbus/gsm_sms_client_unittest.cc +++ b/chromeos/dbus/gsm_sms_client_unittest.cc @@ -99,7 +99,7 @@ class GsmSMSClientTest : public testing::Test { EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); // Create a client with the mock bus. - client_.reset(GsmSMSClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION)); + client_.reset(GsmSMSClient::Create()); client_->Init(mock_bus_.get()); } diff --git a/chromeos/dbus/image_burner_client.cc b/chromeos/dbus/image_burner_client.cc index a807f07..013affe 100644 --- a/chromeos/dbus/image_burner_client.cc +++ b/chromeos/dbus/image_burner_client.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/compiler_specific.h" -#include "chromeos/dbus/fake_image_burner_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -144,12 +143,8 @@ ImageBurnerClient::~ImageBurnerClient() { } // static -ImageBurnerClient* ImageBurnerClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ImageBurnerClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeImageBurnerClient(); +ImageBurnerClient* ImageBurnerClient::Create() { + return new ImageBurnerClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/image_burner_client.h b/chromeos/dbus/image_burner_client.h index c6f65ef..bbd0616 100644 --- a/chromeos/dbus/image_burner_client.h +++ b/chromeos/dbus/image_burner_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" namespace chromeos { @@ -54,7 +53,7 @@ class CHROMEOS_EXPORT ImageBurnerClient : public DBusClient { // Factory function, creates a new instance and returns ownership. // For normal usage, access the singleton via DBusThreadManager::Get(). - static ImageBurnerClient* Create(DBusClientImplementationType type); + static ImageBurnerClient* Create(); protected: // Create() should be used instead. diff --git a/chromeos/dbus/introspectable_client.h b/chromeos/dbus/introspectable_client.h index 792b1ca..2f49636 100644 --- a/chromeos/dbus/introspectable_client.h +++ b/chromeos/dbus/introspectable_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "dbus/object_path.h" namespace chromeos { diff --git a/chromeos/dbus/modem_messaging_client.h b/chromeos/dbus/modem_messaging_client.h index d46a235..65ce2d3 100644 --- a/chromeos/dbus/modem_messaging_client.h +++ b/chromeos/dbus/modem_messaging_client.h @@ -12,7 +12,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" namespace dbus { class ObjectPath; diff --git a/chromeos/dbus/nfc_adapter_client.cc b/chromeos/dbus/nfc_adapter_client.cc index fc86d54..9627dda 100644 --- a/chromeos/dbus/nfc_adapter_client.cc +++ b/chromeos/dbus/nfc_adapter_client.cc @@ -11,7 +11,6 @@ #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/strings/stringprintf.h" -#include "chromeos/dbus/fake_nfc_adapter_client.h" #include "chromeos/dbus/nfc_manager_client.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -215,12 +214,8 @@ NfcAdapterClient::NfcAdapterClient() { NfcAdapterClient::~NfcAdapterClient() { } -NfcAdapterClient* NfcAdapterClient::Create(DBusClientImplementationType type, - NfcManagerClient* manager_client) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new NfcAdapterClientImpl(manager_client); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeNfcAdapterClient(); +NfcAdapterClient* NfcAdapterClient::Create(NfcManagerClient* manager_client) { + return new NfcAdapterClientImpl(manager_client); } } // namespace chromeos diff --git a/chromeos/dbus/nfc_adapter_client.h b/chromeos/dbus/nfc_adapter_client.h index 04f531f..1d3dc1f 100644 --- a/chromeos/dbus/nfc_adapter_client.h +++ b/chromeos/dbus/nfc_adapter_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/nfc_client_helpers.h" #include "chromeos/dbus/nfc_property_set.h" #include "dbus/object_path.h" @@ -110,8 +109,7 @@ class CHROMEOS_EXPORT NfcAdapterClient : public DBusClient { const nfc_client_helpers::ErrorCallback& error_callback) = 0; // Creates the instance. - static NfcAdapterClient* Create(DBusClientImplementationType type, - NfcManagerClient* manager_client); + static NfcAdapterClient* Create(NfcManagerClient* manager_client); protected: friend class NfcClientTest; diff --git a/chromeos/dbus/nfc_client_unittest.cc b/chromeos/dbus/nfc_client_unittest.cc index 94d7628..ed45c72 100644 --- a/chromeos/dbus/nfc_client_unittest.cc +++ b/chromeos/dbus/nfc_client_unittest.cc @@ -201,20 +201,12 @@ class NfcClientTest : public testing::Test { EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); // Create the clients. - manager_client_.reset( - NfcManagerClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION)); - adapter_client_.reset( - NfcAdapterClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - manager_client_.get())); - device_client_.reset( - NfcDeviceClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - adapter_client_.get())); - tag_client_.reset( - NfcTagClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - adapter_client_.get())); + manager_client_.reset(NfcManagerClient::Create()); + adapter_client_.reset(NfcAdapterClient::Create(manager_client_.get())); + device_client_.reset(NfcDeviceClient::Create(adapter_client_.get())); + tag_client_.reset(NfcTagClient::Create(adapter_client_.get())); record_client_.reset( - NfcRecordClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - device_client_.get(), tag_client_.get())); + NfcRecordClient::Create(device_client_.get(), tag_client_.get())); manager_client_->Init(mock_bus_.get()); adapter_client_->Init(mock_bus_.get()); device_client_->Init(mock_bus_.get()); diff --git a/chromeos/dbus/nfc_device_client.cc b/chromeos/dbus/nfc_device_client.cc index 94d4099..4d10d90 100644 --- a/chromeos/dbus/nfc_device_client.cc +++ b/chromeos/dbus/nfc_device_client.cc @@ -8,7 +8,6 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/strings/stringprintf.h" -#include "chromeos/dbus/fake_nfc_device_client.h" #include "chromeos/dbus/nfc_adapter_client.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -233,12 +232,8 @@ NfcDeviceClient::NfcDeviceClient() { NfcDeviceClient::~NfcDeviceClient() { } -NfcDeviceClient* NfcDeviceClient::Create(DBusClientImplementationType type, - NfcAdapterClient* adapter_client) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new NfcDeviceClientImpl(adapter_client); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeNfcDeviceClient(); +NfcDeviceClient* NfcDeviceClient::Create(NfcAdapterClient* adapter_client) { + return new NfcDeviceClientImpl(adapter_client); } } // namespace chromeos diff --git a/chromeos/dbus/nfc_device_client.h b/chromeos/dbus/nfc_device_client.h index 7f27cf8..2dff471 100644 --- a/chromeos/dbus/nfc_device_client.h +++ b/chromeos/dbus/nfc_device_client.h @@ -11,7 +11,6 @@ #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/nfc_client_helpers.h" #include "chromeos/dbus/nfc_property_set.h" #include "chromeos/dbus/nfc_record_client.h" @@ -96,8 +95,7 @@ class CHROMEOS_EXPORT NfcDeviceClient : public DBusClient { const nfc_client_helpers::ErrorCallback& error_callback) = 0; // Creates the instance. - static NfcDeviceClient* Create(DBusClientImplementationType type, - NfcAdapterClient* adapter_client); + static NfcDeviceClient* Create(NfcAdapterClient* adapter_client); protected: friend class NfcClientTest; diff --git a/chromeos/dbus/nfc_manager_client.cc b/chromeos/dbus/nfc_manager_client.cc index 6ee43a8..cf8c3d3a 100644 --- a/chromeos/dbus/nfc_manager_client.cc +++ b/chromeos/dbus/nfc_manager_client.cc @@ -7,7 +7,6 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "chromeos/dbus/fake_nfc_manager_client.h" #include "dbus/bus.h" #include "third_party/cros_system_api/dbus/service_constants.h" @@ -166,11 +165,8 @@ NfcManagerClient::~NfcManagerClient() { } // static -NfcManagerClient* NfcManagerClient::Create(DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new NfcManagerClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeNfcManagerClient(); +NfcManagerClient* NfcManagerClient::Create() { + return new NfcManagerClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/nfc_manager_client.h b/chromeos/dbus/nfc_manager_client.h index 200144c..db2215f 100644 --- a/chromeos/dbus/nfc_manager_client.h +++ b/chromeos/dbus/nfc_manager_client.h @@ -9,7 +9,6 @@ #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/nfc_property_set.h" #include "dbus/object_path.h" #include "dbus/object_proxy.h" @@ -62,7 +61,7 @@ class CHROMEOS_EXPORT NfcManagerClient : public DBusClient { virtual Properties* GetProperties() = 0; // Creates the instance. - static NfcManagerClient* Create(DBusClientImplementationType type); + static NfcManagerClient* Create(); protected: friend class NfcClientTest; diff --git a/chromeos/dbus/nfc_record_client.cc b/chromeos/dbus/nfc_record_client.cc index 753d33f..d7bbafd 100644 --- a/chromeos/dbus/nfc_record_client.cc +++ b/chromeos/dbus/nfc_record_client.cc @@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "chromeos/dbus/fake_nfc_record_client.h" #include "chromeos/dbus/nfc_device_client.h" #include "chromeos/dbus/nfc_tag_client.h" #include "dbus/bus.h" @@ -247,13 +246,9 @@ NfcRecordClient::NfcRecordClient() { NfcRecordClient::~NfcRecordClient() { } -NfcRecordClient* NfcRecordClient::Create(DBusClientImplementationType type, - NfcDeviceClient* device_client, +NfcRecordClient* NfcRecordClient::Create(NfcDeviceClient* device_client, NfcTagClient* tag_client) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new NfcRecordClientImpl(device_client, tag_client); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeNfcRecordClient(); + return new NfcRecordClientImpl(device_client, tag_client); } } // namespace chromeos diff --git a/chromeos/dbus/nfc_record_client.h b/chromeos/dbus/nfc_record_client.h index a7f1d91..b514bdb 100644 --- a/chromeos/dbus/nfc_record_client.h +++ b/chromeos/dbus/nfc_record_client.h @@ -9,7 +9,6 @@ #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/nfc_property_set.h" #include "dbus/object_path.h" #include "dbus/object_proxy.h" @@ -112,8 +111,7 @@ class CHROMEOS_EXPORT NfcRecordClient : public DBusClient { virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; // Creates the instance. - static NfcRecordClient* Create(DBusClientImplementationType type, - NfcDeviceClient* device_client, + static NfcRecordClient* Create(NfcDeviceClient* device_client, NfcTagClient* tag_client); protected: diff --git a/chromeos/dbus/nfc_tag_client.cc b/chromeos/dbus/nfc_tag_client.cc index ad80a51..9a166cc3 100644 --- a/chromeos/dbus/nfc_tag_client.cc +++ b/chromeos/dbus/nfc_tag_client.cc @@ -8,7 +8,6 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/strings/stringprintf.h" -#include "chromeos/dbus/fake_nfc_tag_client.h" #include "chromeos/dbus/nfc_adapter_client.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -240,12 +239,8 @@ NfcTagClient::NfcTagClient() { NfcTagClient::~NfcTagClient() { } -NfcTagClient* NfcTagClient::Create(DBusClientImplementationType type, - NfcAdapterClient* adapter_client) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new NfcTagClientImpl(adapter_client); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeNfcTagClient(); +NfcTagClient* NfcTagClient::Create(NfcAdapterClient* adapter_client) { + return new NfcTagClientImpl(adapter_client); } } // namespace chromeos diff --git a/chromeos/dbus/nfc_tag_client.h b/chromeos/dbus/nfc_tag_client.h index 45a231d..278a171 100644 --- a/chromeos/dbus/nfc_tag_client.h +++ b/chromeos/dbus/nfc_tag_client.h @@ -11,7 +11,6 @@ #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/nfc_client_helpers.h" #include "chromeos/dbus/nfc_property_set.h" #include "chromeos/dbus/nfc_record_client.h" @@ -107,8 +106,7 @@ class CHROMEOS_EXPORT NfcTagClient : public DBusClient { const nfc_client_helpers::ErrorCallback& error_callback) = 0; // Creates the instance. - static NfcTagClient* Create(DBusClientImplementationType type, - NfcAdapterClient* adapter_client); + static NfcTagClient* Create(NfcAdapterClient* adapter_client); protected: friend class NfcClientTest; diff --git a/chromeos/dbus/permission_broker_client.h b/chromeos/dbus/permission_broker_client.h index 3b1ce40..17e215a 100644 --- a/chromeos/dbus/permission_broker_client.h +++ b/chromeos/dbus/permission_broker_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" namespace chromeos { diff --git a/chromeos/dbus/shill_device_client.cc b/chromeos/dbus/shill_device_client.cc index e9ad998..94934b4 100644 --- a/chromeos/dbus/shill_device_client.cc +++ b/chromeos/dbus/shill_device_client.cc @@ -8,7 +8,6 @@ #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/values.h" -#include "chromeos/dbus/fake_shill_device_client.h" #include "chromeos/dbus/shill_property_changed_observer.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -235,12 +234,8 @@ ShillDeviceClient::ShillDeviceClient() {} ShillDeviceClient::~ShillDeviceClient() {} // static -ShillDeviceClient* ShillDeviceClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ShillDeviceClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeShillDeviceClient(); +ShillDeviceClient* ShillDeviceClient::Create() { + return new ShillDeviceClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/shill_device_client.h b/chromeos/dbus/shill_device_client.h index 4600e37..92e1762 100644 --- a/chromeos/dbus/shill_device_client.h +++ b/chromeos/dbus/shill_device_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/shill_client_helper.h" namespace base { @@ -62,7 +61,7 @@ class CHROMEOS_EXPORT ShillDeviceClient : public DBusClient { // Factory function, creates a new instance which is owned by the caller. // For normal usage, access the singleton via DBusThreadManager::Get(). - static ShillDeviceClient* Create(DBusClientImplementationType type); + static ShillDeviceClient* Create(); // Adds a property changed |observer| for the device at |device_path|. virtual void AddPropertyChangedObserver( diff --git a/chromeos/dbus/shill_device_client_unittest.cc b/chromeos/dbus/shill_device_client_unittest.cc index bce00dd..b2ad508 100644 --- a/chromeos/dbus/shill_device_client_unittest.cc +++ b/chromeos/dbus/shill_device_client_unittest.cc @@ -59,7 +59,7 @@ class ShillDeviceClientTest : public ShillClientUnittestBase { virtual void SetUp() { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. - client_.reset(ShillDeviceClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION)); + client_.reset(ShillDeviceClient::Create()); client_->Init(mock_bus_.get()); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); diff --git a/chromeos/dbus/shill_ipconfig_client.cc b/chromeos/dbus/shill_ipconfig_client.cc index e30346a..7af7fa2 100644 --- a/chromeos/dbus/shill_ipconfig_client.cc +++ b/chromeos/dbus/shill_ipconfig_client.cc @@ -8,7 +8,6 @@ #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/values.h" -#include "chromeos/dbus/fake_shill_ipconfig_client.h" #include "chromeos/dbus/shill_property_changed_observer.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -172,12 +171,8 @@ ShillIPConfigClient::ShillIPConfigClient() {} ShillIPConfigClient::~ShillIPConfigClient() {} // static -ShillIPConfigClient* ShillIPConfigClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ShillIPConfigClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeShillIPConfigClient(); +ShillIPConfigClient* ShillIPConfigClient::Create() { + return new ShillIPConfigClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/shill_ipconfig_client.h b/chromeos/dbus/shill_ipconfig_client.h index 58e0667..ef144b2 100644 --- a/chromeos/dbus/shill_ipconfig_client.h +++ b/chromeos/dbus/shill_ipconfig_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/shill_client_helper.h" namespace base { @@ -42,7 +41,7 @@ class CHROMEOS_EXPORT ShillIPConfigClient : public DBusClient { // Factory function, creates a new instance which is owned by the caller. // For normal usage, access the singleton via DBusThreadManager::Get(). - static ShillIPConfigClient* Create(DBusClientImplementationType type); + static ShillIPConfigClient* Create(); // Adds a property changed |observer| for the ipconfig at |ipconfig_path|. virtual void AddPropertyChangedObserver( diff --git a/chromeos/dbus/shill_ipconfig_client_unittest.cc b/chromeos/dbus/shill_ipconfig_client_unittest.cc index e55231b..603ca26 100644 --- a/chromeos/dbus/shill_ipconfig_client_unittest.cc +++ b/chromeos/dbus/shill_ipconfig_client_unittest.cc @@ -33,7 +33,7 @@ class ShillIPConfigClientTest : public ShillClientUnittestBase { virtual void SetUp() { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. - client_.reset(ShillIPConfigClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION)); + client_.reset(ShillIPConfigClient::Create()); client_->Init(mock_bus_.get()); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); diff --git a/chromeos/dbus/shill_manager_client.cc b/chromeos/dbus/shill_manager_client.cc index f790e4e..0ad602f 100644 --- a/chromeos/dbus/shill_manager_client.cc +++ b/chromeos/dbus/shill_manager_client.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/values.h" -#include "chromeos/dbus/fake_shill_manager_client.h" #include "chromeos/dbus/shill_property_changed_observer.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -237,12 +236,8 @@ ShillManagerClient::ShillManagerClient() {} ShillManagerClient::~ShillManagerClient() {} // static -ShillManagerClient* ShillManagerClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ShillManagerClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeShillManagerClient(); +ShillManagerClient* ShillManagerClient::Create() { + return new ShillManagerClientImpl(); } // ShillManagerClient::VerificationProperties implementation. diff --git a/chromeos/dbus/shill_manager_client.h b/chromeos/dbus/shill_manager_client.h index c9307ca..a128b46 100644 --- a/chromeos/dbus/shill_manager_client.h +++ b/chromeos/dbus/shill_manager_client.h @@ -10,7 +10,6 @@ #include "base/basictypes.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/dbus_method_call_status.h" #include "chromeos/dbus/shill_client_helper.h" @@ -109,7 +108,7 @@ class CHROMEOS_EXPORT ShillManagerClient : public DBusClient { // Factory function, creates a new instance which is owned by the caller. // For normal usage, access the singleton via DBusThreadManager::Get(). - static ShillManagerClient* Create(DBusClientImplementationType type); + static ShillManagerClient* Create(); // Adds a property changed |observer|. virtual void AddPropertyChangedObserver( diff --git a/chromeos/dbus/shill_manager_client_unittest.cc b/chromeos/dbus/shill_manager_client_unittest.cc index 2728361b..7559b7b 100644 --- a/chromeos/dbus/shill_manager_client_unittest.cc +++ b/chromeos/dbus/shill_manager_client_unittest.cc @@ -59,7 +59,7 @@ class ShillManagerClientTest : public ShillClientUnittestBase { virtual void SetUp() { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. - client_.reset(ShillManagerClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION)); + client_.reset(ShillManagerClient::Create()); client_->Init(mock_bus_.get()); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); diff --git a/chromeos/dbus/shill_profile_client.cc b/chromeos/dbus/shill_profile_client.cc index 05bfa04..6fb0a1b 100644 --- a/chromeos/dbus/shill_profile_client.cc +++ b/chromeos/dbus/shill_profile_client.cc @@ -9,7 +9,6 @@ #include "base/stl_util.h" #include "base/values.h" #include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/fake_shill_profile_client.h" #include "chromeos/dbus/shill_property_changed_observer.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -135,12 +134,8 @@ ShillProfileClient::ShillProfileClient() {} ShillProfileClient::~ShillProfileClient() {} // static -ShillProfileClient* ShillProfileClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ShillProfileClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeShillProfileClient(); +ShillProfileClient* ShillProfileClient::Create() { + return new ShillProfileClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/shill_profile_client.h b/chromeos/dbus/shill_profile_client.h index 1529120..e6d3885 100644 --- a/chromeos/dbus/shill_profile_client.h +++ b/chromeos/dbus/shill_profile_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/shill_client_helper.h" namespace base { @@ -75,7 +74,7 @@ class CHROMEOS_EXPORT ShillProfileClient : public DBusClient { // Factory function, creates a new instance which is owned by the caller. // For normal usage, access the singleton via DBusThreadManager::Get(). - static ShillProfileClient* Create(DBusClientImplementationType type); + static ShillProfileClient* Create(); // Adds a property changed |observer| for the profile at |profile_path|. virtual void AddPropertyChangedObserver( diff --git a/chromeos/dbus/shill_profile_client_unittest.cc b/chromeos/dbus/shill_profile_client_unittest.cc index 2112463..d82636bd 100644 --- a/chromeos/dbus/shill_profile_client_unittest.cc +++ b/chromeos/dbus/shill_profile_client_unittest.cc @@ -41,7 +41,7 @@ class ShillProfileClientTest : public ShillClientUnittestBase { virtual void SetUp() { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. - client_.reset(ShillProfileClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION)); + client_.reset(ShillProfileClient::Create()); client_->Init(mock_bus_.get()); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); diff --git a/chromeos/dbus/shill_service_client.cc b/chromeos/dbus/shill_service_client.cc index 063d1e3..1d38eaf 100644 --- a/chromeos/dbus/shill_service_client.cc +++ b/chromeos/dbus/shill_service_client.cc @@ -9,7 +9,6 @@ #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/values.h" -#include "chromeos/dbus/fake_shill_service_client.h" #include "chromeos/dbus/shill_property_changed_observer.h" #include "chromeos/network/network_event_log.h" #include "dbus/bus.h" @@ -273,12 +272,8 @@ ShillServiceClient::ShillServiceClient() {} ShillServiceClient::~ShillServiceClient() {} // static -ShillServiceClient* ShillServiceClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ShillServiceClientImpl(); - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeShillServiceClient(); +ShillServiceClient* ShillServiceClient::Create() { + return new ShillServiceClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/shill_service_client.h b/chromeos/dbus/shill_service_client.h index 8e75baf..4fa4922 100644 --- a/chromeos/dbus/shill_service_client.h +++ b/chromeos/dbus/shill_service_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/shill_client_helper.h" namespace base { @@ -84,7 +83,7 @@ class CHROMEOS_EXPORT ShillServiceClient : public DBusClient { // Factory function, creates a new instance which is owned by the caller. // For normal usage, access the singleton via DBusThreadManager::Get(). - static ShillServiceClient* Create(DBusClientImplementationType type); + static ShillServiceClient* Create(); // Adds a property changed |observer| to the service at |service_path|. virtual void AddPropertyChangedObserver( diff --git a/chromeos/dbus/shill_service_client_unittest.cc b/chromeos/dbus/shill_service_client_unittest.cc index f83f805..6b63dc9 100644 --- a/chromeos/dbus/shill_service_client_unittest.cc +++ b/chromeos/dbus/shill_service_client_unittest.cc @@ -33,7 +33,7 @@ class ShillServiceClientTest : public ShillClientUnittestBase { virtual void SetUp() { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. - client_.reset(ShillServiceClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION)); + client_.reset(ShillServiceClient::Create()); client_->Init(mock_bus_.get()); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); diff --git a/chromeos/dbus/sms_client.h b/chromeos/dbus/sms_client.h index cf2fb27..507bfde 100644 --- a/chromeos/dbus/sms_client.h +++ b/chromeos/dbus/sms_client.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" namespace base { class DictionaryValue; diff --git a/chromeos/dbus/system_clock_client.cc b/chromeos/dbus/system_clock_client.cc index 6775c64..7d5f4a4 100644 --- a/chromeos/dbus/system_clock_client.cc +++ b/chromeos/dbus/system_clock_client.cc @@ -5,7 +5,6 @@ #include "chromeos/dbus/system_clock_client.h" #include "base/bind.h" -#include "chromeos/dbus/fake_system_clock_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -84,13 +83,8 @@ SystemClockClient::~SystemClockClient() { } // static -SystemClockClient* SystemClockClient::Create( - DBusClientImplementationType type) { - if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) { - return new SystemClockClientImpl(); - } - DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); - return new FakeSystemClockClient(); +SystemClockClient* SystemClockClient::Create() { + return new SystemClockClientImpl(); } } // namespace chromeos diff --git a/chromeos/dbus/system_clock_client.h b/chromeos/dbus/system_clock_client.h index ece1e2d..849612d 100644 --- a/chromeos/dbus/system_clock_client.h +++ b/chromeos/dbus/system_clock_client.h @@ -8,7 +8,6 @@ #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" -#include "chromeos/dbus/dbus_client_implementation_type.h" namespace chromeos { @@ -33,7 +32,7 @@ class CHROMEOS_EXPORT SystemClockClient : public DBusClient { virtual bool HasObserver(Observer* observer) = 0; // Creates the instance. - static SystemClockClient* Create(DBusClientImplementationType type); + static SystemClockClient* Create(); protected: // Create() should be used instead. |