Add support for auto-coverage in Bluetooth-Agent
[platform/core/connectivity/bluetooth-agent.git] / unittest / bluetooth-agent_test.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file        bluetooth-agent_test.cpp
18  * @author      abc
19  * @version     1.0
20  * @brief       Unit-tests setup
21  */
22
23 #include <gtest/gtest.h>
24 #include <unistd.h>
25 #include <glib.h>
26 #include <sys/time.h>
27
28 /* ag-agent header files */
29 #include "bluetooth-ag-agent.h"
30 #include "bluetooth-ag-handler.h"
31
32 /* hid-agent header files */
33 #include "bluetooth-hid-agent.h"
34 #include "bluetooth-hid-manager.h"
35
36 /* ipsp-agent header files */
37 #include "bluetooth-ipsp-agent.h"
38
39 /* map-agent header files */
40 #include "bluetooth_map_agent.h"
41 #include "bluetooth_map_email.h"
42 #include "bluetooth_map_sms.h"
43
44 /* pb-agent header files */
45 #include "bluetooth_pb_vcard.h"
46
47 static GMainLoop *mainloop = NULL;
48
49
50 static gboolean timeout_func(gpointer data)
51 {
52     g_main_loop_quit((GMainLoop *)data);
53     return FALSE;
54 }
55
56 static void wait_for_async(void)
57 {
58     int timeout_id = 0;
59     mainloop = g_main_loop_new(NULL, FALSE);
60
61     timeout_id = g_timeout_add(2000, timeout_func, mainloop);
62     g_main_loop_run(mainloop);
63     g_source_remove(timeout_id);
64 }
65
66 /* Functions for ag-agent */
67 static bt_ag_info_t* __bt_create_ag_info(void)
68 {
69         bt_ag_info_t *bt_ag_info = g_new0(bt_ag_info_t, 1);
70
71         bt_ag_info->rfcomm = NULL;
72         bt_ag_info->slc = NULL;
73         bt_ag_info->hfp_active = TRUE;
74         bt_ag_info->vr_blacklisted = FALSE;
75         bt_ag_info->state = HEADSET_STATE_DISCONNECTED;
76         bt_ag_info->sco_server_started = FALSE;
77         bt_ag_info->path = "dev_00_1C_43_2B_1A_E5";
78
79         bt_ag_info->remote_addr = g_strdup("00:1C:43:2B:1A:E5");
80
81         bt_ag_info->slc = g_new0(bt_ag_slconn_t, 1);
82         bt_ag_info->slc->speaker_gain = 15;
83         bt_ag_info->slc->microphone_gain = 15;
84         bt_ag_info->slc->is_nrec = TRUE;
85
86         return bt_ag_info;
87 }
88
89 static void __bt_destroy_ag_info(bt_ag_info_t *ag_info)
90 {
91         if (ag_info == NULL)
92                 return;
93
94         g_free(ag_info->remote_addr);
95         g_free(ag_info->slc);
96
97         g_free(ag_info);
98 }
99
100
101 TEST(BluetoothAGAgent_test, _bt_ag_slconn_complete) {
102         bt_ag_info_t* ag_info = __bt_create_ag_info();
103
104         _bt_ag_slconn_complete(ag_info);
105
106         /* Need to wait 2 sec for invoking callback */
107         wait_for_async();
108
109         __bt_destroy_ag_info(ag_info);
110 }
111
112 TEST(BluetoothAGAgent_test, _bt_ag_send_response) {
113         int ret = BT_HFP_AGENT_ERROR_NONE;
114         bt_ag_info_t* ag_info = __bt_create_ag_info();
115
116         /* Negative test case : no device is connected */
117         ret = _bt_ag_send_response(ag_info, HFP_STATE_MNGR_ERR_NONE);
118         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
119
120         /* Negative test case : no device is connected */
121         ret = _bt_ag_send_response(ag_info, HFP_STATE_MNGR_ERR_NO_NETWORK_SERVICE);
122         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
123
124         /* Negative test case : no device is connected */
125         ret = _bt_ag_send_response(ag_info, HFP_STATE_MNGR_ERR_AG_FAILURE);
126         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
127
128         ag_info->slc->is_cme_enabled = TRUE;
129
130         /* Negative test case : no device is connected */
131         ret = _bt_ag_send_response(ag_info, HFP_STATE_MNGR_ERR_NO_NETWORK_SERVICE);
132         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
133
134         __bt_destroy_ag_info(ag_info);
135 }
136
137 TEST(BluetoothAGAgent_test, _bt_hfp_call_hold_request) {
138         const char *cmd = "AT+CHLD";
139         bt_ag_info_t* ag_info = __bt_create_ag_info();
140
141         _bt_hfp_call_hold_request(cmd, ag_info);
142
143         __bt_destroy_ag_info(ag_info);
144 }
145
146 TEST(BluetoothAGAgent_test, _bt_hfp_key_press_request) {
147         const char *cmd = "AT+CKPD";
148         bt_ag_info_t* ag_info = __bt_create_ag_info();
149
150         _bt_hfp_key_press_request(cmd, ag_info);
151
152         __bt_destroy_ag_info(ag_info);
153 }
154
155 TEST(BluetoothAGAgent_test, _bt_hfp_terminate_call_request) {
156         bt_ag_info_t* ag_info = __bt_create_ag_info();
157
158         _bt_hfp_terminate_call_request(ag_info);
159
160         __bt_destroy_ag_info(ag_info);
161 }
162
163 TEST(BluetoothAGAgent_test, _bt_hfp_answer_call_request) {
164         bt_ag_info_t* ag_info = __bt_create_ag_info();
165
166         _bt_hfp_answer_call_request(ag_info);
167
168         __bt_destroy_ag_info(ag_info);
169 }
170
171 TEST(BluetoothAGAgent_test, _bt_hfp_update_event_request) {
172         bt_ag_info_t* ag_info = __bt_create_ag_info();
173
174         _bt_hfp_update_event_request(0, ag_info);
175
176         _bt_hfp_update_event_request(1, ag_info);
177
178         __bt_destroy_ag_info(ag_info);
179 }
180
181 TEST(BluetoothAGAgent_test, _bt_hfp_response_and_hold_request) {
182         bt_ag_info_t* ag_info = __bt_create_ag_info();
183
184         _bt_hfp_response_and_hold_request(ag_info);
185
186         __bt_destroy_ag_info(ag_info);
187 }
188
189 TEST(BluetoothAGAgent_test, _bt_hfp_last_dialed_number_request) {
190         bt_ag_info_t* ag_info = __bt_create_ag_info();
191
192         _bt_hfp_last_dialed_number_request(ag_info);
193
194         __bt_destroy_ag_info(ag_info);
195 }
196
197 TEST(BluetoothAGAgent_test, _bt_hfp_dial_number_request) {
198         bt_ag_info_t* ag_info = __bt_create_ag_info();
199         const char *number1 = "#31#";
200         const char *number2 = "*31#";
201         const char *number3 = ">123";
202         const char *number4 = "0123456789";
203
204         _bt_hfp_dial_number_request(number1, ag_info);
205
206         _bt_hfp_dial_number_request(number2, ag_info);
207
208         _bt_hfp_dial_number_request(number3, ag_info);
209
210         _bt_hfp_dial_number_request(number4, ag_info);
211
212         __bt_destroy_ag_info(ag_info);
213 }
214
215 TEST(BluetoothAGAgent_test, _bt_hfp_channel_dtmf_request) {
216         bt_ag_info_t* ag_info = __bt_create_ag_info();
217         const char tone = '1';
218
219         _bt_hfp_channel_dtmf_request(tone, ag_info);
220
221         __bt_destroy_ag_info(ag_info);
222 }
223
224 TEST(BluetoothAGAgent_test, _bt_hfp_subscriber_number_request) {
225         bt_ag_info_t* ag_info = __bt_create_ag_info();
226
227         _bt_hfp_subscriber_number_request(ag_info);
228
229         __bt_destroy_ag_info(ag_info);
230 }
231
232 TEST(BluetoothAGAgent_test, _bt_hfp_get_operator_selection_request) {
233         bt_ag_info_t* ag_info = __bt_create_ag_info();
234
235         _bt_hfp_get_operator_selection_request(ag_info);
236
237         __bt_destroy_ag_info(ag_info);
238 }
239
240 TEST(BluetoothAGAgent_test, _bt_hfp_noise_red_and_echo_cancel_request) {
241         bt_ag_info_t* ag_info = __bt_create_ag_info();
242
243         _bt_hfp_noise_red_and_echo_cancel_request(TRUE, ag_info);
244
245         _bt_hfp_noise_red_and_echo_cancel_request(FALSE, ag_info);
246
247         __bt_destroy_ag_info(ag_info);
248 }
249
250 TEST(BluetoothAGAgent_test, _bt_hfp_voice_dial_request) {
251         bt_ag_info_t* ag_info = __bt_create_ag_info();
252
253         _bt_hfp_voice_dial_request(TRUE, ag_info);
254
255         _bt_hfp_voice_dial_request(FALSE, ag_info);
256
257         __bt_destroy_ag_info(ag_info);
258 }
259
260 TEST(BluetoothAGAgent_test, _bt_hfp_set_indicators) {
261         bt_ag_info_t* ag_info = __bt_create_ag_info();
262
263         const char *cmd = "AT+BIA=call";
264
265         _bt_hfp_set_indicators(cmd, ag_info);
266
267         __bt_destroy_ag_info(ag_info);
268 }
269
270 TEST(BluetoothAGAgent_test, _bt_hfp_select_phonebook_memory_status) {
271         bt_ag_info_t* ag_info = __bt_create_ag_info();
272
273         _bt_hfp_select_phonebook_memory_status(ag_info);
274
275         __bt_destroy_ag_info(ag_info);
276 }
277
278 TEST(BluetoothAGAgent_test, _bt_hfp_select_phonebook_memory_list) {
279         bt_ag_info_t* ag_info = __bt_create_ag_info();
280
281         _bt_hfp_select_phonebook_memory_list(ag_info);
282
283         __bt_destroy_ag_info(ag_info);
284 }
285
286 TEST(BluetoothAGAgent_test, _bt_hfp_select_phonebook_memory) {
287         bt_ag_info_t* ag_info = __bt_create_ag_info();
288         const char *pb_path = "user";
289
290         _bt_hfp_select_phonebook_memory(ag_info, pb_path);
291
292         __bt_destroy_ag_info(ag_info);
293 }
294
295 TEST(BluetoothAGAgent_test, _bt_hfp_read_phonebook_entries_list) {
296         bt_ag_info_t* ag_info = __bt_create_ag_info();
297
298         _bt_hfp_read_phonebook_entries_list(ag_info);
299
300         __bt_destroy_ag_info(ag_info);
301 }
302
303 TEST(BluetoothAGAgent_test, _bt_hfp_read_phonebook_entries) {
304         bt_ag_info_t* ag_info = __bt_create_ag_info();
305         const char *cmd = "AT+CPBR=1,4";
306
307         _bt_hfp_read_phonebook_entries(ag_info, cmd);
308
309         __bt_destroy_ag_info(ag_info);
310 }
311
312 TEST(BluetoothAGAgent_test, _bt_hfp_find_phonebook_entries_status) {
313         bt_ag_info_t* ag_info = __bt_create_ag_info();
314
315         _bt_hfp_find_phonebook_entries_status(ag_info);
316
317         __bt_destroy_ag_info(ag_info);
318 }
319
320 TEST(BluetoothAGAgent_test, _bt_hfp_find_phonebook_entries) {
321         bt_ag_info_t* ag_info = __bt_create_ag_info();
322         const char *cmd = "AT+CPBR=1,4";
323
324         _bt_hfp_find_phonebook_entries(ag_info, cmd);
325
326         __bt_destroy_ag_info(ag_info);
327 }
328
329 TEST(BluetoothAGAgent_test, _bt_hfp_get_character_set) {
330         bt_ag_info_t* ag_info = __bt_create_ag_info();
331
332         _bt_hfp_get_character_set(ag_info);
333
334         __bt_destroy_ag_info(ag_info);
335 }
336
337 TEST(BluetoothAGAgent_test, _bt_hfp_list_supported_character) {
338         bt_ag_info_t* ag_info = __bt_create_ag_info();
339
340         _bt_hfp_list_supported_character(ag_info);
341
342         __bt_destroy_ag_info(ag_info);
343 }
344
345 TEST(BluetoothAGAgent_test, _bt_hfp_set_character_set) {
346         bt_ag_info_t* ag_info = __bt_create_ag_info();
347         const char *cmd = "\"UTF-8\"";
348
349         _bt_hfp_set_character_set(ag_info, cmd);
350
351         __bt_destroy_ag_info(ag_info);
352 }
353
354 TEST(BluetoothAGAgent_test, _bt_hfp_get_battery_property) {
355         bt_ag_info_t* ag_info = __bt_create_ag_info();
356
357         _bt_hfp_get_battery_property(ag_info);
358
359         __bt_destroy_ag_info(ag_info);
360 }
361
362 TEST(BluetoothAGAgent_test, _bt_hfp_signal_quality_reply) {
363         bt_ag_info_t* ag_info = __bt_create_ag_info();
364
365         _bt_hfp_signal_quality_reply(1, 1, ag_info);
366
367         __bt_destroy_ag_info(ag_info);
368 }
369
370 TEST(BluetoothAGAgent_test, _bt_hfp_battery_property_reply) {
371         bt_ag_info_t* ag_info = __bt_create_ag_info();
372
373         _bt_hfp_battery_property_reply(ag_info, 1, 1);
374
375         __bt_destroy_ag_info(ag_info);
376 }
377
378 TEST(BluetoothAGAgent_test, _bt_hfp_operator_reply) {
379         bt_ag_info_t* ag_info = __bt_create_ag_info();
380
381         _bt_hfp_operator_reply("Tizen", ag_info);
382
383         __bt_destroy_ag_info(ag_info);
384 }
385
386 TEST(BluetoothAGAgent_test, _bt_ag_agent_dial_num) {
387         bt_ag_info_t* ag_info = __bt_create_ag_info();
388         int ret = BT_HFP_AGENT_ERROR_NONE;
389
390         /* Negative test case */
391         ret = _bt_ag_agent_dial_num(NULL, 0);
392         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_INVALID_PARAM);
393
394         ret = _bt_ag_agent_dial_num("01012345678", 0);
395         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
396
397         __bt_destroy_ag_info(ag_info);
398 }
399
400 TEST(BluetoothAGAgent_test, _bt_ag_agent_dial_last_num) {
401         bt_ag_info_t* ag_info = __bt_create_ag_info();
402         int ret = BT_HFP_AGENT_ERROR_NONE;
403
404         /* Negative test case : No contact info */
405         ret = _bt_ag_agent_dial_last_num(ag_info);
406         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
407
408         __bt_destroy_ag_info(ag_info);
409 }
410
411 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_signal_quality) {
412         bt_ag_info_t* ag_info = __bt_create_ag_info();
413         gboolean ret = FALSE;
414
415         ret = _bt_ag_agent_get_signal_quality(ag_info);
416         ASSERT_TRUE(ret == TRUE);
417
418         __bt_destroy_ag_info(ag_info);
419 }
420
421 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_battery_status) {
422         bt_ag_info_t* ag_info = __bt_create_ag_info();
423         gboolean ret = FALSE;
424
425         ret = _bt_ag_agent_get_battery_status(ag_info);
426         ASSERT_TRUE(ret == TRUE);
427
428         __bt_destroy_ag_info(ag_info);
429 }
430
431 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_operator_name) {
432         bt_ag_info_t* ag_info = __bt_create_ag_info();
433         gboolean ret = FALSE;
434
435         ret = _bt_ag_agent_get_operator_name(ag_info);
436         ASSERT_TRUE(ret == TRUE);
437
438         __bt_destroy_ag_info(ag_info);
439 }
440
441 TEST(BluetoothAGAgent_test, _bt_hfp_agent_nrec_status) {
442         bt_ag_info_t* ag_info = __bt_create_ag_info();
443         gboolean ret = FALSE;
444
445         ret = _bt_hfp_agent_nrec_status(TRUE, ag_info);
446         ASSERT_TRUE(ret == TRUE);
447
448         ret = _bt_hfp_agent_nrec_status(FALSE, ag_info);
449         ASSERT_TRUE(ret == TRUE);
450
451         __bt_destroy_ag_info(ag_info);
452 }
453
454 TEST(BluetoothAGAgent_test, _bt_ag_agent_voice_dial) {
455         bt_ag_info_t* ag_info = __bt_create_ag_info();
456         gboolean ret = FALSE;
457
458         ret = _bt_ag_agent_voice_dial(FALSE);
459         ASSERT_TRUE(ret == TRUE);
460
461         __bt_destroy_ag_info(ag_info);
462 }
463
464 TEST(BluetoothAGAgent_test, _bt_list_current_calls) {
465         bt_ag_info_t* ag_info = __bt_create_ag_info();
466
467         _bt_list_current_calls(ag_info);
468
469         __bt_destroy_ag_info(ag_info);
470 }
471
472 TEST(BluetoothAGAgent_test, _bt_get_activity_status) {
473         bt_ag_info_t* ag_info = __bt_create_ag_info();
474
475         _bt_get_activity_status(ag_info);
476
477         __bt_destroy_ag_info(ag_info);
478 }
479
480 TEST(BluetoothAGAgent_test, _bt_hfp_set_property_name) {
481         const char *property1 = "OperatorNameChanged";
482         const char *property2 = "SubscriberNumberChanged";
483         const char *operator_name = "Tizen";
484         int ret = 0;
485
486         ret = _bt_hfp_set_property_name(property1, operator_name);
487         ASSERT_TRUE(ret == 1);
488
489         ret = _bt_hfp_set_property_name(property2, operator_name);
490         ASSERT_TRUE(ret == 1);
491 }
492
493 TEST(BluetoothAGAgent_test, _bt_hfp_get_imei_number_reply) {
494         bt_ag_info_t* ag_info = __bt_create_ag_info();
495
496         _bt_hfp_get_imei_number_reply("1234", ag_info);
497
498         __bt_destroy_ag_info(ag_info);
499 }
500
501 TEST(BluetoothAGAgent_test, _bt_hfp_get_model_info_reply) {
502         bt_ag_info_t* ag_info = __bt_create_ag_info();
503
504         _bt_hfp_get_model_info_reply("Tizen", ag_info);
505
506         __bt_destroy_ag_info(ag_info);
507 }
508
509 TEST(BluetoothAGAgent_test, _bt_hfp_get_device_manufacturer_reply) {
510         bt_ag_info_t* ag_info = __bt_create_ag_info();
511
512         _bt_hfp_get_device_manufacturer_reply("Tizen", ag_info);
513
514         __bt_destroy_ag_info(ag_info);
515 }
516
517 TEST(BluetoothAGAgent_test, _bt_hfp_get_revision_info_reply) {
518         bt_ag_info_t* ag_info = __bt_create_ag_info();
519
520         _bt_hfp_get_revision_info_reply("5.0", ag_info);
521
522         __bt_destroy_ag_info(ag_info);
523 }
524
525 TEST(BluetoothAGAgent_test, _bt_hfp_device_disconnected) {
526         bt_ag_info_t* ag_info = __bt_create_ag_info();
527
528         _bt_hfp_device_disconnected(ag_info);
529
530         __bt_destroy_ag_info(ag_info);
531 }
532
533 TEST(BluetoothAGAgent_test, _bt_hfp_get_equipment_identity) {
534         bt_ag_info_t* ag_info = __bt_create_ag_info();
535         const char *cmd1 = "AT+CGSN=?";
536         const char *cmd2 = "AT+CGSN";
537         int ret = BT_HFP_AGENT_ERROR_NONE;
538
539         /* Negative test case */
540         ret = _bt_hfp_get_equipment_identity(ag_info, cmd1);
541         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
542
543         ret = _bt_hfp_get_equipment_identity(ag_info, cmd2);
544         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
545
546         __bt_destroy_ag_info(ag_info);
547 }
548
549 TEST(BluetoothAGAgent_test, _bt_hfp_get_model_information) {
550         bt_ag_info_t* ag_info = __bt_create_ag_info();
551         const char *cmd1 = "AT+CGMM=?";
552         const char *cmd2 = "AT+CGMM";
553         int ret = BT_HFP_AGENT_ERROR_NONE;
554
555         /* Negative test case : No device connected */
556         ret = _bt_hfp_get_model_information(ag_info, cmd1);
557         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
558
559         ret = _bt_hfp_get_model_information(ag_info, cmd2);
560         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
561
562         __bt_destroy_ag_info(ag_info);
563 }
564
565 TEST(BluetoothAGAgent_test, _bt_hfp_get_device_manufacturer) {
566         bt_ag_info_t* ag_info = __bt_create_ag_info();
567         const char *cmd1 = "AT+CGMI=?";
568         const char *cmd2 = "AT+CGMI";
569         int ret = BT_HFP_AGENT_ERROR_NONE;
570
571         /* Negative test case */
572         ret = _bt_hfp_get_device_manufacturer(ag_info, cmd1);
573         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
574
575         ret = _bt_hfp_get_device_manufacturer(ag_info, cmd2);
576         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
577
578         __bt_destroy_ag_info(ag_info);
579 }
580
581 TEST(BluetoothAGAgent_test, _bt_hfp_get_imsi) {
582         bt_ag_info_t* ag_info = __bt_create_ag_info();
583         const char *cmd1 = "AT+IMSI=?";
584         const char *cmd2 = "AT+IMSI";
585         int ret = BT_HFP_AGENT_ERROR_NONE;
586
587         ret = _bt_hfp_get_imsi(ag_info, cmd1);
588         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
589
590         ret = _bt_hfp_get_imsi(ag_info, cmd2);
591         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
592
593         __bt_destroy_ag_info(ag_info);
594 }
595
596 TEST(BluetoothAGAgent_test, _bt_hfp_get_creg_status) {
597         bt_ag_info_t* ag_info = __bt_create_ag_info();
598         const char *cmd1 = "AT+IMSI=?";
599         const char *cmd2 = "AT+IMSI";
600         const char *cmd3 = "AT+IMSI?";
601         int ret = BT_HFP_AGENT_ERROR_NONE;
602
603         ret = _bt_hfp_get_creg_status(ag_info, cmd1);
604         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
605
606         ret = _bt_hfp_get_creg_status(ag_info, cmd2);
607         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
608
609         ret = _bt_hfp_get_creg_status(ag_info, cmd3);
610         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
611
612         __bt_destroy_ag_info(ag_info);
613 }
614
615 TEST(BluetoothAGAgent_test, _bt_hfp_get_revision_information) {
616         bt_ag_info_t* ag_info = __bt_create_ag_info();
617         const char *cmd1 = "AT+CGMR=?";
618         const char *cmd2 = "AT+CGMR";
619         int ret = BT_HFP_AGENT_ERROR_NONE;
620
621         /* Negative test case : No device connected */
622         ret = _bt_hfp_get_revision_information(ag_info, cmd1);
623         ASSERT_TRUE(ret != BT_HFP_AGENT_ERROR_NONE);
624
625         ret = _bt_hfp_get_revision_information(ag_info, cmd2);
626         ASSERT_TRUE(ret == BT_HFP_AGENT_ERROR_NONE);
627
628         __bt_destroy_ag_info(ag_info);
629 }
630
631 TEST(BluetoothAGAgent_test, _bt_hfp_get_equipment_identity_req) {
632         bt_ag_info_t* ag_info = __bt_create_ag_info();
633
634         _bt_hfp_get_equipment_identity_req(ag_info);
635
636         __bt_destroy_ag_info(ag_info);
637 }
638
639 TEST(BluetoothAGAgent_test, _bt_hfp_initialize_telephony_manager) {
640         uint32_t ag_features = BT_AG_FEATURE_EC_AND_NR |
641                                                 BT_AG_FEATURE_REJECT_CALL |
642                                                 BT_AG_FEATURE_ENHANCED_CALL_STATUS |
643                                                 BT_AG_FEATURE_THREE_WAY_CALL |
644                                                 BT_AG_FEATURE_EXTENDED_ERROR_RESULT_CODES |
645                                                 BT_AG_FEATURE_CODEC_NEGOTIATION;
646
647         _bt_hfp_initialize_telephony_manager(ag_features);
648
649         _bt_hfp_deinitialize_telephony_manager();
650 }
651
652 TEST(BluetoothAGAgent_test, _bt_hfp_get_model_info_req) {
653         bt_ag_info_t* ag_info = __bt_create_ag_info();
654
655         _bt_hfp_get_model_info_req(ag_info);
656
657         __bt_destroy_ag_info(ag_info);
658 }
659
660 TEST(BluetoothAGAgent_test, _bt_hfp_get_device_manufacturer_req) {
661         bt_ag_info_t* ag_info = __bt_create_ag_info();
662
663         _bt_hfp_get_device_manufacturer_req(ag_info);
664
665         __bt_destroy_ag_info(ag_info);
666 }
667
668 TEST(BluetoothAGAgent_test, _bt_hfp_get_imsi_req) {
669         bt_ag_info_t* ag_info = __bt_create_ag_info();
670
671         _bt_hfp_get_imsi_req(ag_info);
672
673         __bt_destroy_ag_info(ag_info);
674 }
675
676 TEST(BluetoothAGAgent_test, _bt_hfp_get_creg_status_req) {
677         bt_ag_info_t* ag_info = __bt_create_ag_info();
678
679         _bt_hfp_get_creg_status_req(ag_info);
680
681         __bt_destroy_ag_info(ag_info);
682 }
683
684 TEST(BluetoothAGAgent_test, _bt_hfp_get_revision_info_req) {
685         bt_ag_info_t* ag_info = __bt_create_ag_info();
686
687         _bt_hfp_get_revision_info_req(ag_info);
688
689         __bt_destroy_ag_info(ag_info);
690 }
691
692 TEST(BluetoothAGAgent_test, _bt_hfp_is_call_exist) {
693         gboolean ret = FALSE;
694
695         ret = _bt_hfp_is_call_exist();
696 }
697
698 TEST(BluetoothAGAgent_test, _bt_hfp_release_all_calls_by_sender) {
699         const char *sender = "sender";
700
701         _bt_hfp_release_all_calls_by_sender(sender);
702 }
703
704 TEST(BluetoothAGAgent_test, _bt_hfp_get_imsi_reply) {
705         bt_ag_info_t* ag_info = __bt_create_ag_info();
706
707         _bt_hfp_get_imsi_reply(NULL, NULL, NULL, ag_info);
708
709         _bt_hfp_get_imsi_reply("mmc", "mnc", "msin", ag_info);
710
711         __bt_destroy_ag_info(ag_info);
712 }
713
714 TEST(BluetoothAGAgent_test, _bt_hfp_get_creg_status_reply) {
715         bt_ag_info_t* ag_info = __bt_create_ag_info();
716
717         _bt_hfp_get_creg_status_reply(1, 0, ag_info);
718
719         __bt_destroy_ag_info(ag_info);
720 }
721
722 TEST(BluetoothAGAgent_test, _bt_hfp_vendor_cmd_request) {
723         bt_ag_info_t* ag_info = __bt_create_ag_info();
724         const char *cmd = "AT+VND";
725
726         _bt_hfp_vendor_cmd_request(cmd, ag_info);
727
728         __bt_destroy_ag_info(ag_info);
729 }
730
731 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_model_name) {
732         bt_ag_info_t* ag_info = __bt_create_ag_info();
733
734         _bt_ag_agent_get_model_name(ag_info);
735
736         __bt_destroy_ag_info(ag_info);
737 }
738
739 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_manufacturer_name) {
740         bt_ag_info_t* ag_info = __bt_create_ag_info();
741
742         _bt_ag_agent_get_manufacturer_name(ag_info);
743
744         __bt_destroy_ag_info(ag_info);
745 }
746
747 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_imsi) {
748         bt_ag_info_t* ag_info = __bt_create_ag_info();
749
750         _bt_ag_agent_get_imsi(ag_info);
751
752         __bt_destroy_ag_info(ag_info);
753 }
754
755 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_creg_status) {
756         bt_ag_info_t* ag_info = __bt_create_ag_info();
757
758         _bt_ag_agent_get_creg_status(ag_info);
759
760         __bt_destroy_ag_info(ag_info);
761 }
762
763 TEST(BluetoothAGAgent_test, _bt_ag_agent_get_revision_information) {
764         bt_ag_info_t* ag_info = __bt_create_ag_info();
765
766         _bt_ag_agent_get_revision_information(ag_info);
767
768         __bt_destroy_ag_info(ag_info);
769 }
770
771 #ifdef TIZEN_FEATURE_BT_MEDIA_ENHANCE
772 TEST(BluetoothAGAgent_test, _bt_ag_agent_check_transport_state) {
773         bt_ag_info_t* ag_info = __bt_create_ag_info();
774
775         _bt_ag_agent_check_transport_state(ag_info);
776
777         __bt_destroy_ag_info(ag_info);
778 }
779 #endif
780
781 /* Functions for hid-agent */
782 TEST(BluetoothHIDAgent_test, _bt_hid_disconnect_profile) {
783         bt_hid_agent_error_t ret = BT_HID_AGENT_ERROR_NONE;
784
785         /* Negative test case : no device is connected */
786         ret = _bt_hid_disconnect_profile();
787         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_INTERNAL);
788 }
789
790 TEST(BluetoothHIDAgent_test, _bt_hid_set_profile_state) {
791         _bt_hid_set_profile_state(BT_HID_STATE_CONNECTING);
792
793         _bt_hid_set_profile_state(BT_HID_STATE_CONNECTED);
794
795         _bt_hid_set_profile_state(BT_HID_STATE_UNAVAILABLE);
796 }
797
798 TEST(BluetoothHIDAgent_test, _bt_hid_get_profile_state) {
799         bt_hid_state_t state;
800
801         state = _bt_hid_get_profile_state();
802         ASSERT_TRUE(state >= BT_HID_STATE_UNAVAILABLE && state <= BT_HID_STATE_DISCONNECTING);
803 }
804
805 TEST(BluetoothHIDAgent_test, _bt_hid_register_application) {
806         bt_hid_agent_error_t ret = BT_HID_AGENT_ERROR_NONE;
807
808         /* Negative test case */
809         ret = _bt_hid_register_application(TRUE, NULL);
810         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_INVALID_PARAM);
811
812         ret = _bt_hid_register_application(TRUE, "Sender");
813         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_NONE);
814
815         /* Negative test case */
816         ret = _bt_hid_register_application(TRUE, "Sender");
817         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_ALREADY_EXIST);
818
819         ret = _bt_hid_register_application(FALSE, "Sender");
820         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_NONE);
821
822         /* Negative test case */
823         ret = _bt_hid_register_application(FALSE, "Sender");
824         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_NOT_AVAILABLE);
825 }
826
827 TEST(BluetoothHIDAgent_test, _bt_hid_get_sender_list) {
828         const GSList *senders;
829         bt_hid_agent_error_t ret = BT_HID_AGENT_ERROR_NONE;
830
831         ret = _bt_hid_register_application(TRUE, "Sender");
832         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_NONE);
833
834         senders = _bt_hid_get_sender_list();
835         ASSERT_TRUE(senders != NULL);
836
837         ret = _bt_hid_register_application(FALSE, "Sender");
838         ASSERT_TRUE(ret == BT_HID_AGENT_ERROR_NONE);
839 }
840
841 /* Functions for ipsp-agent */
842 TEST(BluetoothIPSPAgent_test, _bt_ipsp_register_dbus) {
843         gboolean ret = FALSE;
844
845         ret = _bt_ipsp_register_dbus();
846         ASSERT_TRUE(ret == TRUE);
847 }
848
849 TEST(BluetoothIPSPAgent_test, _bt_ipsp_unregister_dbus) {
850         _bt_ipsp_unregister_dbus();
851 }
852
853 TEST(BluetoothIPSPAgent_test, _bt_ipsp_gdbus_deinit_proxys) {
854         _bt_ipsp_gdbus_deinit_proxys();
855 }
856
857 /* Functions for map-agent */
858 static message_info_t* __bt_create_msg_info(void)
859 {
860         message_info_t *bt_msg_info = g_new0(message_info_t, 1);
861
862         bt_msg_info->handle = g_strdup("1");
863         bt_msg_info->subject = g_strdup("subject");
864         bt_msg_info->datetime = g_strdup("datetime");
865         bt_msg_info->sender_name = g_strdup("sender_name");
866         bt_msg_info->sender_addressing = g_strdup("sender_addressing");
867         bt_msg_info->replyto_addressing = g_strdup("replyto_addressing");
868         bt_msg_info->recipient_name = g_strdup("recipient_name");
869         bt_msg_info->recipient_addressing = g_strdup("recipient_addressing");
870         bt_msg_info->type = g_strdup("type");
871         bt_msg_info->reception_status = g_strdup("reception_status");
872         bt_msg_info->size = g_strdup("size");
873         bt_msg_info->attachment_size = g_strdup("attachment_size");
874
875         return bt_msg_info;
876 }
877
878 TEST(BluetoothMAPAgent_test, _bt_mns_client_event_notify) {
879         _bt_mns_client_event_notify("MessageShift", 0,
880                                                         "TELECOM/MSG/DELETED", "/opt/usr", "EMAIL");
881
882 }
883
884 TEST(BluetoothMAPAgent_test, _bt_update_id) {
885         int ret = 0;
886
887         /* Negative test case */
888         ret = _bt_update_id(0, -1, -1);
889         ASSERT_TRUE(ret == -1);
890 }
891
892 TEST(BluetoothMAPAgent_test, _bt_validate_msg_data) {
893         gboolean ret = FALSE;
894         message_info_t *bt_msg_info = __bt_create_msg_info();
895
896         /* Negative test case */
897         ret = _bt_validate_msg_data(NULL);
898         ASSERT_TRUE(ret == FALSE);
899
900         ret = _bt_validate_msg_data(bt_msg_info);
901         ASSERT_TRUE(ret == TRUE);
902
903         _bt_message_info_free(bt_msg_info);
904 }
905
906 TEST(BluetoothMAPAgent_test, _bt_message_info_free) {
907         message_info_t *bt_msg_info = __bt_create_msg_info();
908
909         _bt_message_info_free(bt_msg_info);
910 }
911
912 TEST(BluetoothMAPAgent_test, _get_msg_timestamp) {
913         time_t cur_time = 0;
914         struct tm new_time;
915         struct timeval tv = {0, };
916         char msg_datetime[16] = {0, };
917
918         gettimeofday(&tv, NULL);
919         cur_time = tv.tv_sec;
920
921         _get_msg_timestamp(&cur_time, msg_datetime);
922 }
923
924 TEST(BluetoothMAPAgent_test, _bt_add_id) {
925         guint64 map_id;
926
927         map_id = _bt_add_id(-1, BT_MAP_ID_EMAIL);
928         ASSERT_TRUE(map_id == 1);
929 }
930
931 TEST(BluetoothMAPAgent_test, _bt_validate_uid) {
932         guint64 map_id;
933
934         map_id = _bt_validate_uid(-1, BT_MAP_ID_EMAIL);
935         ASSERT_TRUE(map_id == 1);
936 }
937
938 TEST(BluetoothMAPAgent_test, is_mns_connected) {
939         gboolean ret = FALSE;
940
941         /* Negative test case */
942         ret = is_mns_connected();
943         ASSERT_TRUE(ret == FALSE);
944 }
945
946 TEST(BluetoothMAPAgent_test, _bt_verify_read_status) {
947         gboolean ret = FALSE;
948         message_info_t *bt_msg_info = __bt_create_msg_info();
949
950         ret = _bt_verify_read_status(bt_msg_info, FILTER_READ_STATUS_ALL);
951         _bt_message_info_free(bt_msg_info);
952         ASSERT_TRUE(ret == TRUE);
953
954         bt_msg_info = __bt_create_msg_info();
955
956         ret = _bt_verify_read_status(bt_msg_info, FILTER_READ_STATUS_READ);
957         _bt_message_info_free(bt_msg_info);
958         ASSERT_TRUE(ret == FALSE);
959 }
960
961 TEST(BluetoothMAPAgent_test, _bt_verify_sender) {
962         gboolean ret = FALSE;
963         message_info_t *bt_msg_info = __bt_create_msg_info();
964
965         /* Negative test case */
966         ret = _bt_verify_sender(bt_msg_info, NULL);
967         _bt_message_info_free(bt_msg_info);
968         ASSERT_TRUE(ret == TRUE);
969
970         bt_msg_info = __bt_create_msg_info();
971
972         ret = _bt_verify_sender(bt_msg_info, "*");
973         _bt_message_info_free(bt_msg_info);
974         ASSERT_TRUE(ret == TRUE);
975
976         bt_msg_info = __bt_create_msg_info();
977
978         ret = _bt_verify_sender(bt_msg_info, "sender");
979         _bt_message_info_free(bt_msg_info);
980         ASSERT_TRUE(ret == TRUE);
981
982         bt_msg_info = __bt_create_msg_info();
983
984         /* Negative test case */
985         ret = _bt_verify_sender(bt_msg_info, "negative");
986         _bt_message_info_free(bt_msg_info);
987         ASSERT_TRUE(ret == FALSE);
988 }
989
990 TEST(BluetoothMAPAgent_test, _bt_verify_receiver) {
991         gboolean ret = FALSE;
992         message_info_t *bt_msg_info = __bt_create_msg_info();
993
994         /* Negative test case */
995         ret = _bt_verify_receiver(bt_msg_info, NULL);
996         _bt_message_info_free(bt_msg_info);
997         ASSERT_TRUE(ret == TRUE);
998
999         bt_msg_info = __bt_create_msg_info();
1000
1001         ret = _bt_verify_receiver(bt_msg_info, "*");
1002         _bt_message_info_free(bt_msg_info);
1003         ASSERT_TRUE(ret == TRUE);
1004
1005         bt_msg_info = __bt_create_msg_info();
1006
1007         ret = _bt_verify_receiver(bt_msg_info, "receiver");
1008         _bt_message_info_free(bt_msg_info);
1009         ASSERT_TRUE(ret == FALSE);
1010
1011         bt_msg_info = __bt_create_msg_info();
1012
1013         /* Negative test case */
1014         ret = _bt_verify_receiver(bt_msg_info, "negative");
1015         _bt_message_info_free(bt_msg_info);
1016         ASSERT_TRUE(ret == FALSE);
1017 }
1018
1019 TEST(BluetoothMAPAgent_test, _bt_verify_time) {
1020         gboolean ret = FALSE;
1021         map_msg_filter_t filter = { 0, };
1022         message_info_t *bt_msg_info = __bt_create_msg_info();
1023
1024         ret = _bt_verify_time(bt_msg_info, &filter);
1025         _bt_message_info_free(bt_msg_info);
1026         ASSERT_TRUE(ret == FALSE);
1027 }
1028
1029 TEST(BluetoothMAPAgent_test, _bt_filter_priority) {
1030         gboolean ret = FALSE;
1031         map_msg_filter_t filter = { 0, };
1032         message_info_t *bt_msg_info = __bt_create_msg_info();
1033
1034         ret = _bt_filter_priority(bt_msg_info, FILTER_PRIORITY_ALL);
1035         _bt_message_info_free(bt_msg_info);
1036         ASSERT_TRUE(ret == TRUE);
1037
1038         bt_msg_info = __bt_create_msg_info();
1039
1040         ret = _bt_filter_priority(bt_msg_info, FILTER_PRIORITY_HIGH);
1041         _bt_message_info_free(bt_msg_info);
1042         ASSERT_TRUE(ret == FALSE);
1043 }
1044
1045 TEST(BluetoothMAPAgent_test, _bt_map_start_email_service) {
1046         gboolean ret = FALSE;
1047
1048         /* Negative test case */
1049         ret = _bt_map_start_email_service();
1050         ASSERT_TRUE(ret == FALSE);
1051 }
1052
1053 TEST(BluetoothMAPAgent_test, _bt_map_stop_email_service) {
1054         gboolean ret = FALSE;
1055
1056         ret = _bt_map_stop_email_service();
1057         ASSERT_TRUE(ret == TRUE);
1058 }
1059
1060 TEST(BluetoothMAPAgent_test, _bt_map_email_get_supported_folders) {
1061         gboolean ret = FALSE;
1062         gboolean folders_supported[FOLDER_COUNT][MSG_TYPES] = { {FALSE, FALSE}, };
1063
1064         /* Negative test case */
1065         ret = _bt_map_email_get_supported_folders(folders_supported);
1066         ASSERT_TRUE(ret == FALSE);
1067 }
1068
1069 TEST(BluetoothMAPAgent_test, _bt_map_update_mailbox) {
1070         gboolean ret = FALSE;
1071
1072         /* Negative test case */
1073         ret = _bt_map_update_mailbox("/tmp");
1074         ASSERT_TRUE(ret == FALSE);
1075 }
1076
1077 TEST(BluetoothMAPAgent_test, _bt_map_set_email_read_status) {
1078         gboolean ret = FALSE;
1079
1080         /* Negative test case */
1081         ret = _bt_map_set_email_read_status(-1, 0);
1082         ASSERT_TRUE(ret == FALSE);
1083 }
1084
1085 TEST(BluetoothMAPAgent_test, _bt_map_set_email_delete_status) {
1086         gboolean ret = FALSE;
1087
1088         /* Negative test case */
1089         ret = _bt_map_set_email_delete_status(-1, 0);
1090         ASSERT_TRUE(ret == FALSE);
1091 }
1092
1093 TEST(BluetoothMAPAgent_test, _bt_map_get_email_message) {
1094         gboolean ret = FALSE;
1095         gchar *bmseg = NULL;
1096
1097         /* Negative test case */
1098         ret = _bt_map_get_email_message(-1, FALSE, TRUE, TRUE, &bmseg);
1099         ASSERT_TRUE(ret == FALSE);
1100 }
1101
1102 TEST(BluetoothMAPAgent_test, _bt_map_start_sms_service) {
1103         gboolean ret = FALSE;
1104
1105         ret = _bt_map_start_sms_service();
1106         ASSERT_TRUE(ret == TRUE);
1107 }
1108
1109 TEST(BluetoothMAPAgent_test, _bt_map_stop_sms_service) {
1110         gboolean ret = FALSE;
1111         gchar *bmseg = NULL;
1112
1113         /* Negative test case */
1114         _bt_map_stop_sms_service();
1115         ASSERT_TRUE(ret == FALSE);
1116 }
1117
1118 TEST(BluetoothMAPAgent_test, _bt_map_sms_get_supported_folders) {
1119         gboolean ret = FALSE;
1120         gboolean folders_supported[FOLDER_COUNT][MSG_TYPES] = { {FALSE, FALSE}, };
1121
1122         /* Negative test case */
1123         ret = _bt_map_sms_get_supported_folders(folders_supported);
1124         ASSERT_TRUE(ret == FALSE);
1125 }
1126
1127 TEST(BluetoothMAPAgent_test, _bt_map_get_sms_message) {
1128         gboolean ret = FALSE;
1129         gchar *bmseg = NULL;
1130
1131         /* Negative test case */
1132         ret = _bt_map_get_sms_message(-1, FALSE, TRUE, TRUE, &bmseg);
1133         ASSERT_TRUE(ret == FALSE);
1134 }
1135
1136 TEST(BluetoothMAPAgent_test, _bt_map_set_sms_delete_status) {
1137         gboolean ret = FALSE;
1138
1139         /* Negative test case */
1140         ret = _bt_map_set_sms_delete_status(-1, 0);
1141         ASSERT_TRUE(ret == FALSE);
1142 }
1143
1144 TEST(BluetoothMAPAgent_test, _bt_map_sms_set_read_status) {
1145         gboolean ret = FALSE;
1146
1147         /* Negative test case */
1148         ret = _bt_map_sms_set_read_status(-1, 0);
1149         ASSERT_TRUE(ret == FALSE);
1150 }
1151
1152 /* Functions for pb-agent */
1153 TEST(BluetoothPBAgent_test, _bluetooth_get_contact_addressbook) {
1154         int ret = PBAP_ADDRESSBOOK_PHONE;
1155
1156         ret = _bluetooth_get_contact_addressbook(1);
1157         ASSERT_TRUE(ret == PBAP_ADDRESSBOOK_PHONE);
1158 }
1159
1160 TEST(BluetoothPBAgent_test, _bluetooth_pb_vcard_contact) {
1161         gchar *str = NULL;
1162
1163         /* Negative test case */
1164         str = _bluetooth_pb_vcard_contact(0, VCARD_PHOTO, VCARD_FORMAT_2_1);
1165         ASSERT_TRUE(str == NULL);
1166
1167         /* Negative test case */
1168         str = _bluetooth_pb_vcard_contact(1, VCARD_PHOTO, VCARD_FORMAT_3_0);
1169         ASSERT_TRUE(str == NULL);
1170 }
1171
1172 TEST(BluetoothPBAgent_test, _bluetooth_pb_vcard_contact_owner) {
1173         gchar *str = NULL;
1174         const char *number = "01012345678";
1175
1176         str = _bluetooth_pb_vcard_contact_owner(number, VCARD_PHOTO, VCARD_FORMAT_2_1);
1177         ASSERT_TRUE(str != NULL);
1178         g_free(str);
1179
1180         str = _bluetooth_pb_vcard_contact_owner(number, VCARD_PHOTO, VCARD_FORMAT_3_0);
1181         ASSERT_TRUE(str != NULL);
1182         g_free(str);
1183 }
1184
1185 TEST(BluetoothPBAgent_test, _bluetooth_pb_vcard_call) {
1186         gchar *str = NULL;
1187         const char *attr = "DIALED";
1188
1189         /* Negative test case */
1190         str = _bluetooth_pb_vcard_call(1, VCARD_PHOTO, VCARD_FORMAT_2_1, NULL);
1191         ASSERT_TRUE(str == NULL);
1192
1193         str = _bluetooth_pb_vcard_call(1, VCARD_PHOTO, VCARD_FORMAT_2_1, attr);
1194         ASSERT_TRUE(str != NULL);
1195
1196         g_free(str);
1197 }
1198
1199 TEST(BluetoothPBAgent_test, _bluetooth_pb_fn_from_person_id) {
1200         gchar *str = NULL;
1201
1202         /* Negative test case */
1203         str = _bluetooth_pb_fn_from_person_id(1);
1204         ASSERT_TRUE(str == NULL);
1205 }
1206
1207 TEST(BluetoothPBAgent_test, _bluetooth_pb_name_from_person_id) {
1208         gchar *str = NULL;
1209
1210         /* Negative test case */
1211         str = _bluetooth_pb_name_from_person_id(1);
1212         ASSERT_TRUE(str == NULL);
1213 }
1214
1215 TEST(BluetoothPBAgent_test, _bluetooth_pb_number_from_person_id) {
1216         gchar *str = NULL;
1217
1218         /* Negative test case */
1219         str = _bluetooth_pb_number_from_person_id(1);
1220         ASSERT_TRUE(str == NULL);
1221 }
1222
1223 TEST(BluetoothPBAgent_test, _bluetooth_pb_fn_from_phonelog_id) {
1224         gchar *str = NULL;
1225
1226         str = _bluetooth_pb_fn_from_phonelog_id(1);
1227         ASSERT_TRUE(str != NULL);
1228
1229         g_free(str);
1230 }
1231
1232 TEST(BluetoothPBAgent_test, _bluetooth_pb_name_from_phonelog_id) {
1233         gchar *str = NULL;
1234
1235         str = _bluetooth_pb_name_from_phonelog_id(1);
1236         ASSERT_TRUE(str != NULL);
1237
1238         g_free(str);
1239 }
1240
1241 TEST(BluetoothPBAgent_test, _bluetooth_pb_number_from_phonelog_id) {
1242         gchar *str = NULL;
1243
1244         /* Negative test case */
1245         str = _bluetooth_pb_number_from_phonelog_id(1);
1246         ASSERT_TRUE(str == NULL);
1247 }
1248
1249 TEST(BluetoothPBAgent_test, _bluetooth_pb_owner_name) {
1250         gchar *name = NULL;
1251
1252         /* Negative test case */
1253         name = _bluetooth_pb_owner_name();
1254         ASSERT_TRUE(name != NULL);
1255         g_free(name);
1256 }
1257
1258 TEST(BluetoothPBAgent_test, _bt_is_sim_addressbook) {
1259         bool ret = true;
1260         const char *address_book = "http://tizen.org/addressbook/sim1";
1261
1262         ret = _bt_is_sim_addressbook(address_book);
1263         ASSERT_TRUE(ret == true);
1264 }
1265
1266 int main(int argc, char **argv) {
1267   testing::InitGoogleTest(&argc, argv);
1268
1269   return RUN_ALL_TESTS();
1270 }