OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 5 #include "chromeos/dbus/fake_dbus_thread_manager.h" |
6 | 6 |
7 #include "chromeos/dbus/bluetooth_adapter_client.h" | 7 #include "base/command_line.h" |
8 #include "chromeos/dbus/bluetooth_agent_manager_client.h" | 8 #include "chromeos/chromeos_switches.h" |
9 #include "chromeos/dbus/bluetooth_device_client.h" | 9 #include "chromeos/dbus/cras_audio_client_stub_impl.h" |
10 #include "chromeos/dbus/bluetooth_input_client.h" | |
11 #include "chromeos/dbus/bluetooth_profile_manager_client.h" | |
12 #include "chromeos/dbus/cras_audio_client.h" | |
13 #include "chromeos/dbus/cros_disks_client.h" | 10 #include "chromeos/dbus/cros_disks_client.h" |
14 #include "chromeos/dbus/cryptohome_client.h" | |
15 #include "chromeos/dbus/dbus_client.h" | 11 #include "chromeos/dbus/dbus_client.h" |
16 #include "chromeos/dbus/dbus_thread_manager.h" | 12 #include "chromeos/dbus/dbus_thread_manager.h" |
17 #include "chromeos/dbus/dbus_thread_manager_observer.h" | 13 #include "chromeos/dbus/dbus_thread_manager_observer.h" |
| 14 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
| 15 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
| 16 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
| 17 #include "chromeos/dbus/fake_bluetooth_input_client.h" |
| 18 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
| 19 #include "chromeos/dbus/fake_cryptohome_client.h" |
18 #include "chromeos/dbus/fake_debug_daemon_client.h" | 20 #include "chromeos/dbus/fake_debug_daemon_client.h" |
| 21 #include "chromeos/dbus/fake_gsm_sms_client.h" |
| 22 #include "chromeos/dbus/fake_image_burner_client.h" |
19 #include "chromeos/dbus/fake_introspectable_client.h" | 23 #include "chromeos/dbus/fake_introspectable_client.h" |
20 #include "chromeos/dbus/fake_modem_messaging_client.h" | 24 #include "chromeos/dbus/fake_modem_messaging_client.h" |
21 #include "chromeos/dbus/fake_nfc_adapter_client.h" | 25 #include "chromeos/dbus/fake_nfc_adapter_client.h" |
22 #include "chromeos/dbus/fake_nfc_device_client.h" | 26 #include "chromeos/dbus/fake_nfc_device_client.h" |
23 #include "chromeos/dbus/fake_nfc_manager_client.h" | 27 #include "chromeos/dbus/fake_nfc_manager_client.h" |
24 #include "chromeos/dbus/fake_nfc_record_client.h" | 28 #include "chromeos/dbus/fake_nfc_record_client.h" |
25 #include "chromeos/dbus/fake_nfc_tag_client.h" | 29 #include "chromeos/dbus/fake_nfc_tag_client.h" |
26 #include "chromeos/dbus/fake_permission_broker_client.h" | 30 #include "chromeos/dbus/fake_permission_broker_client.h" |
| 31 #include "chromeos/dbus/fake_shill_device_client.h" |
| 32 #include "chromeos/dbus/fake_shill_ipconfig_client.h" |
| 33 #include "chromeos/dbus/fake_shill_manager_client.h" |
| 34 #include "chromeos/dbus/fake_shill_profile_client.h" |
| 35 #include "chromeos/dbus/fake_shill_service_client.h" |
27 #include "chromeos/dbus/fake_sms_client.h" | 36 #include "chromeos/dbus/fake_sms_client.h" |
28 #include "chromeos/dbus/gsm_sms_client.h" | 37 #include "chromeos/dbus/fake_system_clock_client.h" |
29 #include "chromeos/dbus/image_burner_client.h" | |
30 #include "chromeos/dbus/power_manager_client.h" | 38 #include "chromeos/dbus/power_manager_client.h" |
31 #include "chromeos/dbus/power_policy_controller.h" | 39 #include "chromeos/dbus/power_policy_controller.h" |
32 #include "chromeos/dbus/session_manager_client.h" | 40 #include "chromeos/dbus/session_manager_client.h" |
33 #include "chromeos/dbus/shill_device_client.h" | |
34 #include "chromeos/dbus/shill_ipconfig_client.h" | |
35 #include "chromeos/dbus/shill_manager_client.h" | |
36 #include "chromeos/dbus/shill_profile_client.h" | |
37 #include "chromeos/dbus/shill_service_client.h" | |
38 #include "chromeos/dbus/system_clock_client.h" | |
39 #include "chromeos/dbus/update_engine_client.h" | 41 #include "chromeos/dbus/update_engine_client.h" |
40 | 42 |
41 namespace chromeos { | 43 namespace chromeos { |
42 | 44 |
43 FakeDBusThreadManager::FakeDBusThreadManager() { | 45 FakeDBusThreadManager::FakeDBusThreadManager() { |
44 } | 46 } |
45 | 47 |
46 FakeDBusThreadManager::~FakeDBusThreadManager() { | 48 FakeDBusThreadManager::~FakeDBusThreadManager() { |
47 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, | 49 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, |
48 OnDBusThreadManagerDestroying(this)); | 50 OnDBusThreadManagerDestroying(this)); |
49 } | 51 } |
50 | 52 |
51 void FakeDBusThreadManager::SetFakeClients() { | 53 void FakeDBusThreadManager::SetFakeClients() { |
52 const DBusClientImplementationType client_type = | 54 const DBusClientImplementationType client_type = |
53 STUB_DBUS_CLIENT_IMPLEMENTATION; | 55 STUB_DBUS_CLIENT_IMPLEMENTATION; |
54 SetBluetoothAdapterClient(scoped_ptr<BluetoothAdapterClient>( | 56 SetBluetoothAdapterClient( |
55 BluetoothAdapterClient::Create(client_type))); | 57 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); |
56 SetBluetoothAgentManagerClient(scoped_ptr<BluetoothAgentManagerClient>( | 58 SetBluetoothAgentManagerClient(scoped_ptr<BluetoothAgentManagerClient>( |
57 BluetoothAgentManagerClient::Create(client_type))); | 59 new FakeBluetoothAgentManagerClient)); |
58 SetBluetoothDeviceClient(scoped_ptr<BluetoothDeviceClient>( | 60 SetBluetoothDeviceClient( |
59 BluetoothDeviceClient::Create(client_type))); | 61 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); |
60 SetBluetoothInputClient(scoped_ptr<BluetoothInputClient>( | 62 SetBluetoothInputClient( |
61 BluetoothInputClient::Create(client_type))); | 63 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); |
62 SetBluetoothProfileManagerClient(scoped_ptr<BluetoothProfileManagerClient>( | 64 SetBluetoothProfileManagerClient(scoped_ptr<BluetoothProfileManagerClient>( |
63 BluetoothProfileManagerClient::Create(client_type))); | 65 new FakeBluetoothProfileManagerClient)); |
64 SetCrasAudioClient( | |
65 scoped_ptr<CrasAudioClient>(CrasAudioClient::Create(client_type))); | |
66 SetCrosDisksClient( | 66 SetCrosDisksClient( |
67 scoped_ptr<CrosDisksClient>(CrosDisksClient::Create(client_type))); | 67 scoped_ptr<CrosDisksClient>(CrosDisksClient::Create(client_type))); |
68 SetCryptohomeClient( | 68 SetCrasAudioClient(scoped_ptr<CrasAudioClient>(new CrasAudioClientStubImpl)); |
69 scoped_ptr<CryptohomeClient>(CryptohomeClient::Create(client_type))); | 69 SetCryptohomeClient(scoped_ptr<CryptohomeClient>(new FakeCryptohomeClient)); |
70 SetDebugDaemonClient( | 70 SetDebugDaemonClient( |
71 scoped_ptr<DebugDaemonClient>(new FakeDebugDaemonClient)); | 71 scoped_ptr<DebugDaemonClient>(new FakeDebugDaemonClient)); |
72 SetShillManagerClient( | 72 SetShillManagerClient( |
73 scoped_ptr<ShillManagerClient>(ShillManagerClient::Create(client_type))); | 73 scoped_ptr<ShillManagerClient>(new FakeShillManagerClient)); |
74 SetShillDeviceClient( | 74 SetShillDeviceClient( |
75 scoped_ptr<ShillDeviceClient>(ShillDeviceClient::Create(client_type))); | 75 scoped_ptr<ShillDeviceClient>(new FakeShillDeviceClient)); |
76 SetShillIPConfigClient(scoped_ptr<ShillIPConfigClient>( | 76 SetShillIPConfigClient( |
77 ShillIPConfigClient::Create(client_type))); | 77 scoped_ptr<ShillIPConfigClient>(new FakeShillIPConfigClient)); |
78 SetShillServiceClient( | 78 SetShillServiceClient( |
79 scoped_ptr<ShillServiceClient>(ShillServiceClient::Create(client_type))); | 79 scoped_ptr<ShillServiceClient>(new FakeShillServiceClient)); |
80 SetShillProfileClient( | 80 SetShillProfileClient( |
81 scoped_ptr<ShillProfileClient>(ShillProfileClient::Create(client_type))); | 81 scoped_ptr<ShillProfileClient>(new FakeShillProfileClient)); |
82 SetGsmSMSClient(scoped_ptr<GsmSMSClient>(GsmSMSClient::Create(client_type))); | 82 |
| 83 FakeGsmSMSClient* gsm_sms_client = new FakeGsmSMSClient(); |
| 84 gsm_sms_client->set_sms_test_message_switch_present( |
| 85 CommandLine::ForCurrentProcess()->HasSwitch( |
| 86 chromeos::switches::kSmsTestMessages)); |
| 87 SetGsmSMSClient(scoped_ptr<GsmSMSClient>(gsm_sms_client)); |
| 88 |
83 SetImageBurnerClient( | 89 SetImageBurnerClient( |
84 scoped_ptr<ImageBurnerClient>(ImageBurnerClient::Create(client_type))); | 90 scoped_ptr<ImageBurnerClient>(new FakeImageBurnerClient)); |
85 SetIntrospectableClient( | 91 SetIntrospectableClient( |
86 scoped_ptr<IntrospectableClient>(new FakeIntrospectableClient)); | 92 scoped_ptr<IntrospectableClient>(new FakeIntrospectableClient)); |
87 SetModemMessagingClient( | 93 SetModemMessagingClient( |
88 scoped_ptr<ModemMessagingClient>(new FakeModemMessagingClient)); | 94 scoped_ptr<ModemMessagingClient>(new FakeModemMessagingClient)); |
89 SetNfcAdapterClient(scoped_ptr<NfcAdapterClient>(new FakeNfcAdapterClient)); | 95 SetNfcAdapterClient(scoped_ptr<NfcAdapterClient>(new FakeNfcAdapterClient)); |
90 SetNfcDeviceClient(scoped_ptr<NfcDeviceClient>(new FakeNfcDeviceClient)); | 96 SetNfcDeviceClient(scoped_ptr<NfcDeviceClient>(new FakeNfcDeviceClient)); |
91 SetNfcManagerClient(scoped_ptr<NfcManagerClient>(new FakeNfcManagerClient)); | 97 SetNfcManagerClient(scoped_ptr<NfcManagerClient>(new FakeNfcManagerClient)); |
92 SetNfcRecordClient(scoped_ptr<NfcRecordClient>(new FakeNfcRecordClient)); | 98 SetNfcRecordClient(scoped_ptr<NfcRecordClient>(new FakeNfcRecordClient)); |
93 SetNfcTagClient(scoped_ptr<NfcTagClient>(new FakeNfcTagClient)); | 99 SetNfcTagClient(scoped_ptr<NfcTagClient>(new FakeNfcTagClient)); |
94 SetPermissionBrokerClient( | 100 SetPermissionBrokerClient( |
95 scoped_ptr<PermissionBrokerClient>(new FakePermissionBrokerClient)); | 101 scoped_ptr<PermissionBrokerClient>(new FakePermissionBrokerClient)); |
96 SetPowerManagerClient( | 102 SetPowerManagerClient( |
97 scoped_ptr<PowerManagerClient>(PowerManagerClient::Create(client_type))); | 103 scoped_ptr<PowerManagerClient>(PowerManagerClient::Create(client_type))); |
98 SetSessionManagerClient(scoped_ptr<SessionManagerClient>( | 104 SetSessionManagerClient(scoped_ptr<SessionManagerClient>( |
99 SessionManagerClient::Create(client_type))); | 105 SessionManagerClient::Create(client_type))); |
100 SetSMSClient(scoped_ptr<SMSClient>(new FakeSMSClient)); | 106 SetSMSClient(scoped_ptr<SMSClient>(new FakeSMSClient)); |
101 SetSystemClockClient( | 107 SetSystemClockClient( |
102 scoped_ptr<SystemClockClient>(SystemClockClient::Create(client_type))); | 108 scoped_ptr<SystemClockClient>(new FakeSystemClockClient)); |
103 SetUpdateEngineClient( | 109 SetUpdateEngineClient( |
104 scoped_ptr<UpdateEngineClient>(UpdateEngineClient::Create(client_type))); | 110 scoped_ptr<UpdateEngineClient>(UpdateEngineClient::Create(client_type))); |
105 | 111 |
106 SetPowerPolicyController(make_scoped_ptr(new PowerPolicyController)); | 112 SetPowerPolicyController(make_scoped_ptr(new PowerPolicyController)); |
107 } | 113 } |
108 | 114 |
109 void FakeDBusThreadManager::SetBluetoothAdapterClient( | 115 void FakeDBusThreadManager::SetBluetoothAdapterClient( |
110 scoped_ptr<BluetoothAdapterClient> client) { | 116 scoped_ptr<BluetoothAdapterClient> client) { |
111 bluetooth_adapter_client_ = client.Pass(); | 117 bluetooth_adapter_client_ = client.Pass(); |
112 } | 118 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 406 |
401 SystemClockClient* FakeDBusThreadManager::GetSystemClockClient() { | 407 SystemClockClient* FakeDBusThreadManager::GetSystemClockClient() { |
402 return system_clock_client_.get(); | 408 return system_clock_client_.get(); |
403 } | 409 } |
404 | 410 |
405 UpdateEngineClient* FakeDBusThreadManager::GetUpdateEngineClient() { | 411 UpdateEngineClient* FakeDBusThreadManager::GetUpdateEngineClient() { |
406 return update_engine_client_.get(); | 412 return update_engine_client_.get(); |
407 } | 413 } |
408 | 414 |
409 } // namespace chromeos | 415 } // namespace chromeos |
OLD | NEW |