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