fd570dafdea136cb631bfc2d1c8159e0291cb1ba
[platform/core/telephony/libtapi.git] / haltest / tapi_hal_tc.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 #include <gmock/gmock.h>
18 #include <gtest/gtest.h>
19 #include <unistd.h>
20 #include <iostream>
21 #include <stdio.h>
22 #include <glib.h>
23 #include <sys/time.h>
24 #include <system_info.h>
25
26 #include <tapi_common.h>
27 #include <TapiUtility.h>
28 #include <ITapiModem.h>
29 #include <ITapiNetwork.h>
30 #include <ITapiSim.h>
31
32
33 #include "tapi_hal_tc.h"
34
35 using ::testing::EmptyTestEventListener;
36 using ::testing::InitGoogleTest;
37 using ::testing::Test;
38 using ::testing::TestCase;
39 using ::testing::TestEventListeners;
40 using ::testing::TestInfo;
41 using ::testing::TestPartResult;
42 using ::testing::UnitTest;
43
44 #define FEATURE_TELEPHONY       "tizen.org/feature/network.telephony"
45 #define FEATRE_NOT_SUPPORT      "Telephony feature is not supported"
46
47 #define ASYNC_RESULT_SUCCESS 0x0
48 #define ASYNC_RESULT_UNKNOWN 0x0FFFFFFF
49
50 static TapiHandle *tapi_h = NULL;
51 static char **cp_list = NULL;
52 static int cp_count = 0;
53 static bool g_bFeatureTelephony = false;
54 static int async_result = ASYNC_RESULT_UNKNOWN;
55
56 static TelSimCardStatus_t sim_card_status = TAPI_SIM_STATUS_CARD_ERROR;
57
58 static bool __check_telephony_feature_supported()
59 {
60         bool value = false;
61         int ret = system_info_get_platform_bool(FEATURE_TELEPHONY, &value);
62         EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed" << std::endl;
63         EXPECT_EQ(true, value) << FEATRE_NOT_SUPPORT << std::endl;
64         return value;
65 }
66
67 static gboolean __timeout_callback(gpointer data)
68 {
69         EXPECT_TRUE(0) << " - tapi callback timeout!";
70         QUIT_GMAIN_LOOP;
71
72         return false;
73 }
74
75 static void _noti_modem_power(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
76 {
77         int *status = (int *)data;
78
79         std::cout << std::endl;
80         std::cout << "<<notification received - Modem:Power>>" << std::endl;
81         if (!status)
82                 return;
83         std::cout << " [status]: " << *status << "(0:ON,1:OFF,2:RST,3:LOW)" << std::endl << std::endl;
84 }
85
86 static void _noti_registration_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
87 {
88         TelNetworkRegistrationStatus_t *noti = (TelNetworkRegistrationStatus_t *)data;
89
90         int svc_type;
91         tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
92
93         std::cout << std::endl;
94         std::cout << "<<notification received - Network:RegistrationStatus>>" << std::endl;
95
96         std::cout << "  [service_type]: " << svc_type << "(1=No Service, 2=Emergency, 4=2G, 7=3G, 9=LTE)" << std::endl;
97         std::cout << "  [cs status]: " << noti->cs << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)" << std::endl;
98         std::cout << "  [ps status]: " << noti->ps << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)" << std::endl;
99         std::cout << "  [is roaming]: " << noti->is_roaming << std::endl << std::endl;
100 }
101
102 static void _get_flight_mode_callback(TapiHandle *handle, int result, void *data, void *user_data)
103 {
104         int *mode = (int *)data;
105
106         std::cout << "tel_get_flight_mode() response receive" << std::endl;
107         std::cout << "  [result]: " << result << " (0=Success)" << std::endl;
108         async_result = result;
109
110         if (mode)
111                 std::cout << "  [mode]: " << *mode << " (0=flight mode OFF, 1=flight mode ON)" <<std::endl;
112         else
113                 std::cout << "  [mode is invalid]" << std::endl;
114
115         QUIT_GMAIN_LOOP;
116
117 }
118
119 static void _set_flight_mode_callback(TapiHandle *handle, int result, void *data, void *user_data)
120 {
121         std::cout << "tel_set_flight_mode() response receive" << std::endl;
122         std::cout << "  [result]: " << result << " (1=FLIGHT_MODE_ON, 2=FLIGHT_MODE_OFF)" << std::endl;
123         async_result = ASYNC_RESULT_SUCCESS;
124
125         QUIT_GMAIN_LOOP;
126
127 }
128
129 static void _get_sim_iccid_callback(TapiHandle *handle, int result, void *data, void *user_data)
130 {
131         TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
132         TelSimIccIdInfo_t *iccid = (TelSimIccIdInfo_t *)data;
133
134         std::cout << "tel_get_sim_iccid() response received" << std::endl;
135
136         if (sim_card_status == TAPI_SIM_STATUS_CARD_ERROR
137                         || sim_card_status == TAPI_SIM_STATUS_CARD_BLOCKED
138                         || sim_card_status == TAPI_SIM_STATUS_CARD_NOT_PRESENT
139                         || sim_card_status == TAPI_SIM_STATUS_CARD_REMOVED
140                         || sim_card_status == TAPI_SIM_STATUS_UNKNOWN) {
141                 std::cout << "  [MSISDN is unavaliable due to abnormal SIM card status" << std::endl;
142                 async_result = ASYNC_RESULT_SUCCESS;
143                 QUIT_GMAIN_LOOP;
144
145                 return;
146         }
147
148         if ( access_rt == TAPI_SIM_ACCESS_SUCCESS) {
149                 async_result = ASYNC_RESULT_SUCCESS;
150                 std::cout << "  [iccid length]: " << iccid->icc_length << std::endl;
151                 std::cout << "  [iccid]: " << iccid->icc_num << std::endl;
152         }
153
154         QUIT_GMAIN_LOOP;
155
156 }
157
158 static void _get_sim_msisdn_callback(TapiHandle *handle, int result, void *data, void *user_data)
159 {
160         TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
161         TelSimMsisdnList_t *list = (TelSimMsisdnList_t *)data;
162
163         std::cout << "tel_get_sim_msisdn() response received" << std::endl;
164
165         if (sim_card_status == TAPI_SIM_STATUS_CARD_ERROR
166                         || sim_card_status == TAPI_SIM_STATUS_CARD_BLOCKED
167                         || sim_card_status == TAPI_SIM_STATUS_CARD_NOT_PRESENT
168                         || sim_card_status == TAPI_SIM_STATUS_CARD_REMOVED
169                         || sim_card_status == TAPI_SIM_STATUS_UNKNOWN) {
170                 std::cout << "  [MSISDN is unavaliable due to abnormal SIM card status" << std::endl;
171                 async_result = ASYNC_RESULT_SUCCESS;
172                 QUIT_GMAIN_LOOP;
173
174                 return;
175         }
176
177         if ( access_rt == TAPI_SIM_ACCESS_SUCCESS && list) {
178                 async_result = ASYNC_RESULT_SUCCESS;
179                 std::cout << "  [list->count]: " << list->count << std::endl;
180                 if (list->count > 0)
181                         std::cout << "  [msisdn[0]]: name = " << list->list[0].name << ", num = " << list->list[0].num << std::endl;
182         }
183
184         QUIT_GMAIN_LOOP;
185 }
186
187 TEST(TAPI_INIT, tel_get_cp_name_list)
188 {
189         g_bFeatureTelephony = __check_telephony_feature_supported();
190         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
191
192         cp_list = tel_get_cp_name_list();
193         ASSERT_TRUE(cp_list != NULL) << "cp_list is null" << std::endl;
194
195         unsigned int i = 0;
196         while (cp_list[i]) {
197                 cp_count++;
198                 i++;
199         }
200         ASSERT_TRUE(cp_count > 0) << "cp_count is 0" << std::endl;
201         std::cout << "  [cp_count]: " << cp_count << std::endl;
202         std::cout << "  [cp_list[0]]: " << cp_list[0] << std::endl;
203 }
204
205 TEST(TAPI_INIT, tel_init_P)
206 {
207         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
208         ASSERT_TRUE(cp_list != NULL && cp_count > 0);
209
210         tapi_h = tel_init(cp_list[0]);
211         ASSERT_TRUE(tapi_h != NULL) << "tel_init() is failed" << std::endl;
212 }
213
214
215 TEST(TAPI_INIT, tel_get_ready_state_P)
216 {
217         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
218         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
219
220         int state = 0;
221         int ret = tel_get_ready_state(&state);
222         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_ready_state() is failed" << std::endl;
223         ASSERT_TRUE(state == 1) << "TELEPHONY_STATE_NOT_READY" << std::endl;
224
225         std::cout << " - telephony_state : TELEPHONY_STATE_READY" << std::endl;
226 }
227
228 TEST(TAPI_INIT, tel_register_noti_event_P)
229 {
230         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
231         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
232
233         int ret = 0;
234         ret = tel_register_noti_event(tapi_h, TAPI_NOTI_MODEM_POWER, _noti_modem_power, NULL);
235         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_register_noti_event() : TAPI_NOTI_MODEM_POWER is failed" << std::endl;
236
237         ret = tel_register_noti_event(tapi_h, TAPI_NOTI_NETWORK_REGISTRATION_STATUS, _noti_registration_status, NULL);
238         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_register_noti_event() : TAPI_NOTI_NETWORK_REGISTRATION_STATUS is failed" << std::endl;
239
240 }
241
242 TEST(TAPI_NETWORK, tel_get_property_int_P)
243 {
244         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
245         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
246
247         int svc_type = -1, act = -1, cs = -1, ps = -1;
248         int roam = -1, sig_level = -1;
249
250         tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
251         tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_ACT, &act);
252         tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_CIRCUIT_STATUS, &cs);
253         tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_PACKET_STATUS, &ps);
254         tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, &sig_level);
255         tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_ROAMING_STATUS, &roam);
256
257         std::cout << "<network properties>" << std::endl;
258         std::cout << "  [service_type]: " << svc_type << "(1=No Service, 2=Emergency, 4=2G, 7=3G, 9=LTE)" << std::endl;
259         std::cout << "  [access technology]: " << act << "(0=No Service, 1=GSM, 5=UMTS, 7=HSDPA, 19=LTE)" << std::endl;
260         std::cout << "  [cs_status]: " << cs << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)"<< std::endl;
261         std::cout << "  [ps_status]: " << ps << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)"<< std::endl;
262         std::cout << "  [sig_level]: " << sig_level << std::endl;
263         std::cout << "  [roaming_status]: " << roam << std::endl;
264 }
265
266 TEST(TAPI_NETWORK, tel_get_property_string_P)
267 {
268         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
269         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
270
271         char *plmn = NULL, *n_name = NULL, *s_name = NULL;
272
273         tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_PLMN, &plmn);
274         tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_NETWORK_NAME, &n_name);
275         tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_SPN_NAME, &s_name);
276
277         std::cout << "<network properties>" << std::endl;
278         std::cout << "  [plmn]: " << plmn << std::endl;
279         std::cout << "  [network_name]: " << n_name << std::endl;
280         std::cout << "  [spn_name]: " << s_name << std::endl;
281
282         g_free(plmn);
283         g_free(n_name);
284         g_free(s_name);
285
286 }
287
288
289 TEST(TAPI_MODEM, telephony_modem_get_power_status_P)
290 {
291         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
292         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
293
294         int modem_status = -1;
295         int ret = tel_check_modem_power_status(tapi_h, &modem_status);
296         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_check_modem_power_status() is failed" << std::endl;
297
298         std::cout << " - modem_power_status = " << modem_status << " (0=on,1=off,2=rst,3=low)" << std::endl;
299 }
300
301 TEST(TAPI_MODEM, tel_get_misc_me_version_sync_P)
302 {
303         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
304         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
305
306         TelMiscVersionInformation *info = NULL;
307         info = tel_get_misc_me_version_sync(tapi_h);
308         ASSERT_TRUE(NULL != info) << "tel_get_misc_me_version_sync() is failed" << std::endl;
309
310         std::cout << "  [sw version]: " << info->szSwVersion << std::endl;
311         std::cout << "  [hw version]: " << info->szHwVersion << std::endl;
312         std::cout << "  [RfCal Date]: " << info->szRfCalDate << std::endl;
313         std::cout << "  [Product Code]: " << info->szProductCode << std::endl;
314         std::cout << "  [Model ID]: " << info->szModelId << std::endl;
315         std::cout << "  [Prl Version]: " << info->szPrlVersion << std::endl;
316         std::cout << "  [ERI Version]: " << info->szEriVersion << std::endl;
317
318         free(info);
319 }
320
321 TEST(TAPI_MODEM, tel_get_misc_me_sn_sync_P)
322 {
323         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
324         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
325
326         TelMiscSNInformation *sn;
327         sn = tel_get_misc_me_sn_sync(tapi_h);
328         ASSERT_TRUE(NULL != sn) << "tel_get_misc_me_sn_sync() is failed" << std::endl;
329
330
331         std::cout << "  [esn number]: " << sn->szEsn << std::endl;
332         std::cout << "  [meid number]: " << sn->szMeid << std::endl;
333         std::cout << "  [imei number]: " << sn->szImei << std::endl;
334         std::cout << "  [imeisv number]: " << sn->szImeiSv << std::endl;
335
336         free(sn);
337 }
338
339 TEST(TAPI_MODEM, tel_get_misc_me_imei_sync_P)
340 {
341         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
342         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
343
344         char *imei;
345         imei = tel_get_misc_me_imei_sync(tapi_h);
346         ASSERT_TRUE(NULL != imei) << "tel_get_misc_me_imei_sync() is failed" << std::endl;
347
348         std::cout << "  [imei number]: " << imei << std::endl;
349
350         free(imei);
351 }
352
353 TEST(TAPI_MODEM, tel_get_flight_mode_P1)
354 {
355         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
356         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
357
358         int ret = tel_get_flight_mode(tapi_h, _get_flight_mode_callback, NULL);
359         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_flight_mode() is failed" << std::endl;
360
361         RUN_GMAIN_LOOP(__timeout_callback);
362
363         EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_get_flight_mode() is failed failed";
364         async_result = ASYNC_RESULT_UNKNOWN;
365 }
366
367 TEST(TAPI_MODEM, tel_set_flight_mode_on)
368 {
369         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
370         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
371
372         int ret = tel_set_flight_mode(tapi_h, TAPI_POWER_FLIGHT_MODE_ENTER, _set_flight_mode_callback, NULL);
373         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_set_flight_mode() is failed" << std::endl;
374
375         RUN_GMAIN_LOOP(__timeout_callback);
376
377         EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_set_flight_mode()[ON] is failed failed";
378         async_result = ASYNC_RESULT_UNKNOWN;
379 }
380
381 TEST(TAPI_MODEM, tel_get_flight_mode_P2)
382 {
383         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
384         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
385
386         int ret = tel_get_flight_mode(tapi_h, _get_flight_mode_callback, NULL);
387         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_flight_mode() is failed" << std::endl;
388
389         RUN_GMAIN_LOOP(__timeout_callback);
390
391         EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_get_flight_mode() is failed failed";
392         async_result = ASYNC_RESULT_UNKNOWN;
393 }
394
395 TEST(TAPI_MODEM, tel_set_flight_mode_off)
396 {
397         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
398         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
399
400         int ret = tel_set_flight_mode(tapi_h, TAPI_POWER_FLIGHT_MODE_LEAVE, _set_flight_mode_callback, NULL);
401         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_set_flight_mode() is failed" << std::endl;
402
403         RUN_GMAIN_LOOP(__timeout_callback);
404
405         EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_set_flight_mode()[OFF] is failed failed";
406         async_result = ASYNC_RESULT_UNKNOWN;
407 }
408
409 TEST(TAPI_SIM, tel_get_sim_init_info_P)
410 {
411         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
412         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
413
414         int ret = 0;
415         int sim_card_changed = 0;
416
417         ret = tel_get_sim_init_info(tapi_h, &sim_card_status, &sim_card_changed);
418         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_init_info() is failed" << std::endl;
419
420         if (sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
421                 std::cout << "  [SIM status]: SIM_INIT_COMPLETED" << std::endl;
422                 std::cout << "  [SIM changed]: " << sim_card_changed<< std::endl;
423         } else if (sim_card_status == TAPI_SIM_STATUS_CARD_NOT_PRESENT) {
424                 std::cout << "  [SIM status]: No SIM" << std::endl;
425         } else {
426                 std::cout << "  [SIM status]: SIM card Error" << std::endl;
427         }
428 }
429
430 TEST(TAPI_SIM, tel_get_sim_imsi_P)
431 {
432         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
433         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
434
435         int ret = 0;
436         TelSimImsiInfo_t imsi;
437         memset(&imsi, 0, sizeof(TelSimImsiInfo_t));
438
439         if (sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
440         ret = tel_get_sim_imsi(tapi_h, &imsi);
441         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_imsi() is failed" << std::endl;
442
443         std::cout << "  [mcc]: "<< imsi.szMcc << std::endl;
444         std::cout << "  [mnc]: " << imsi.szMnc << std::endl;
445         std::cout << "  [msin]: " << imsi.szMsin << std::endl;
446         }
447 }
448
449 TEST(TAPI_SIM, tel_get_sim_iccid_P)
450 {
451         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
452         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
453
454         int ret = tel_get_sim_iccid(tapi_h, _get_sim_iccid_callback, NULL);
455         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_iccid() is failed" << std::endl;
456
457         if (sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
458                 RUN_GMAIN_LOOP(__timeout_callback);
459
460                 EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_get_sim_iccid() is failed failed";
461                 async_result = ASYNC_RESULT_UNKNOWN;
462         }
463 }
464
465 TEST(TAPI_SIM, tel_get_sim_msisdn_P)
466 {
467         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
468         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
469
470         int ret = tel_get_sim_msisdn(tapi_h, _get_sim_msisdn_callback, NULL);
471         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_msisdn() is failed" << std::endl;
472
473         RUN_GMAIN_LOOP(__timeout_callback);
474
475         EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_get_sim_msisdn() is failed failed";
476         async_result = ASYNC_RESULT_UNKNOWN;
477 }
478
479 TEST(TAPI_DEINIT, tel_deregister_noti_event_P)
480 {
481         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
482         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
483
484         int ret = 0;
485         ret = tel_deregister_noti_event(tapi_h, TAPI_NOTI_MODEM_POWER);
486         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_deregister_noti_event() : TAPI_NOTI_MODEM_POWER is failed" << std::endl;
487
488         ret = tel_deregister_noti_event(tapi_h, TAPI_NOTI_NETWORK_REGISTRATION_STATUS);
489         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_deregister_noti_event() : TAPI_NOTI_NETWORK_REGISTRATION_STATUS is failed" << std::endl;
490 }
491
492 TEST(TAPI_DEINIT, tel_deinit_P)
493 {
494         ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
495         ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
496
497         int ret = tel_deinit(tapi_h);
498         EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_deinit() is failed" << std::endl;
499         tapi_h = NULL;
500 }
501
502 int main(int argc, char **argv)
503 {
504         int ret = -1;
505
506         try {
507                 testing::InitGoogleTest(&argc, argv);
508         } catch(...) {
509                 std::cout << "Exception occurred." << std::endl;
510         }
511         try {
512                 ret = RUN_ALL_TESTS();
513         } catch (const ::testing::internal::GoogleTestFailureException& e) {
514                 ret = -1;
515                 std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
516         }
517         return ret;
518 }