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