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/mock_dbus_thread_manager.h" | 5 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
6 | 6 |
7 #include "chromeos/dbus/dbus_thread_manager_observer.h" | 7 #include "chromeos/dbus/dbus_thread_manager_observer.h" |
8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
10 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
11 #include "chromeos/dbus/fake_bluetooth_input_client.h" | 11 #include "chromeos/dbus/fake_bluetooth_input_client.h" |
12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | 12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
13 #include "chromeos/dbus/ibus/mock_ibus_client.h" | 13 #include "chromeos/dbus/ibus/mock_ibus_client.h" |
14 #include "chromeos/dbus/ibus/mock_ibus_config_client.h" | 14 #include "chromeos/dbus/ibus/mock_ibus_config_client.h" |
15 #include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h" | 15 #include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h" |
16 #include "chromeos/dbus/ibus/mock_ibus_engine_service.h" | 16 #include "chromeos/dbus/ibus/mock_ibus_engine_service.h" |
17 #include "chromeos/dbus/ibus/mock_ibus_input_context_client.h" | 17 #include "chromeos/dbus/ibus/mock_ibus_input_context_client.h" |
18 #include "chromeos/dbus/ibus/mock_ibus_panel_service.h" | 18 #include "chromeos/dbus/ibus/mock_ibus_panel_service.h" |
19 #include "chromeos/dbus/mock_bluetooth_adapter_client.h" | |
20 #include "chromeos/dbus/mock_bluetooth_device_client.h" | |
21 #include "chromeos/dbus/mock_bluetooth_input_client.h" | |
22 #include "chromeos/dbus/mock_bluetooth_manager_client.h" | |
23 #include "chromeos/dbus/mock_bluetooth_node_client.h" | |
24 #include "chromeos/dbus/mock_bluetooth_out_of_band_client.h" | |
25 #include "chromeos/dbus/mock_cryptohome_client.h" | 19 #include "chromeos/dbus/mock_cryptohome_client.h" |
26 #include "chromeos/dbus/mock_shill_device_client.h" | 20 #include "chromeos/dbus/mock_shill_device_client.h" |
27 #include "chromeos/dbus/mock_shill_ipconfig_client.h" | 21 #include "chromeos/dbus/mock_shill_ipconfig_client.h" |
28 #include "chromeos/dbus/mock_shill_manager_client.h" | 22 #include "chromeos/dbus/mock_shill_manager_client.h" |
29 #include "chromeos/dbus/mock_shill_profile_client.h" | 23 #include "chromeos/dbus/mock_shill_profile_client.h" |
30 #include "chromeos/dbus/mock_shill_service_client.h" | 24 #include "chromeos/dbus/mock_shill_service_client.h" |
31 #include "chromeos/dbus/mock_gsm_sms_client.h" | 25 #include "chromeos/dbus/mock_gsm_sms_client.h" |
32 #include "chromeos/dbus/mock_session_manager_client.h" | 26 #include "chromeos/dbus/mock_session_manager_client.h" |
33 #include "chromeos/dbus/power_policy_controller.h" | 27 #include "chromeos/dbus/power_policy_controller.h" |
34 | 28 |
(...skipping 21 matching lines...) Expand all Loading... |
56 } // namespace | 50 } // namespace |
57 | 51 |
58 MockDBusThreadManager::MockDBusThreadManager() | 52 MockDBusThreadManager::MockDBusThreadManager() |
59 : fake_bluetooth_adapter_client_(new FakeBluetoothAdapterClient()), | 53 : fake_bluetooth_adapter_client_(new FakeBluetoothAdapterClient()), |
60 fake_bluetooth_agent_manager_client_( | 54 fake_bluetooth_agent_manager_client_( |
61 new FakeBluetoothAgentManagerClient()), | 55 new FakeBluetoothAgentManagerClient()), |
62 fake_bluetooth_device_client_(new FakeBluetoothDeviceClient()), | 56 fake_bluetooth_device_client_(new FakeBluetoothDeviceClient()), |
63 fake_bluetooth_input_client_(new FakeBluetoothInputClient()), | 57 fake_bluetooth_input_client_(new FakeBluetoothInputClient()), |
64 fake_bluetooth_profile_manager_client_( | 58 fake_bluetooth_profile_manager_client_( |
65 new FakeBluetoothProfileManagerClient()), | 59 new FakeBluetoothProfileManagerClient()), |
66 mock_bluetooth_adapter_client_(new MockBluetoothAdapterClient), | |
67 mock_bluetooth_device_client_(new MockBluetoothDeviceClient), | |
68 mock_bluetooth_input_client_(new MockBluetoothInputClient), | |
69 mock_bluetooth_manager_client_(new MockBluetoothManagerClient), | |
70 mock_bluetooth_node_client_(new MockBluetoothNodeClient), | |
71 mock_bluetooth_out_of_band_client_(new MockBluetoothOutOfBandClient), | |
72 mock_cryptohome_client_(new MockCryptohomeClient), | 60 mock_cryptohome_client_(new MockCryptohomeClient), |
73 mock_shill_device_client_(new MockShillDeviceClient), | 61 mock_shill_device_client_(new MockShillDeviceClient), |
74 mock_shill_ipconfig_client_(new MockShillIPConfigClient), | 62 mock_shill_ipconfig_client_(new MockShillIPConfigClient), |
75 mock_shill_manager_client_(new MockShillManagerClient), | 63 mock_shill_manager_client_(new MockShillManagerClient), |
76 mock_shill_profile_client_(new MockShillProfileClient), | 64 mock_shill_profile_client_(new MockShillProfileClient), |
77 mock_shill_service_client_(new MockShillServiceClient), | 65 mock_shill_service_client_(new MockShillServiceClient), |
78 mock_gsm_sms_client_(new MockGsmSMSClient), | 66 mock_gsm_sms_client_(new MockGsmSMSClient), |
79 mock_session_manager_client_(new MockSessionManagerClient) { | 67 mock_session_manager_client_(new MockSessionManagerClient) { |
80 EXPECT_CALL(*this, GetBluetoothAdapterClient()) | |
81 .WillRepeatedly(Return(mock_bluetooth_adapter_client_.get())); | |
82 EXPECT_CALL(*this, GetBluetoothDeviceClient()) | |
83 .WillRepeatedly(Return(mock_bluetooth_device_client_.get())); | |
84 EXPECT_CALL(*this, GetBluetoothInputClient()) | |
85 .WillRepeatedly(Return(mock_bluetooth_input_client_.get())); | |
86 EXPECT_CALL(*this, GetBluetoothManagerClient()) | |
87 .WillRepeatedly(Return(mock_bluetooth_manager_client())); | |
88 EXPECT_CALL(*this, GetBluetoothNodeClient()) | |
89 .WillRepeatedly(Return(mock_bluetooth_node_client_.get())); | |
90 EXPECT_CALL(*this, GetBluetoothOutOfBandClient()) | |
91 .WillRepeatedly(Return(mock_bluetooth_out_of_band_client_.get())); | |
92 EXPECT_CALL(*this, GetCryptohomeClient()) | 68 EXPECT_CALL(*this, GetCryptohomeClient()) |
93 .WillRepeatedly(Return(mock_cryptohome_client())); | 69 .WillRepeatedly(Return(mock_cryptohome_client())); |
94 EXPECT_CALL(*this, GetExperimentalBluetoothAdapterClient()) | 70 EXPECT_CALL(*this, GetExperimentalBluetoothAdapterClient()) |
95 .WillRepeatedly(Return(fake_bluetooth_adapter_client_.get())); | 71 .WillRepeatedly(Return(fake_bluetooth_adapter_client_.get())); |
96 EXPECT_CALL(*this, GetExperimentalBluetoothAgentManagerClient()) | 72 EXPECT_CALL(*this, GetExperimentalBluetoothAgentManagerClient()) |
97 .WillRepeatedly(Return(fake_bluetooth_agent_manager_client())); | 73 .WillRepeatedly(Return(fake_bluetooth_agent_manager_client())); |
98 EXPECT_CALL(*this, GetExperimentalBluetoothDeviceClient()) | 74 EXPECT_CALL(*this, GetExperimentalBluetoothDeviceClient()) |
99 .WillRepeatedly(Return(fake_bluetooth_device_client_.get())); | 75 .WillRepeatedly(Return(fake_bluetooth_device_client_.get())); |
100 EXPECT_CALL(*this, GetExperimentalBluetoothInputClient()) | 76 EXPECT_CALL(*this, GetExperimentalBluetoothInputClient()) |
101 .WillRepeatedly(Return(fake_bluetooth_input_client_.get())); | 77 .WillRepeatedly(Return(fake_bluetooth_input_client_.get())); |
(...skipping 19 matching lines...) Expand all Loading... |
121 EXPECT_CALL(*this, GetIBusBus()) | 97 EXPECT_CALL(*this, GetIBusBus()) |
122 .WillRepeatedly(ReturnNull()); | 98 .WillRepeatedly(ReturnNull()); |
123 | 99 |
124 // These observers calls are used in ChromeBrowserMainPartsChromeos. | 100 // These observers calls are used in ChromeBrowserMainPartsChromeos. |
125 EXPECT_CALL(*mock_session_manager_client_.get(), AddObserver(_)) | 101 EXPECT_CALL(*mock_session_manager_client_.get(), AddObserver(_)) |
126 .Times(AnyNumber()); | 102 .Times(AnyNumber()); |
127 EXPECT_CALL(*mock_session_manager_client_.get(), RemoveObserver(_)) | 103 EXPECT_CALL(*mock_session_manager_client_.get(), RemoveObserver(_)) |
128 .Times(AnyNumber()); | 104 .Times(AnyNumber()); |
129 EXPECT_CALL(*mock_session_manager_client_.get(), HasObserver(_)) | 105 EXPECT_CALL(*mock_session_manager_client_.get(), HasObserver(_)) |
130 .Times(AnyNumber()); | 106 .Times(AnyNumber()); |
131 EXPECT_CALL(*mock_bluetooth_manager_client_.get(), AddObserver(_)) | |
132 .Times(AnyNumber()); | |
133 EXPECT_CALL(*mock_bluetooth_manager_client_.get(), RemoveObserver(_)) | |
134 .Times(AnyNumber()); | |
135 EXPECT_CALL(*mock_bluetooth_adapter_client_.get(), AddObserver(_)) | |
136 .Times(AnyNumber()); | |
137 EXPECT_CALL(*mock_bluetooth_adapter_client_.get(), RemoveObserver(_)) | |
138 .Times(AnyNumber()); | |
139 EXPECT_CALL(*mock_bluetooth_device_client_.get(), AddObserver(_)) | |
140 .Times(AnyNumber()); | |
141 EXPECT_CALL(*mock_bluetooth_device_client_.get(), RemoveObserver(_)) | |
142 .Times(AnyNumber()); | |
143 EXPECT_CALL(*mock_bluetooth_input_client_.get(), AddObserver(_)) | |
144 .Times(AnyNumber()); | |
145 EXPECT_CALL(*mock_bluetooth_input_client_.get(), RemoveObserver(_)) | |
146 .Times(AnyNumber()); | |
147 EXPECT_CALL(*mock_bluetooth_node_client_.get(), AddObserver(_)) | |
148 .Times(AnyNumber()); | |
149 EXPECT_CALL(*mock_bluetooth_node_client_.get(), RemoveObserver(_)) | |
150 .Times(AnyNumber()); | |
151 | |
152 // Called from BluetoothManagerImpl ctor. | |
153 EXPECT_CALL(*mock_bluetooth_manager_client_.get(), DefaultAdapter(_)) | |
154 .Times(AnyNumber()); | |
155 | 107 |
156 // Called from AsyncMethodCaller ctor and dtor. | 108 // Called from AsyncMethodCaller ctor and dtor. |
157 EXPECT_CALL(*mock_cryptohome_client_.get(), SetAsyncCallStatusHandlers(_, _)) | 109 EXPECT_CALL(*mock_cryptohome_client_.get(), SetAsyncCallStatusHandlers(_, _)) |
158 .Times(AnyNumber()); | 110 .Times(AnyNumber()); |
159 EXPECT_CALL(*mock_cryptohome_client_.get(), ResetAsyncCallStatusHandlers()) | 111 EXPECT_CALL(*mock_cryptohome_client_.get(), ResetAsyncCallStatusHandlers()) |
160 .Times(AnyNumber()); | 112 .Times(AnyNumber()); |
161 // Called from various locations. | 113 // Called from various locations. |
162 EXPECT_CALL(*mock_cryptohome_client_.get(), GetSystemSalt(_)) | 114 EXPECT_CALL(*mock_cryptohome_client_.get(), GetSystemSalt(_)) |
163 .WillRepeatedly(DoAll(SetArgumentPointee<0>(*GetMockSystemSalt()), | 115 .WillRepeatedly(DoAll(SetArgumentPointee<0>(*GetMockSystemSalt()), |
164 Return(true))); | 116 Return(true))); |
(...skipping 18 matching lines...) Expand all Loading... |
183 observers_.AddObserver(observer); | 135 observers_.AddObserver(observer); |
184 } | 136 } |
185 | 137 |
186 void MockDBusThreadManager::RemoveObserver( | 138 void MockDBusThreadManager::RemoveObserver( |
187 DBusThreadManagerObserver* observer) { | 139 DBusThreadManagerObserver* observer) { |
188 DCHECK(observer); | 140 DCHECK(observer); |
189 observers_.RemoveObserver(observer); | 141 observers_.RemoveObserver(observer); |
190 } | 142 } |
191 | 143 |
192 } // namespace chromeos | 144 } // namespace chromeos |
OLD | NEW |