Home | History | Annotate | Download | only in dbus
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h"
      6 
      7 #include "chromeos/dbus/dbus_thread_manager_observer.h"
      8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
      9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
     10 #include "chromeos/dbus/fake_bluetooth_device_client.h"
     11 #include "chromeos/dbus/fake_bluetooth_input_client.h"
     12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
     13 #include "chromeos/dbus/fake_cros_disks_client.h"
     14 #include "chromeos/dbus/fake_cryptohome_client.h"
     15 #include "chromeos/dbus/fake_gsm_sms_client.h"
     16 #include "chromeos/dbus/fake_image_burner_client.h"
     17 #include "chromeos/dbus/fake_power_manager_client.h"
     18 #include "chromeos/dbus/fake_session_manager_client.h"
     19 #include "chromeos/dbus/fake_shill_device_client.h"
     20 #include "chromeos/dbus/fake_shill_manager_client.h"
     21 #include "chromeos/dbus/fake_system_clock_client.h"
     22 #include "chromeos/dbus/fake_update_engine_client.h"
     23 #include "chromeos/dbus/ibus/mock_ibus_client.h"
     24 #include "chromeos/dbus/ibus/mock_ibus_config_client.h"
     25 #include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h"
     26 #include "chromeos/dbus/ibus/mock_ibus_engine_service.h"
     27 #include "chromeos/dbus/ibus/mock_ibus_input_context_client.h"
     28 #include "chromeos/dbus/ibus/mock_ibus_panel_service.h"
     29 #include "chromeos/dbus/power_policy_controller.h"
     30 
     31 namespace chromeos {
     32 
     33 MockDBusThreadManagerWithoutGMock::MockDBusThreadManagerWithoutGMock()
     34   : fake_bluetooth_adapter_client_(new FakeBluetoothAdapterClient()),
     35     fake_bluetooth_agent_manager_client_(new FakeBluetoothAgentManagerClient()),
     36     fake_bluetooth_device_client_(new FakeBluetoothDeviceClient()),
     37     fake_bluetooth_input_client_(new FakeBluetoothInputClient()),
     38     fake_bluetooth_profile_manager_client_(
     39         new FakeBluetoothProfileManagerClient()),
     40     fake_cros_disks_client_(new FakeCrosDisksClient),
     41     fake_cryptohome_client_(new FakeCryptohomeClient),
     42     fake_gsm_sms_client_(new FakeGsmSMSClient),
     43     fake_image_burner_client_(new FakeImageBurnerClient),
     44     fake_session_manager_client_(new FakeSessionManagerClient),
     45     fake_shill_device_client_(new FakeShillDeviceClient),
     46     fake_shill_manager_client_(new FakeShillManagerClient),
     47     fake_system_clock_client_(new FakeSystemClockClient),
     48     fake_power_manager_client_(new FakePowerManagerClient),
     49     fake_update_engine_client_(new FakeUpdateEngineClient),
     50     ibus_bus_(NULL) {
     51   power_policy_controller_.reset(
     52       new PowerPolicyController(this, fake_power_manager_client_.get()));
     53 }
     54 
     55 MockDBusThreadManagerWithoutGMock::~MockDBusThreadManagerWithoutGMock() {
     56   FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_,
     57                     OnDBusThreadManagerDestroying(this));
     58 }
     59 
     60 void MockDBusThreadManagerWithoutGMock::AddObserver(
     61     DBusThreadManagerObserver* observer) {
     62   DCHECK(observer);
     63   observers_.AddObserver(observer);
     64 }
     65 
     66 void MockDBusThreadManagerWithoutGMock::RemoveObserver(
     67     DBusThreadManagerObserver* observer) {
     68   DCHECK(observer);
     69   observers_.RemoveObserver(observer);
     70 }
     71 
     72 void MockDBusThreadManagerWithoutGMock::InitIBusBus(
     73     const std::string& ibus_address,
     74     const base::Closure& closure) {
     75   // Non-null bus address is used to ensure the connection to ibus-daemon.
     76   ibus_bus_ = reinterpret_cast<dbus::Bus*>(0xdeadbeef);
     77   mock_ibus_client_.reset(new MockIBusClient);
     78   mock_ibus_config_client_.reset(new MockIBusConfigClient);
     79   mock_ibus_input_context_client_.reset(new MockIBusInputContextClient);
     80   mock_ibus_engine_service_.reset(new MockIBusEngineService);
     81   mock_ibus_engine_factory_service_.reset(new MockIBusEngineFactoryService);
     82   mock_ibus_panel_service_.reset(new MockIBusPanelService);
     83 }
     84 
     85 dbus::Bus* MockDBusThreadManagerWithoutGMock::GetSystemBus() {
     86   return NULL;
     87 }
     88 
     89 dbus::Bus* MockDBusThreadManagerWithoutGMock::GetIBusBus() {
     90   return ibus_bus_;
     91 }
     92 
     93 BluetoothAdapterClient*
     94     MockDBusThreadManagerWithoutGMock::GetBluetoothAdapterClient() {
     95   return fake_bluetooth_adapter_client_.get();
     96 }
     97 
     98 BluetoothAgentManagerClient*
     99     MockDBusThreadManagerWithoutGMock::GetBluetoothAgentManagerClient() {
    100   return fake_bluetooth_agent_manager_client_.get();
    101 }
    102 
    103 BluetoothDeviceClient*
    104     MockDBusThreadManagerWithoutGMock::GetBluetoothDeviceClient() {
    105   return fake_bluetooth_device_client_.get();
    106 }
    107 
    108 BluetoothInputClient*
    109     MockDBusThreadManagerWithoutGMock::GetBluetoothInputClient() {
    110   return fake_bluetooth_input_client_.get();
    111 }
    112 
    113 BluetoothProfileManagerClient*
    114     MockDBusThreadManagerWithoutGMock::GetBluetoothProfileManagerClient() {
    115   return fake_bluetooth_profile_manager_client_.get();
    116 }
    117 
    118 CrasAudioClient* MockDBusThreadManagerWithoutGMock::GetCrasAudioClient() {
    119   return NULL;
    120 }
    121 
    122 CrosDisksClient* MockDBusThreadManagerWithoutGMock::GetCrosDisksClient() {
    123   return fake_cros_disks_client_.get();
    124 }
    125 
    126 CryptohomeClient* MockDBusThreadManagerWithoutGMock::GetCryptohomeClient() {
    127   return fake_cryptohome_client_.get();
    128 }
    129 
    130 DebugDaemonClient* MockDBusThreadManagerWithoutGMock::GetDebugDaemonClient() {
    131   NOTIMPLEMENTED();
    132   return NULL;
    133 }
    134 
    135 ShillDeviceClient*
    136     MockDBusThreadManagerWithoutGMock::GetShillDeviceClient() {
    137   return fake_shill_device_client_.get();
    138 }
    139 
    140 ShillIPConfigClient*
    141     MockDBusThreadManagerWithoutGMock::GetShillIPConfigClient() {
    142   NOTIMPLEMENTED();
    143   return NULL;
    144 }
    145 
    146 ShillManagerClient*
    147     MockDBusThreadManagerWithoutGMock::GetShillManagerClient() {
    148   return fake_shill_manager_client_.get();
    149 }
    150 
    151 ShillProfileClient*
    152     MockDBusThreadManagerWithoutGMock::GetShillProfileClient() {
    153   NOTIMPLEMENTED();
    154   return NULL;
    155 }
    156 
    157 ShillServiceClient*
    158     MockDBusThreadManagerWithoutGMock::GetShillServiceClient() {
    159   NOTIMPLEMENTED();
    160   return NULL;
    161 }
    162 
    163 GsmSMSClient* MockDBusThreadManagerWithoutGMock::GetGsmSMSClient() {
    164   return fake_gsm_sms_client_.get();
    165 }
    166 
    167 ImageBurnerClient* MockDBusThreadManagerWithoutGMock::GetImageBurnerClient() {
    168   return fake_image_burner_client_.get();
    169 }
    170 
    171 IntrospectableClient*
    172     MockDBusThreadManagerWithoutGMock::GetIntrospectableClient() {
    173   NOTIMPLEMENTED();
    174   return NULL;
    175 }
    176 
    177 ModemMessagingClient*
    178     MockDBusThreadManagerWithoutGMock::GetModemMessagingClient() {
    179   NOTIMPLEMENTED();
    180   return NULL;
    181 }
    182 
    183 PermissionBrokerClient*
    184     MockDBusThreadManagerWithoutGMock::GetPermissionBrokerClient() {
    185   NOTIMPLEMENTED();
    186   return NULL;
    187 }
    188 
    189 PowerManagerClient* MockDBusThreadManagerWithoutGMock::GetPowerManagerClient() {
    190   return fake_power_manager_client_.get();
    191 }
    192 
    193 PowerPolicyController*
    194 MockDBusThreadManagerWithoutGMock::GetPowerPolicyController() {
    195   return power_policy_controller_.get();
    196 }
    197 
    198 SessionManagerClient*
    199     MockDBusThreadManagerWithoutGMock::GetSessionManagerClient() {
    200   return fake_session_manager_client_.get();
    201 }
    202 
    203 SMSClient* MockDBusThreadManagerWithoutGMock::GetSMSClient() {
    204   NOTIMPLEMENTED();
    205   return NULL;
    206 }
    207 
    208 SystemClockClient* MockDBusThreadManagerWithoutGMock::GetSystemClockClient() {
    209   return fake_system_clock_client_.get();
    210 }
    211 
    212 UpdateEngineClient* MockDBusThreadManagerWithoutGMock::GetUpdateEngineClient() {
    213   return fake_update_engine_client_.get();
    214 }
    215 
    216 IBusClient* MockDBusThreadManagerWithoutGMock::GetIBusClient() {
    217   return mock_ibus_client_.get();
    218 }
    219 
    220 IBusConfigClient* MockDBusThreadManagerWithoutGMock::GetIBusConfigClient() {
    221   return mock_ibus_config_client_.get();
    222 }
    223 
    224 IBusInputContextClient*
    225     MockDBusThreadManagerWithoutGMock::GetIBusInputContextClient() {
    226   return mock_ibus_input_context_client_.get();
    227 }
    228 
    229 IBusEngineFactoryService*
    230     MockDBusThreadManagerWithoutGMock::GetIBusEngineFactoryService() {
    231   return mock_ibus_engine_factory_service_.get();
    232 }
    233 
    234 IBusEngineService* MockDBusThreadManagerWithoutGMock::GetIBusEngineService(
    235     const dbus::ObjectPath& object_path) {
    236   return mock_ibus_engine_service_.get();
    237 }
    238 
    239 void MockDBusThreadManagerWithoutGMock::RemoveIBusEngineService(
    240     const dbus::ObjectPath& object_path) {
    241 }
    242 
    243 IBusPanelService* MockDBusThreadManagerWithoutGMock::GetIBusPanelService() {
    244   return mock_ibus_panel_service_.get();
    245 }
    246 
    247 }  // namespace chromeos
    248