Commit 50ff635a authored by haruki@chromium.org's avatar haruki@chromium.org

dbus: Use fakes for some clients and utils for MockDBusThreadManagerWithoutGMock

This is a retrial.
Fakes are used for
- PowerManagerClient (with a PowerPolicyController instance)
- SessionManagerClient
- UpdateEngineClient

BUG=234084
TEST=trybots

Review URL: https://chromiumcodereview.appspot.com/14845009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198757 0039d316-1c4b-4281-b951-d872f2087c98
parent 82619a23
...@@ -338,10 +338,6 @@ ...@@ -338,10 +338,6 @@
'cryptohome/mock_async_method_caller.h', 'cryptohome/mock_async_method_caller.h',
'cryptohome/mock_cryptohome_library.cc', 'cryptohome/mock_cryptohome_library.cc',
'cryptohome/mock_cryptohome_library.h', 'cryptohome/mock_cryptohome_library.h',
'dbus/fake_session_manager_client.cc',
'dbus/fake_session_manager_client.h',
'dbus/fake_update_engine_client.cc',
'dbus/fake_update_engine_client.h',
'dbus/mock_bluetooth_adapter_client.cc', 'dbus/mock_bluetooth_adapter_client.cc',
'dbus/mock_bluetooth_adapter_client.h', 'dbus/mock_bluetooth_adapter_client.h',
'dbus/mock_bluetooth_device_client.cc', 'dbus/mock_bluetooth_device_client.cc',
...@@ -423,10 +419,14 @@ ...@@ -423,10 +419,14 @@
'dbus/fake_old_bluetooth_manager_client.h', 'dbus/fake_old_bluetooth_manager_client.h',
'dbus/fake_power_manager_client.cc', 'dbus/fake_power_manager_client.cc',
'dbus/fake_power_manager_client.h', 'dbus/fake_power_manager_client.h',
'dbus/fake_session_manager_client.cc',
'dbus/fake_session_manager_client.h',
'dbus/fake_shill_manager_client.cc', 'dbus/fake_shill_manager_client.cc',
'dbus/fake_shill_manager_client.h', 'dbus/fake_shill_manager_client.h',
'dbus/fake_system_clock_client.cc', 'dbus/fake_system_clock_client.cc',
'dbus/fake_system_clock_client.h', 'dbus/fake_system_clock_client.h',
'dbus/fake_update_engine_client.cc',
'dbus/fake_update_engine_client.h',
'dbus/mock_dbus_thread_manager_without_gmock.cc', 'dbus/mock_dbus_thread_manager_without_gmock.cc',
'dbus/mock_dbus_thread_manager_without_gmock.h', 'dbus/mock_dbus_thread_manager_without_gmock.h',
'dbus/ibus/mock_ibus_client.cc', 'dbus/ibus/mock_ibus_client.cc',
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h"
#include "chromeos/dbus/bluetooth_adapter_client.h"
#include "chromeos/dbus/bluetooth_device_client.h"
#include "chromeos/dbus/bluetooth_manager_client.h"
#include "chromeos/dbus/dbus_thread_manager_observer.h" #include "chromeos/dbus/dbus_thread_manager_observer.h"
#include "chromeos/dbus/fake_bluetooth_adapter_client.h" #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
...@@ -16,14 +19,18 @@ ...@@ -16,14 +19,18 @@
#include "chromeos/dbus/fake_old_bluetooth_adapter_client.h" #include "chromeos/dbus/fake_old_bluetooth_adapter_client.h"
#include "chromeos/dbus/fake_old_bluetooth_device_client.h" #include "chromeos/dbus/fake_old_bluetooth_device_client.h"
#include "chromeos/dbus/fake_old_bluetooth_manager_client.h" #include "chromeos/dbus/fake_old_bluetooth_manager_client.h"
#include "chromeos/dbus/fake_power_manager_client.h"
#include "chromeos/dbus/fake_session_manager_client.h"
#include "chromeos/dbus/fake_shill_manager_client.h" #include "chromeos/dbus/fake_shill_manager_client.h"
#include "chromeos/dbus/fake_system_clock_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/ibus/mock_ibus_client.h"
#include "chromeos/dbus/ibus/mock_ibus_config_client.h" #include "chromeos/dbus/ibus/mock_ibus_config_client.h"
#include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h" #include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h"
#include "chromeos/dbus/ibus/mock_ibus_engine_service.h" #include "chromeos/dbus/ibus/mock_ibus_engine_service.h"
#include "chromeos/dbus/ibus/mock_ibus_input_context_client.h" #include "chromeos/dbus/ibus/mock_ibus_input_context_client.h"
#include "chromeos/dbus/ibus/mock_ibus_panel_service.h" #include "chromeos/dbus/ibus/mock_ibus_panel_service.h"
#include "chromeos/dbus/power_policy_controller.h"
namespace chromeos { namespace chromeos {
...@@ -37,8 +44,11 @@ MockDBusThreadManagerWithoutGMock::MockDBusThreadManagerWithoutGMock() ...@@ -37,8 +44,11 @@ MockDBusThreadManagerWithoutGMock::MockDBusThreadManagerWithoutGMock()
fake_cros_disks_client_(new FakeCrosDisksClient), fake_cros_disks_client_(new FakeCrosDisksClient),
fake_cryptohome_client_(new FakeCryptohomeClient), fake_cryptohome_client_(new FakeCryptohomeClient),
fake_image_burner_client_(new FakeImageBurnerClient), fake_image_burner_client_(new FakeImageBurnerClient),
fake_session_manager_client_(new FakeSessionManagerClient),
fake_shill_manager_client_(new FakeShillManagerClient), fake_shill_manager_client_(new FakeShillManagerClient),
fake_system_clock_client_(new FakeSystemClockClient), fake_system_clock_client_(new FakeSystemClockClient),
fake_power_manager_client_(new FakePowerManagerClient),
fake_update_engine_client_(new FakeUpdateEngineClient),
fake_old_bluetooth_manager_client_(new FakeOldBluetoothManagerClient), fake_old_bluetooth_manager_client_(new FakeOldBluetoothManagerClient),
fake_old_bluetooth_adapter_client_(new FakeOldBluetoothAdapterClient), fake_old_bluetooth_adapter_client_(new FakeOldBluetoothAdapterClient),
fake_old_bluetooth_device_client_(new FakeOldBluetoothDeviceClient), fake_old_bluetooth_device_client_(new FakeOldBluetoothDeviceClient),
...@@ -49,6 +59,8 @@ MockDBusThreadManagerWithoutGMock::MockDBusThreadManagerWithoutGMock() ...@@ -49,6 +59,8 @@ MockDBusThreadManagerWithoutGMock::MockDBusThreadManagerWithoutGMock()
mock_ibus_engine_factory_service_(new MockIBusEngineFactoryService), mock_ibus_engine_factory_service_(new MockIBusEngineFactoryService),
mock_ibus_panel_service_(new MockIBusPanelService), mock_ibus_panel_service_(new MockIBusPanelService),
ibus_bus_(NULL) { ibus_bus_(NULL) {
power_policy_controller_.reset(
new PowerPolicyController(this, fake_power_manager_client_.get()));
} }
MockDBusThreadManagerWithoutGMock::~MockDBusThreadManagerWithoutGMock() { MockDBusThreadManagerWithoutGMock::~MockDBusThreadManagerWithoutGMock() {
...@@ -212,20 +224,17 @@ PermissionBrokerClient* ...@@ -212,20 +224,17 @@ PermissionBrokerClient*
} }
PowerManagerClient* MockDBusThreadManagerWithoutGMock::GetPowerManagerClient() { PowerManagerClient* MockDBusThreadManagerWithoutGMock::GetPowerManagerClient() {
NOTIMPLEMENTED(); return fake_power_manager_client_.get();
return NULL;
} }
PowerPolicyController* PowerPolicyController*
MockDBusThreadManagerWithoutGMock::GetPowerPolicyController() { MockDBusThreadManagerWithoutGMock::GetPowerPolicyController() {
NOTIMPLEMENTED(); return power_policy_controller_.get();
return NULL;
} }
SessionManagerClient* SessionManagerClient*
MockDBusThreadManagerWithoutGMock::GetSessionManagerClient() { MockDBusThreadManagerWithoutGMock::GetSessionManagerClient() {
NOTIMPLEMENTED(); return fake_session_manager_client_.get();
return NULL;
} }
SMSClient* MockDBusThreadManagerWithoutGMock::GetSMSClient() { SMSClient* MockDBusThreadManagerWithoutGMock::GetSMSClient() {
...@@ -238,8 +247,7 @@ SystemClockClient* MockDBusThreadManagerWithoutGMock::GetSystemClockClient() { ...@@ -238,8 +247,7 @@ SystemClockClient* MockDBusThreadManagerWithoutGMock::GetSystemClockClient() {
} }
UpdateEngineClient* MockDBusThreadManagerWithoutGMock::GetUpdateEngineClient() { UpdateEngineClient* MockDBusThreadManagerWithoutGMock::GetUpdateEngineClient() {
NOTIMPLEMENTED(); return fake_update_engine_client_.get();
return NULL;
} }
BluetoothOutOfBandClient* BluetoothOutOfBandClient*
......
...@@ -29,9 +29,12 @@ class FakeCryptohomeClient; ...@@ -29,9 +29,12 @@ class FakeCryptohomeClient;
class FakeOldBluetoothAdapterClient; class FakeOldBluetoothAdapterClient;
class FakeOldBluetoothDeviceClient; class FakeOldBluetoothDeviceClient;
class FakeOldBluetoothManagerClient; class FakeOldBluetoothManagerClient;
class FakeShillManagerClient; class FakePowerManagerClient;
class FakeImageBurnerClient; class FakeImageBurnerClient;
class FakeSessionManagerClient;
class FakeShillManagerClient;
class FakeSystemClockClient; class FakeSystemClockClient;
class FakeUpdateEngineClient;
class MockIBusClient; class MockIBusClient;
class MockIBusConfigClient; class MockIBusConfigClient;
class MockIBusEngineFactoryService; class MockIBusEngineFactoryService;
...@@ -167,6 +170,10 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { ...@@ -167,6 +170,10 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager {
} }
private: private:
// Note: Keep this before other members so they can call AddObserver() in
// their c'tors.
ObserverList<DBusThreadManagerObserver> observers_;
// These fake_bluetooth_*_client_ are for ExperimentalBluetooth*Client. // These fake_bluetooth_*_client_ are for ExperimentalBluetooth*Client.
scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_; scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_;
scoped_ptr<FakeBluetoothAgentManagerClient> scoped_ptr<FakeBluetoothAgentManagerClient>
...@@ -178,8 +185,11 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { ...@@ -178,8 +185,11 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager {
scoped_ptr<FakeCrosDisksClient> fake_cros_disks_client_; scoped_ptr<FakeCrosDisksClient> fake_cros_disks_client_;
scoped_ptr<FakeCryptohomeClient> fake_cryptohome_client_; scoped_ptr<FakeCryptohomeClient> fake_cryptohome_client_;
scoped_ptr<FakeImageBurnerClient> fake_image_burner_client_; scoped_ptr<FakeImageBurnerClient> fake_image_burner_client_;
scoped_ptr<FakeSessionManagerClient> fake_session_manager_client_;
scoped_ptr<FakeShillManagerClient> fake_shill_manager_client_; scoped_ptr<FakeShillManagerClient> fake_shill_manager_client_;
scoped_ptr<FakeSystemClockClient> fake_system_clock_client_; scoped_ptr<FakeSystemClockClient> fake_system_clock_client_;
scoped_ptr<FakePowerManagerClient> fake_power_manager_client_;
scoped_ptr<FakeUpdateEngineClient> fake_update_engine_client_;
// These fake_old_bluetooth_*_client_ are for old Bluetooth*Client. // These fake_old_bluetooth_*_client_ are for old Bluetooth*Client.
// Will be removed once http://crbug.com/221813 is resolved. // Will be removed once http://crbug.com/221813 is resolved.
...@@ -194,10 +204,9 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { ...@@ -194,10 +204,9 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager {
scoped_ptr<MockIBusEngineFactoryService> mock_ibus_engine_factory_service_; scoped_ptr<MockIBusEngineFactoryService> mock_ibus_engine_factory_service_;
scoped_ptr<MockIBusPanelService> mock_ibus_panel_service_; scoped_ptr<MockIBusPanelService> mock_ibus_panel_service_;
scoped_ptr<PowerPolicyController> power_policy_controller_;
dbus::Bus* ibus_bus_; dbus::Bus* ibus_bus_;
ObserverList<DBusThreadManagerObserver> observers_;
DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManagerWithoutGMock); DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManagerWithoutGMock);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment