1 /* Copyright 2019 The Chromium OS 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
6 #include <gtest/gtest.h>
7
8 extern "C" {
9 #include "cras_audio_format.h"
10 #include "cras_hfp_alsa_iodev.h"
11 #include "cras_hfp_slc.h"
12 #include "cras_iodev.h"
13 }
14
15 struct hfp_alsa_io {
16 struct cras_iodev base;
17 struct cras_bt_device* device;
18 struct hfp_slc_handle* slc;
19 struct cras_iodev* aio;
20 };
21
22 static struct cras_iodev fake_sco_out, fake_sco_in;
23 static struct cras_bt_device* fake_device;
24 static struct hfp_slc_handle* fake_slc;
25 static struct cras_audio_format fake_format;
26
27 static size_t cras_bt_device_append_iodev_called;
28 static size_t cras_bt_device_rm_iodev_called;
29 static size_t cras_iodev_add_node_called;
30 static size_t cras_iodev_rm_node_called;
31 static size_t cras_iodev_set_active_node_called;
32 static size_t cras_iodev_free_format_called;
33 static size_t cras_iodev_free_resources_called;
34 static size_t cras_iodev_set_format_called;
35 static size_t hfp_set_call_status_called;
36 static size_t hfp_event_speaker_gain_called;
37
38 #define _FAKE_CALL1(name) \
39 static size_t fake_##name##_called; \
40 static int fake_##name(void* a) { \
41 fake_##name##_called++; \
42 return 0; \
43 }
44 #define _FAKE_CALL2(name) \
45 static size_t fake_##name##_called; \
46 static int fake_##name(void* a, void* b) { \
47 fake_##name##_called++; \
48 return 0; \
49 }
50 #define _FAKE_CALL3(name) \
51 static size_t fake_##name##_called; \
52 static int fake_##name(void* a, void* b, void* c) { \
53 fake_##name##_called++; \
54 return 0; \
55 }
56
57 _FAKE_CALL1(open_dev);
58 _FAKE_CALL1(update_supported_formats);
59 _FAKE_CALL1(configure_dev);
60 _FAKE_CALL1(close_dev);
61 _FAKE_CALL1(output_underrun);
62 _FAKE_CALL2(frames_queued);
63 _FAKE_CALL1(delay_frames);
64 _FAKE_CALL3(get_buffer);
65 _FAKE_CALL2(put_buffer);
66 _FAKE_CALL1(flush_buffer);
67 _FAKE_CALL3(update_active_node);
68 _FAKE_CALL1(start);
69 _FAKE_CALL2(no_stream);
70 _FAKE_CALL1(is_free_running);
71 _FAKE_CALL2(get_valid_frames);
72
ResetStubData()73 static void ResetStubData() {
74 cras_bt_device_append_iodev_called = 0;
75 cras_bt_device_rm_iodev_called = 0;
76 cras_iodev_add_node_called = 0;
77 cras_iodev_rm_node_called = 0;
78 cras_iodev_set_active_node_called = 0;
79 cras_iodev_free_format_called = 0;
80 cras_iodev_free_resources_called = 0;
81 cras_iodev_set_format_called = 0;
82 hfp_set_call_status_called = 0;
83 hfp_event_speaker_gain_called = 0;
84
85 fake_sco_out.open_dev = fake_sco_in.open_dev =
86 (int (*)(struct cras_iodev*))fake_open_dev;
87 fake_open_dev_called = 0;
88
89 fake_sco_out.update_supported_formats = fake_sco_in.update_supported_formats =
90 (int (*)(struct cras_iodev*))fake_update_supported_formats;
91 fake_update_supported_formats_called = 0;
92
93 fake_sco_out.configure_dev = fake_sco_in.configure_dev =
94 (int (*)(struct cras_iodev*))fake_configure_dev;
95 fake_configure_dev_called = 0;
96
97 fake_sco_out.close_dev = fake_sco_in.close_dev =
98 (int (*)(struct cras_iodev*))fake_close_dev;
99 fake_close_dev_called = 0;
100
101 fake_sco_out.frames_queued = fake_sco_in.frames_queued =
102 (int (*)(const struct cras_iodev*, struct timespec*))fake_frames_queued;
103 fake_frames_queued_called = 0;
104
105 fake_sco_out.delay_frames = fake_sco_in.delay_frames =
106 (int (*)(const struct cras_iodev*))fake_delay_frames;
107 fake_delay_frames_called = 0;
108
109 fake_sco_out.get_buffer = fake_sco_in.get_buffer = (int (*)(
110 struct cras_iodev*, struct cras_audio_area**, unsigned*))fake_get_buffer;
111 fake_get_buffer_called = 0;
112
113 fake_sco_out.put_buffer = fake_sco_in.put_buffer =
114 (int (*)(struct cras_iodev*, unsigned))fake_put_buffer;
115 fake_put_buffer_called = 0;
116
117 fake_sco_out.flush_buffer = fake_sco_in.flush_buffer =
118 (int (*)(struct cras_iodev*))fake_flush_buffer;
119 fake_flush_buffer_called = 0;
120
121 fake_sco_out.update_active_node = fake_sco_in.update_active_node =
122 (void (*)(struct cras_iodev*, unsigned, unsigned))fake_update_active_node;
123 fake_update_active_node_called = 0;
124
125 fake_sco_out.start = fake_sco_in.start =
126 (int (*)(const struct cras_iodev*))fake_start;
127 fake_start_called = 0;
128
129 fake_sco_out.no_stream = fake_sco_in.no_stream =
130 (int (*)(struct cras_iodev*, int))fake_no_stream;
131 fake_no_stream_called = 0;
132
133 fake_sco_out.is_free_running = fake_sco_in.is_free_running =
134 (int (*)(const struct cras_iodev*))fake_is_free_running;
135 fake_is_free_running_called = 0;
136
137 fake_sco_out.output_underrun =
138 (int (*)(struct cras_iodev*))fake_output_underrun;
139 fake_output_underrun_called = 0;
140
141 fake_sco_out.get_valid_frames =
142 (int (*)(struct cras_iodev*, struct timespec*))fake_get_valid_frames;
143 fake_get_valid_frames_called = 0;
144 }
145
146 namespace {
147
148 class HfpAlsaIodev : public testing::Test {
149 protected:
SetUp()150 virtual void SetUp() { ResetStubData(); }
151
TearDown()152 virtual void TearDown() {}
153 };
154
TEST_F(HfpAlsaIodev,CreateHfpAlsaOutputIodev)155 TEST_F(HfpAlsaIodev, CreateHfpAlsaOutputIodev) {
156 struct cras_iodev* iodev;
157 struct hfp_alsa_io* hfp_alsa_io;
158
159 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
160 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
161 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
162 hfp_alsa_io = (struct hfp_alsa_io*)iodev;
163
164 EXPECT_EQ(CRAS_STREAM_OUTPUT, iodev->direction);
165 EXPECT_EQ(1, cras_bt_device_append_iodev_called);
166 EXPECT_EQ(1, cras_iodev_add_node_called);
167 EXPECT_EQ(1, cras_iodev_set_active_node_called);
168 EXPECT_EQ(&fake_sco_out, hfp_alsa_io->aio);
169
170 hfp_alsa_iodev_destroy(iodev);
171
172 EXPECT_EQ(1, cras_bt_device_rm_iodev_called);
173 EXPECT_EQ(1, cras_iodev_rm_node_called);
174 EXPECT_EQ(1, cras_iodev_free_resources_called);
175 }
176
TEST_F(HfpAlsaIodev,CreateHfpAlsaInputIodev)177 TEST_F(HfpAlsaIodev, CreateHfpAlsaInputIodev) {
178 struct cras_iodev* iodev;
179 struct hfp_alsa_io* hfp_alsa_io;
180
181 fake_sco_in.direction = CRAS_STREAM_INPUT;
182 iodev = hfp_alsa_iodev_create(&fake_sco_in, fake_device, fake_slc,
183 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
184 hfp_alsa_io = (struct hfp_alsa_io*)iodev;
185
186 EXPECT_EQ(CRAS_STREAM_INPUT, iodev->direction);
187 EXPECT_EQ(1, cras_bt_device_append_iodev_called);
188 EXPECT_EQ(1, cras_iodev_add_node_called);
189 EXPECT_EQ(1, cras_iodev_set_active_node_called);
190 EXPECT_EQ(&fake_sco_in, hfp_alsa_io->aio);
191 /* Input device does not use software gain. */
192 EXPECT_EQ(0, iodev->software_volume_needed);
193
194 hfp_alsa_iodev_destroy(iodev);
195
196 EXPECT_EQ(1, cras_bt_device_rm_iodev_called);
197 EXPECT_EQ(1, cras_iodev_rm_node_called);
198 EXPECT_EQ(1, cras_iodev_free_resources_called);
199 }
200
TEST_F(HfpAlsaIodev,OpenDev)201 TEST_F(HfpAlsaIodev, OpenDev) {
202 struct cras_iodev* iodev;
203
204 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
205 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
206 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
207 iodev->open_dev(iodev);
208
209 EXPECT_EQ(1, fake_open_dev_called);
210
211 hfp_alsa_iodev_destroy(iodev);
212 }
213
TEST_F(HfpAlsaIodev,UpdateSupportedFormat)214 TEST_F(HfpAlsaIodev, UpdateSupportedFormat) {
215 struct cras_iodev* iodev;
216 size_t supported_rates[] = {8000, 0};
217 size_t supported_channel_counts[] = {1, 0};
218 snd_pcm_format_t supported_formats[] = {SND_PCM_FORMAT_S16_LE,
219 (snd_pcm_format_t)0};
220
221 fake_sco_out.supported_rates = supported_rates;
222 fake_sco_out.supported_channel_counts = supported_channel_counts;
223 fake_sco_out.supported_formats = supported_formats;
224
225 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
226 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
227 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
228 iodev->update_supported_formats(iodev);
229
230 // update_supported_format on alsa_io is not called.
231 EXPECT_EQ(0, fake_update_supported_formats_called);
232 for (size_t i = 0; i < 2; ++i) {
233 EXPECT_EQ(supported_rates[i], iodev->supported_rates[i]);
234 EXPECT_EQ(supported_channel_counts[i], iodev->supported_channel_counts[i]);
235 EXPECT_EQ(supported_formats[i], iodev->supported_formats[i]);
236 }
237
238 hfp_alsa_iodev_destroy(iodev);
239 }
240
TEST_F(HfpAlsaIodev,ConfigureDev)241 TEST_F(HfpAlsaIodev, ConfigureDev) {
242 struct cras_iodev* iodev;
243 size_t buf_size = 8192;
244 struct hfp_alsa_io* hfp_alsa_io;
245
246 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
247 fake_sco_out.buffer_size = buf_size;
248 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
249 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
250 hfp_alsa_io = (struct hfp_alsa_io*)iodev;
251 iodev->format = &fake_format;
252 iodev->configure_dev(iodev);
253
254 EXPECT_EQ(fake_format.num_channels, hfp_alsa_io->aio->format->num_channels);
255 EXPECT_EQ(fake_format.frame_rate, hfp_alsa_io->aio->format->frame_rate);
256 EXPECT_EQ(fake_format.format, hfp_alsa_io->aio->format->format);
257 for (int i = 0; i < CRAS_CH_MAX; i++)
258 EXPECT_EQ(fake_format.channel_layout[i],
259 hfp_alsa_io->aio->format->channel_layout[i]);
260
261 EXPECT_EQ(1, fake_configure_dev_called);
262 EXPECT_EQ(1, hfp_set_call_status_called);
263 EXPECT_EQ(buf_size, iodev->buffer_size);
264
265 hfp_alsa_iodev_destroy(iodev);
266 }
267
TEST_F(HfpAlsaIodev,CloseDev)268 TEST_F(HfpAlsaIodev, CloseDev) {
269 struct cras_iodev* iodev;
270
271 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
272 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
273 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
274 iodev->close_dev(iodev);
275
276 EXPECT_EQ(1, hfp_set_call_status_called);
277 EXPECT_EQ(1, cras_iodev_free_format_called);
278 EXPECT_EQ(1, fake_close_dev_called);
279
280 hfp_alsa_iodev_destroy(iodev);
281 }
282
TEST_F(HfpAlsaIodev,FramesQueued)283 TEST_F(HfpAlsaIodev, FramesQueued) {
284 struct cras_iodev* iodev;
285
286 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
287 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
288 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
289 iodev->frames_queued(iodev, (struct timespec*)NULL);
290
291 EXPECT_EQ(1, fake_frames_queued_called);
292
293 hfp_alsa_iodev_destroy(iodev);
294 }
295
TEST_F(HfpAlsaIodev,DelayFrames)296 TEST_F(HfpAlsaIodev, DelayFrames) {
297 struct cras_iodev* iodev;
298
299 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
300 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
301 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
302 iodev->delay_frames(iodev);
303
304 EXPECT_EQ(1, fake_delay_frames_called);
305
306 hfp_alsa_iodev_destroy(iodev);
307 }
308
TEST_F(HfpAlsaIodev,GetBuffer)309 TEST_F(HfpAlsaIodev, GetBuffer) {
310 struct cras_iodev* iodev;
311
312 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
313 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
314 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
315 iodev->get_buffer(iodev, (struct cras_audio_area**)NULL, (unsigned*)NULL);
316
317 EXPECT_EQ(1, fake_get_buffer_called);
318
319 hfp_alsa_iodev_destroy(iodev);
320 }
321
TEST_F(HfpAlsaIodev,PutBuffer)322 TEST_F(HfpAlsaIodev, PutBuffer) {
323 struct cras_iodev* iodev;
324
325 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
326 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
327 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
328 iodev->put_buffer(iodev, 0xdeadbeef);
329
330 EXPECT_EQ(1, fake_put_buffer_called);
331
332 hfp_alsa_iodev_destroy(iodev);
333 }
334
TEST_F(HfpAlsaIodev,FlushBuffer)335 TEST_F(HfpAlsaIodev, FlushBuffer) {
336 struct cras_iodev* iodev;
337
338 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
339 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
340 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
341 iodev->flush_buffer(iodev);
342
343 EXPECT_EQ(1, fake_flush_buffer_called);
344
345 hfp_alsa_iodev_destroy(iodev);
346 }
347
TEST_F(HfpAlsaIodev,UpdateActiveNode)348 TEST_F(HfpAlsaIodev, UpdateActiveNode) {
349 struct cras_iodev* iodev;
350
351 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
352 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
353 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
354 iodev->update_active_node(iodev, 0xdeadbeef, 0xdeadbeef);
355
356 EXPECT_EQ(1, fake_update_active_node_called);
357
358 hfp_alsa_iodev_destroy(iodev);
359 }
360
TEST_F(HfpAlsaIodev,Start)361 TEST_F(HfpAlsaIodev, Start) {
362 struct cras_iodev* iodev;
363
364 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
365 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
366 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
367 iodev->start(iodev);
368
369 EXPECT_EQ(1, fake_start_called);
370
371 hfp_alsa_iodev_destroy(iodev);
372 }
373
TEST_F(HfpAlsaIodev,SetVolume)374 TEST_F(HfpAlsaIodev, SetVolume) {
375 struct cras_iodev* iodev;
376
377 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
378 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
379 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
380 iodev->set_volume(iodev);
381
382 EXPECT_EQ(1, hfp_event_speaker_gain_called);
383
384 hfp_alsa_iodev_destroy(iodev);
385 }
386
TEST_F(HfpAlsaIodev,NoStream)387 TEST_F(HfpAlsaIodev, NoStream) {
388 struct cras_iodev* iodev;
389
390 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
391 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
392 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
393 iodev->min_cb_level = 0xab;
394 iodev->max_cb_level = 0xcd;
395
396 iodev->no_stream(iodev, 1);
397
398 EXPECT_EQ(0xab, fake_sco_out.min_cb_level);
399 EXPECT_EQ(0xcd, fake_sco_out.max_cb_level);
400 EXPECT_EQ(1, fake_no_stream_called);
401
402 hfp_alsa_iodev_destroy(iodev);
403 }
404
TEST_F(HfpAlsaIodev,IsFreeRunning)405 TEST_F(HfpAlsaIodev, IsFreeRunning) {
406 struct cras_iodev* iodev;
407
408 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
409 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
410 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
411 iodev->is_free_running(iodev);
412
413 EXPECT_EQ(1, fake_is_free_running_called);
414
415 hfp_alsa_iodev_destroy(iodev);
416 }
417
TEST_F(HfpAlsaIodev,OutputUnderrun)418 TEST_F(HfpAlsaIodev, OutputUnderrun) {
419 struct cras_iodev* iodev;
420
421 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
422 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
423 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
424 iodev->min_cb_level = 0xab;
425 iodev->max_cb_level = 0xcd;
426
427 iodev->output_underrun(iodev);
428
429 EXPECT_EQ(0xab, fake_sco_out.min_cb_level);
430 EXPECT_EQ(0xcd, fake_sco_out.max_cb_level);
431 EXPECT_EQ(1, fake_output_underrun_called);
432
433 hfp_alsa_iodev_destroy(iodev);
434 }
435
TEST_F(HfpAlsaIodev,GetValidFrames)436 TEST_F(HfpAlsaIodev, GetValidFrames) {
437 struct cras_iodev* iodev;
438 struct timespec ts;
439
440 fake_sco_out.direction = CRAS_STREAM_OUTPUT;
441 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc,
442 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
443
444 iodev->get_valid_frames(iodev, &ts);
445
446 EXPECT_EQ(1, fake_get_valid_frames_called);
447
448 hfp_alsa_iodev_destroy(iodev);
449 }
450 } // namespace
451
452 extern "C" {
453
cras_iodev_set_format(struct cras_iodev * iodev,const struct cras_audio_format * fmt)454 int cras_iodev_set_format(struct cras_iodev* iodev,
455 const struct cras_audio_format* fmt) {
456 cras_iodev_set_format_called++;
457 return 0;
458 }
459
cras_iodev_free_format(struct cras_iodev * iodev)460 void cras_iodev_free_format(struct cras_iodev* iodev) {
461 cras_iodev_free_format_called++;
462 }
463
cras_iodev_add_node(struct cras_iodev * iodev,struct cras_ionode * node)464 void cras_iodev_add_node(struct cras_iodev* iodev, struct cras_ionode* node) {
465 cras_iodev_add_node_called++;
466 iodev->nodes = node;
467 }
468
cras_iodev_rm_node(struct cras_iodev * iodev,struct cras_ionode * node)469 void cras_iodev_rm_node(struct cras_iodev* iodev, struct cras_ionode* node) {
470 cras_iodev_rm_node_called++;
471 iodev->nodes = NULL;
472 }
473
cras_iodev_set_active_node(struct cras_iodev * iodev,struct cras_ionode * node)474 void cras_iodev_set_active_node(struct cras_iodev* iodev,
475 struct cras_ionode* node) {
476 cras_iodev_set_active_node_called++;
477 iodev->active_node = node;
478 }
479
480 // From ewma_power
ewma_power_disable(struct ewma_power * ewma)481 void ewma_power_disable(struct ewma_power* ewma) {}
482
cras_system_get_volume()483 size_t cras_system_get_volume() {
484 return 0;
485 }
486
cras_bt_device_name(const struct cras_bt_device * device)487 const char* cras_bt_device_name(const struct cras_bt_device* device) {
488 return "fake-device-name";
489 }
490
cras_bt_device_address(const struct cras_bt_device * device)491 const char* cras_bt_device_address(const struct cras_bt_device* device) {
492 return "1A:2B:3C:4D:5E:6F";
493 }
494
cras_bt_device_append_iodev(struct cras_bt_device * device,struct cras_iodev * iodev,enum cras_bt_device_profile profile)495 void cras_bt_device_append_iodev(struct cras_bt_device* device,
496 struct cras_iodev* iodev,
497 enum cras_bt_device_profile profile) {
498 cras_bt_device_append_iodev_called++;
499 }
500
cras_bt_device_rm_iodev(struct cras_bt_device * device,struct cras_iodev * iodev)501 void cras_bt_device_rm_iodev(struct cras_bt_device* device,
502 struct cras_iodev* iodev) {
503 cras_bt_device_rm_iodev_called++;
504 }
505
cras_bt_device_object_path(const struct cras_bt_device * device)506 const char* cras_bt_device_object_path(const struct cras_bt_device* device) {
507 return "/fake/object/path";
508 }
509
cras_bt_device_get_stable_id(const struct cras_bt_device * device)510 int cras_bt_device_get_stable_id(const struct cras_bt_device* device) {
511 return 123;
512 }
513
cras_iodev_free_resources(struct cras_iodev * iodev)514 void cras_iodev_free_resources(struct cras_iodev* iodev) {
515 cras_iodev_free_resources_called++;
516 }
517
hfp_set_call_status(struct hfp_slc_handle * handle,int call)518 int hfp_set_call_status(struct hfp_slc_handle* handle, int call) {
519 hfp_set_call_status_called++;
520 return 0;
521 }
522
hfp_event_speaker_gain(struct hfp_slc_handle * handle,int gain)523 int hfp_event_speaker_gain(struct hfp_slc_handle* handle, int gain) {
524 hfp_event_speaker_gain_called++;
525 return 0;
526 }
527
cras_bt_device_get_sco(struct cras_bt_device * device,int codec)528 int cras_bt_device_get_sco(struct cras_bt_device* device, int codec) {
529 return 0;
530 }
531
cras_bt_device_put_sco(struct cras_bt_device * device)532 void cras_bt_device_put_sco(struct cras_bt_device* device) {}
533
hfp_slc_get_selected_codec(struct hfp_slc_handle * handle)534 int hfp_slc_get_selected_codec(struct hfp_slc_handle* handle) {
535 return HFP_CODEC_ID_CVSD;
536 }
537
538 } // extern "C"
539
main(int argc,char ** argv)540 int main(int argc, char** argv) {
541 ::testing::InitGoogleTest(&argc, argv);
542 return RUN_ALL_TESTS();
543 }
544