Merge "Add LCOV macro for coverage" into tizen
[platform/core/api/connection.git] / unittest / utc-network-connection.c
1 //
2 // Copyright (c) 2020 Samsung Electronics Co., Ltd.
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 "utc-connection-common.h"
18
19 static void test_network_state_changed_cb(connection_type_e state, void* user_data)
20 {
21         PRINT_RETURN("test_network_state_changed_cb", CONNECTION_ERROR_NONE);
22 }
23
24 static void test_ip_address_changed_cb(const char* ipv4_address, const char* ipv6_address, void* user_data)
25 {
26         PRINT_RETURN("test_ip_address_changed_cb", CONNECTION_ERROR_NONE);
27 }
28
29 static void test_proxy_address_changed_cb(const char* ipv4_address, const char* ipv6_address, void* user_data)
30 {
31         PRINT_RETURN("test_proxy_address_changed_cb", CONNECTION_ERROR_NONE);
32 }
33
34 static void test_connection_opened_callback(connection_error_e result, void* user_data)
35 {
36         PRINT_RETURN("test_connection_opened_callback", result);
37         g_CallbackRet = result;
38 }
39
40 static void test_connection_closed_callback(connection_error_e result, void* user_data)
41 {
42         PRINT_RETURN("test_connection_closed_callback", result);
43         g_CallbackRet = result;
44 }
45
46 static void test_connection_set_default_callback(connection_error_e result, void* user_data)
47 {
48         PRINT_RETURN("test_connection_set_default_callback", result);
49         g_CallbackRet = result;
50 }
51
52 static void test_connection_set_ethernet_callback(connection_ethernet_cable_state_e state, void* user_data)
53 {
54         PRINT_RETURN("test_connection_set_ethernet_callback", state);
55         g_CallbackRet = CONNECTION_ERROR_NONE;
56 }
57
58 static void test_connection_reset_profile_callback(connection_error_e result, void* user_data)
59 {
60         PRINT_RETURN("test_connection_reset_profile_callback", result);
61         g_CallbackRet = result;
62 }
63
64 static bool test_connection_ipv6_address_callback(char *ipv6_address, void *user_data)
65 {
66         PRINT_RETURN("test_connection_ipv6_address_callback", CONNECTION_ERROR_NONE);
67         return true;
68 }
69
70 static void test_connection_internet_state_changed_callback(connection_internet_state_e state, void* user_data)
71 {
72         PRINT_RETURN("test_connection_internet_state_changed_callback", CONNECTION_ERROR_NONE);
73 }
74
75 /**
76  * @function            utc_network_connection_startup
77  * @description         Called before each test
78  * @parameter           NA
79  * @return                      NA
80  */
81 void utc_network_connection_startup(void)
82 {
83         wifi_supported = connection_check_feature_supported(FEATURE_WIFI);
84         telephony_supported = connection_check_feature_supported(FEATURE_TELEPHONY);
85         bt_tethering_supported = connection_check_feature_supported(FEATURE_BT_TETHERING);
86         ethernet_supported = connection_check_feature_supported(FEATURE_ETHERNET);
87         route_supported = connection_check_feature_supported(FEATURE_ROUTE);
88
89         if (telephony_supported == false && wifi_supported == false
90                         && bt_tethering_supported == false && ethernet_supported == false) {
91                 all_features_not_supported = true;
92                 return;
93         }
94
95         int ret = connection_create(&connection);
96         PRINT_RETURN("connection_create", ret);
97
98         if (ret != CONNECTION_ERROR_NONE)
99                 return;
100
101         if (telephony_supported) {
102                 if (!profile_cellular) {
103                         ret = connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, CUSTOM_PROFILE_NAME, &profile_cellular);
104                         PRINT_RETURN("connection_profile_create", ret);
105                 }
106         }
107 }
108
109 /**
110  * @function            utc_network_connection_cleanup
111  * @description         Called after each test
112  * @parameter           NA
113  * @return                      NA
114  */
115 void utc_network_connection_cleanup(void)
116 {
117         int ret;
118
119         if (profile_cellular) {
120                 ret = connection_profile_destroy(profile_cellular);
121                 PRINT_RETURN("connection_profile_destroy", ret);
122                 profile_cellular = NULL;
123         }
124
125         if (profile_temp) {
126                 ret = connection_profile_destroy(profile_temp);
127                 PRINT_RETURN("connection_profile_destroy", ret);
128                 profile_temp = NULL;
129         }
130
131         if (connection) {
132                 ret = connection_destroy(connection);
133                 PRINT_RETURN("connection_destroy", ret);
134                 connection = NULL;
135         }
136 }
137
138 /**
139  * @testcase            utc_connection_create_p
140  * @since_tizen         2.3
141  * @type                Positive
142  * @description         Creates a handle for managing data connections.
143  * @scenario            Invoking connection_create with valid parameter.Destroy and create Connection.
144  */
145 int utc_connection_create_p(void)
146 {
147         int ret;
148
149         if (all_features_not_supported) {
150                 ret = connection_create(&connection);
151                 CHECK_RETURN("connection_create", ret, CONNECTION_ERROR_NOT_SUPPORTED);
152                 return 0;
153         }
154
155         if (connection) {
156                 ret = connection_destroy(connection);
157                 PRINT_RETURN("connection_destroy", ret);
158                 connection = NULL;
159         }
160
161         ret = connection_create(&connection);
162         CHECK_RETURN("connection_create", ret, CONNECTION_ERROR_NONE);
163
164         return 0;
165 }
166
167 /**
168  * @testcase            utc_connection_create_n
169  * @since_tizen         2.3
170  * @type                Negative
171  * @description         connection_create should fail with invalid parameter.
172  * @scenario            Verify connection_create by passing NULL parameter.
173  */
174 int utc_connection_create_n(void)
175 {
176         int ret;
177
178         if (all_features_not_supported) {
179                 ret = connection_create(&connection);
180                 CHECK_RETURN("connection_create", ret, CONNECTION_ERROR_NOT_SUPPORTED);
181                 return 0;
182         }
183
184         if (connection) {
185                 ret = connection_destroy(connection);
186                 PRINT_RETURN("connection_destroy", ret);
187                 connection = NULL;
188         }
189
190         ret = connection_create(NULL);
191         CHECK_RETURN("connection_create", ret, CONNECTION_ERROR_INVALID_PARAMETER);
192
193         return 0;
194 }
195
196 /**
197  * @testcase            utc_connection_get_ip_address_p
198  * @since_tizen         2.3
199  * @type                Positive
200  * @description         Gets the IP address of the current connection.
201  * @scenario            Invoking connection_get_ip_address with valid parameter.
202  */
203 int utc_connection_get_ip_address_p(void)
204 {
205         char *ip_address = NULL;
206
207         int ret = connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_address);
208         FREE_RESOURCE(ip_address);
209
210         if (all_features_not_supported)
211                 CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_NOT_SUPPORTED);
212         else
213                 CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_NONE);
214         ret = connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV6, &ip_address);
215         FREE_RESOURCE(ip_address);
216
217         if (all_features_not_supported)
218                 CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_NOT_SUPPORTED);
219         else
220                 CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_NONE);
221         return 0;
222 }
223
224 /**
225  * @testcase            utc_connection_get_ip_address_n
226  * @since_tizen         2.3
227  * @type                Negative
228  * @description         connection_get_ip_address should fail with invalid parameter.
229  * @scenario            Verify connection_get_ip_address by passing invalid parameter.
230  */
231 int utc_connection_get_ip_address_n(void)
232 {
233         int ret;
234         char *ip_address = NULL;
235
236         if (all_features_not_supported) {
237                 ret = connection_get_ip_address(connection, -100, NULL);
238                 CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_NOT_SUPPORTED);
239                 return 0;
240         }
241
242         ret = connection_get_ip_address(NULL, -100, NULL);
243         CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
244         ret = connection_get_ip_address(NULL, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_address);
245         FREE_RESOURCE(ip_address);
246         CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
247         ret = connection_get_ip_address(connection, -100, &ip_address);
248         FREE_RESOURCE(ip_address);
249         CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
250         ret = connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV4, NULL);
251         CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
252         ret = connection_get_ip_address(NULL, -100, &ip_address);
253         FREE_RESOURCE(ip_address);
254         CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
255         ret = connection_get_ip_address(NULL, CONNECTION_ADDRESS_FAMILY_IPV4, NULL);
256         CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
257         ret = connection_get_ip_address(connection, -100, NULL);
258         CHECK_RETURN("connection_get_ip_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
259
260         return 0;
261 }
262
263 /**
264  * @testcase            utc_connection_get_proxy_p
265  * @since_tizen         2.3
266  * @type                Positive
267  * @description         Gets the proxy address of the current connection.
268  * @scenario            Invoking connection_get_proxy with valid parameter.
269  */
270 int utc_connection_get_proxy_p(void)
271 {
272         char *proxy = NULL;
273
274         int ret = connection_get_proxy(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy);
275         FREE_RESOURCE(proxy);
276         if (all_features_not_supported)
277                 CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_NOT_SUPPORTED);
278         else
279                 CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_NONE);
280         return 0;
281 }
282
283 /**
284  * @testcase            utc_connection_get_proxy_n
285  * @since_tizen         2.3
286  * @type                Negative
287  * @description         connection_get_proxy should fail with invalid parameter.
288  * @scenario            Verify connection_get_proxy by passing invalid parameter.
289  */
290 int utc_connection_get_proxy_n(void)
291 {
292         int ret;
293         char *proxy = NULL;
294
295         if (all_features_not_supported) {
296                 ret = connection_get_proxy(connection, -100, NULL);
297                 CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_NOT_SUPPORTED);
298                 return 0;
299         }
300
301         ret = connection_get_proxy(NULL, -100, NULL);
302         CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
303         ret = connection_get_proxy(NULL, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy);
304         FREE_RESOURCE(proxy);
305         CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
306         ret = connection_get_proxy(connection, -100, &proxy);
307         FREE_RESOURCE(proxy);
308         CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
309         ret = connection_get_proxy(connection, CONNECTION_ADDRESS_FAMILY_IPV4, NULL);
310         CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
311         ret = connection_get_proxy(NULL, -100, &proxy);
312         FREE_RESOURCE(proxy);
313         CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
314         ret = connection_get_proxy(NULL, CONNECTION_ADDRESS_FAMILY_IPV4, NULL);
315         CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
316         ret = connection_get_proxy(connection, -100, NULL);
317         CHECK_RETURN("connection_get_proxy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
318
319         return 0;
320 }
321
322 /**
323  * @testcase            utc_connection_get_type_n
324  * @since_tizen         2.3
325  * @type                Negative
326  * @description         connection_get_type should fail with invalid parameter.
327  * @scenario            Verify connection_get_type by passing invalid parameter.
328  */
329 int utc_connection_get_type_n(void)
330 {
331         int ret;
332         connection_type_e state;
333
334         if (all_features_not_supported) {
335                 ret = connection_get_type(connection, NULL);
336                 CHECK_RETURN("connection_get_type", ret, CONNECTION_ERROR_NOT_SUPPORTED);
337                 return 0;
338         }
339
340         ret = connection_get_type(NULL, NULL);
341         CHECK_RETURN("connection_get_type", ret, CONNECTION_ERROR_INVALID_PARAMETER);
342         ret = connection_get_type(NULL, &state);
343         CHECK_RETURN("connection_get_type", ret, CONNECTION_ERROR_INVALID_PARAMETER);
344         ret = connection_get_type(connection, NULL);
345         CHECK_RETURN("connection_get_type", ret, CONNECTION_ERROR_INVALID_PARAMETER);
346
347         return 0;
348 }
349
350 /**
351  * @testcase            utc_connection_get_type_p
352  * @since_tizen         2.3
353  * @type                Positive
354  * @description         Gets the type of the current profile for data connection.
355  * @scenario            Invoking connection_get_type with valid parameter.
356  */
357 int utc_connection_get_type_p(void)
358 {
359         connection_type_e state;
360
361         int ret = connection_get_type(connection, &state);
362
363         if (all_features_not_supported)
364                 CHECK_RETURN("connection_get_type", ret, CONNECTION_ERROR_NOT_SUPPORTED);
365         else
366                 CHECK_RETURN("connection_get_type", ret, CONNECTION_ERROR_NONE);
367         return 0;
368 }
369
370 /**
371  * @testcase            utc_connection_is_metered_network_n
372  * @since_tizen         4.0
373  * @type                Negative
374  * @description         connection_is_metered_network should fail with invalid parameter.
375  * @scenario            Verify utc_connection_is_metered_network_n by passing invalid parameter.
376  */
377 int utc_connection_is_metered_network_n(void)
378 {
379         int ret;
380         bool state;
381
382         if (all_features_not_supported) {
383                 ret = connection_is_metered_network(connection, NULL);
384                 CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_NOT_SUPPORTED);
385                 return 0;
386         }
387
388         ret = connection_is_metered_network(NULL, NULL);
389         CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_INVALID_PARAMETER);
390         ret = connection_is_metered_network(NULL, &state);
391         CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_INVALID_PARAMETER);
392         ret = connection_is_metered_network(connection, NULL);
393         CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_INVALID_PARAMETER);
394
395         return 0;
396 }
397
398 /**
399  * @testcase            utc_connection_is_metered_network_p
400  * @since_tizen         4.0
401  * @type                Positive
402  * @description         Gets if the current connection is metered.
403  * @scenario            Invoking utc_connection_is_metered_network_p with valid parameter.
404  */
405 int utc_connection_is_metered_network_p(void)
406 {
407         bool state = false;
408         connection_type_e type;
409
410         int ret = connection_is_metered_network(connection, &state);
411         connection_get_type(connection, &type);
412
413         if (all_features_not_supported)
414                 CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_NOT_SUPPORTED);
415         else if (state)
416                 CHECK_RETURN("connection_is_metered_network", type, CONNECTION_TYPE_CELLULAR);
417         else
418                 CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_NONE);
419         return 0;
420 }
421
422 /**
423  * @testcase            utc_connection_get_cellular_state_n
424  * @since_tizen         2.3
425  * @type                Negative
426  * @description         connection_get_cellular_state should fail with invalid parameter.
427  * @scenario            Verify connection_get_cellular_state by passing invalid parameter.
428  */
429 int utc_connection_get_cellular_state_n(void)
430 {
431         connection_cellular_state_e state;
432
433         if (!telephony_supported) {
434                 int ret = connection_get_cellular_state(NULL, NULL);
435                 CHECK_RETURN("connection_get_cellular_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
436                 return 0;
437         }
438
439         int ret = connection_get_cellular_state(NULL, NULL);
440         CHECK_RETURN("connection_get_cellular_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
441         ret = connection_get_cellular_state(NULL, &state);
442         CHECK_RETURN("connection_get_cellular_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
443         ret = connection_get_cellular_state(connection, NULL);
444         CHECK_RETURN("connection_get_cellular_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
445
446         return 0;
447 }
448
449 /**
450  * @testcase            utc_connection_get_cellular_state_p
451  * @since_tizen         2.3
452  * @type                Positive
453  * @description         Gets the state of cellular connection.
454  * @scenario            Invoking connection_get_cellular_state with valid parameter.
455  */
456 int utc_connection_get_cellular_state_p(void)
457 {
458         connection_cellular_state_e state;
459
460         if (!telephony_supported) {
461                 int ret = connection_get_cellular_state(connection, &state);
462                 CHECK_RETURN("connection_get_cellular_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
463                 return 0;
464         }
465
466         int ret = connection_get_cellular_state(connection, &state);
467         CHECK_RETURN("connection_get_cellular_state", ret, CONNECTION_ERROR_NONE);
468
469         return 0;
470 }
471
472 /**
473  * @testcase            utc_connection_get_ethernet_state_n
474  * @since_tizen         2.4
475  * @type                Negative
476  * @description         connection_get_ethernet_state should fail with invalid parameter.
477  * @scenario            Verify connection_get_ethernet_state by passing invalid parameter.
478  */
479 int utc_connection_get_ethernet_state_n(void)
480 {
481         connection_ethernet_state_e state;
482
483         if (!ethernet_supported) {
484                 int ret = connection_get_ethernet_state(NULL, NULL);
485                 CHECK_RETURN("connection_get_ethernet_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
486                 return 0;
487         }
488
489         int ret = connection_get_ethernet_state(NULL, NULL);
490         CHECK_RETURN("connection_get_ethernet_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
491         ret = connection_get_ethernet_state(NULL, &state);
492         CHECK_RETURN("connection_get_ethernet_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
493         ret = connection_get_ethernet_state(connection, NULL);
494         CHECK_RETURN("connection_get_ethernet_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
495
496         return 0;
497 }
498
499 /**
500  * @testcase            utc_connection_get_ethernet_state_p
501  * @since_tizen         2.4
502  * @type                Positive
503  * @description         Gets the state of the Ethernet.
504  * @scenario            Invoking connection_get_ethernet_state with valid parameter.
505  */
506 int utc_connection_get_ethernet_state_p(void)
507 {
508         connection_ethernet_state_e state;
509
510         if (!ethernet_supported) {
511                 int ret = connection_get_ethernet_state(connection, &state);
512                 CHECK_RETURN("connection_get_ethernet_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
513                 return 0;
514         }
515
516         int ret = connection_get_ethernet_state(connection, &state);
517         CHECK_RETURN("connection_get_ethernet_state", ret, CONNECTION_ERROR_NONE);
518
519         return 0;
520 }
521
522 /**
523  * @testcase            utc_connection_get_wifi_state_n
524  * @since_tizen         2.3
525  * @type                Negative
526  * @description         connection_get_wifi_state should fail with invalid parameter.
527  * @scenario            Verify connection_get_wifi_state by passing invalid parameter.
528  */
529 int utc_connection_get_wifi_state_n(void)
530 {
531         connection_wifi_state_e state;
532
533         if (!wifi_supported) {
534                 int ret = connection_get_wifi_state(NULL, NULL);
535                 CHECK_RETURN("connection_get_wifi_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
536                 return 0;
537         }
538
539         int ret = connection_get_wifi_state(NULL, NULL);
540         CHECK_RETURN("connection_get_wifi_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
541         ret = connection_get_wifi_state(NULL, &state);
542         CHECK_RETURN("connection_get_wifi_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
543         ret = connection_get_wifi_state(connection, NULL);
544         CHECK_RETURN("connection_get_wifi_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
545
546         return 0;
547 }
548
549 /**
550  * @testcase            utc_connection_get_wifi_state_p
551  * @since_tizen         2.3
552  * @type                Positive
553  * @description         Gets the state of the Wi-Fi.
554  * @scenario            Invoking connection_get_wifi_state with valid parameter.
555  */
556 int utc_connection_get_wifi_state_p(void)
557 {
558         connection_wifi_state_e state;
559
560         if (!wifi_supported) {
561                 int ret = connection_get_wifi_state(connection, &state);
562                 CHECK_RETURN("connection_get_wifi_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
563                 return 0;
564         }
565
566         int ret = connection_get_wifi_state(connection, &state);
567         CHECK_RETURN("connection_get_wifi_state", ret, CONNECTION_ERROR_NONE);
568
569         return 0;
570 }
571
572 /**
573  * @testcase            utc_connection_get_bt_state_n
574  * @since_tizen         2.3
575  * @type                Negative
576  * @description         connection_get_bt_state should fail with invalid parameter.
577  * @scenario            Verify connection_get_bt_state by passing invalid parameter.
578  */
579 int utc_connection_get_bt_state_n(void)
580 {
581         connection_bt_state_e state;
582
583         if (!bt_tethering_supported) {
584                 int ret = connection_get_bt_state(NULL, NULL);
585                 CHECK_RETURN("connection_get_bt_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
586                 return 0;
587         }
588
589         int ret = connection_get_bt_state(NULL, NULL);
590         CHECK_RETURN("connection_get_bt_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
591         ret = connection_get_bt_state(NULL, &state);
592         CHECK_RETURN("connection_get_bt_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
593         ret = connection_get_bt_state(connection, NULL);
594         CHECK_RETURN("connection_get_bt_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
595
596         return 0;
597 }
598
599 /**
600  * @testcase            utc_connection_get_bt_state_p
601  * @since_tizen         2.3
602  * @type                Positive
603  * @description         Gets the state of the bluetooth.The returned state is for the bluetooth connection state.
604  * @scenario            Invoking connection_get_bt_state with valid parameter.
605  */
606 int utc_connection_get_bt_state_p(void)
607 {
608         connection_bt_state_e state;
609
610         if (!bt_tethering_supported) {
611                 int ret = connection_get_bt_state(connection, &state);
612                 CHECK_RETURN("connection_get_bt_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
613                 return 0;
614         }
615
616         int ret = connection_get_bt_state(connection, &state);
617         CHECK_RETURN("connection_get_bt_state", ret, CONNECTION_ERROR_NONE);
618
619         return 0;
620 }
621
622 /**
623  * @testcase            utc_connection_get_mac_address_n
624  * @since_tizen         2.4
625  * @type                Negative
626  * @description         connection_get_mac_address should fail with invalid parameter.
627  * @scenario            Verify connection_get_mac_address by passing invalid parameter.
628  */
629 int utc_connection_get_mac_address_n(void)
630 {
631         int ret;
632         char *mac_addr = NULL;
633
634         if (wifi_supported == false && ethernet_supported == false) {
635                 ret = connection_get_mac_address(connection, CONNECTION_TYPE_WIFI, &mac_addr);
636                 CHECK_RETURN("connection_get_mac_address", ret, CONNECTION_ERROR_NOT_SUPPORTED);
637                 return 0;
638         }
639
640         if (wifi_supported) {
641                 ret = connection_get_mac_address(NULL, CONNECTION_TYPE_WIFI, &mac_addr);
642                 FREE_RESOURCE(mac_addr);
643                 CHECK_RETURN("connection_get_mac_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
644         } else {
645                 ret = connection_get_mac_address(connection, CONNECTION_TYPE_ETHERNET, NULL);
646                 FREE_RESOURCE(mac_addr);
647                 CHECK_RETURN("connection_get_mac_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
648         }
649
650         return 0;
651 }
652
653 /**
654  * @testcase            utc_connection_get_mac_address_p
655  * @since_tizen         2.4
656  * @type                Positive
657  * @description         Gets the MAC address of the Wi-Fi or ethernet.
658  * @scenario            Invoking connection_get_mac_address with valid parameter.
659  */
660 int utc_connection_get_mac_address_p(void)
661 {
662         int ret;
663         char *mac_addr = NULL;
664
665         if (wifi_supported) {
666                 ret = connection_get_mac_address(connection, CONNECTION_TYPE_WIFI, &mac_addr);
667                 assert(mac_addr); FREE_RESOURCE(mac_addr);
668                 CHECK_RETURN("connection_get_mac_address", ret, CONNECTION_ERROR_NONE);
669         } else if (ethernet_supported) {
670                 ret = connection_get_mac_address(connection, CONNECTION_TYPE_ETHERNET, &mac_addr);
671                 assert(mac_addr); FREE_RESOURCE(mac_addr);
672                 CHECK_RETURN("connection_get_mac_address", ret, CONNECTION_ERROR_NONE);
673         } else {
674                 ret = connection_get_mac_address(connection, CONNECTION_TYPE_WIFI, &mac_addr);
675                 FREE_RESOURCE(mac_addr);
676                 CHECK_RETURN("connection_get_mac_address", ret, CONNECTION_ERROR_NOT_SUPPORTED);
677         }
678
679         return 0;
680 }
681
682 /**
683  * @testcase            utc_connection_set_ethernet_cable_state_chaged_cb_n
684  * @since_tizen         2.4
685  * @type                Negative
686  * @description         connection_set_ethernet_cable_state_chaged_cb should fail with invalid parameter.
687  * @scenario            Verify connection_set_ethernet_cable_state_chaged_cb by passing invalid parameter.
688  */
689 int utc_connection_set_ethernet_cable_state_chaged_cb_n(void)
690 {
691         int ret;
692         if (ethernet_supported == false) {
693                 ret = connection_set_ethernet_cable_state_chaged_cb(NULL, NULL, NULL);
694                 CHECK_RETURN("connection_set_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
695                 return 0;
696         }
697
698         ret = connection_set_ethernet_cable_state_chaged_cb(NULL,
699                         test_connection_set_ethernet_callback, NULL);
700         CHECK_RETURN("connection_set_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
701         ret = connection_set_ethernet_cable_state_chaged_cb(connection, NULL, NULL);
702         CHECK_RETURN("connection_set_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
703
704         return 0;
705 }
706
707 int utc_connection_set_ethernet_cable_state_chaged_cb_p(void)
708 {
709         int ret;
710         if (ethernet_supported == false) {
711                 ret = connection_set_ethernet_cable_state_chaged_cb(NULL, NULL, NULL);
712                 CHECK_RETURN("connection_set_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
713                 return 0;
714         }
715
716         ret = connection_set_ethernet_cable_state_chaged_cb(connection, test_connection_set_ethernet_callback, NULL);
717         CHECK_RETURN("connection_set_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_NONE);
718
719         return 0;
720 }
721
722 /**
723  * @testcase            utc_connection_unset_ethernet_cable_state_chaged_cb_n
724  * @since_tizen         2.4
725  * @type                Negative
726  * @description         connection_unset_ethernet_cable_state_chaged_cb should fail with invalid parameter.
727  * @scenario            Verify connection_unset_ethernet_cable_state_chaged_cb by passing invalid parameter.
728  */
729 int utc_connection_unset_ethernet_cable_state_chaged_cb_n(void)
730 {
731         int ret;
732         ret = connection_unset_ethernet_cable_state_chaged_cb(NULL);
733
734         if (ethernet_supported == false)
735                 CHECK_RETURN("connection_unset_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
736         else
737                 CHECK_RETURN("connection_unset_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
738
739
740         return 0;
741 }
742
743 int utc_connection_unset_ethernet_cable_state_chaged_cb_p(void)
744 {
745         int ret;
746         ret = connection_unset_ethernet_cable_state_chaged_cb(connection);
747         if (ethernet_supported == false)
748                 CHECK_RETURN("connection_unset_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
749         else
750                 CHECK_RETURN("connection_unset_ethernet_cable_state_chaged_cb", ret, CONNECTION_ERROR_NONE);
751         return 0;
752 }
753
754 /**
755  * @testcase            utc_connection_get_ethernet_cable_state_n
756  * @since_tizen         2.4
757  * @type                Negative
758  * @description         connection_get_ethernet_cable_state should fail with invalid parameter.
759  * @scenario            Verify connection_get_ethernet_cable_state by passing invalid parameter.
760  */
761 int utc_connection_get_ethernet_cable_state_n(void)
762 {
763         int ret;
764         connection_ethernet_cable_state_e cable_state;
765
766         if (ethernet_supported == false) {
767                 ret = connection_get_ethernet_cable_state(NULL, NULL);
768                 CHECK_RETURN("connection_get_ethernet_cable_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
769                 return 0;
770         }
771
772         ret = connection_get_ethernet_cable_state(NULL, &cable_state);
773         CHECK_RETURN("connection_get_ethernet_cable_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
774         ret = connection_get_ethernet_cable_state(connection, NULL);
775         CHECK_RETURN("connection_get_ethernet_cable_state", ret, CONNECTION_ERROR_INVALID_PARAMETER);
776
777         return 0;
778 }
779
780 /**
781  * @testcase            utc_connection_get_ethernet_cable_state_p
782  * @since_tizen         2.4
783  * @type                Positive
784  * @description         Checks for ethernet cable is attached or not.
785  * @scenario            Invoking connection_get_ethernet_cable_state with valid parameter.
786  */
787 int utc_connection_get_ethernet_cable_state_p(void)
788 {
789         int ret;
790         connection_ethernet_cable_state_e cable_state;
791
792         ret = connection_get_ethernet_cable_state(connection, &cable_state);
793         if (ethernet_supported == false)
794                 CHECK_RETURN("connection_get_ethernet_cable_state", ret, CONNECTION_ERROR_NOT_SUPPORTED);
795         else
796                 CHECK_RETURN("connection_get_ethernet_cable_state", ret, CONNECTION_ERROR_NONE);
797         return 0;
798 }
799
800 /**
801  * @testcase            utc_connection_get_current_profile_p
802  * @since_tizen         2.3
803  * @type                Positive
804  * @description         Gets the name of the default profile.
805  * @scenario            Invoking connection_get_current_profile with valid parameter.
806  */
807 int utc_connection_get_current_profile_p(void)
808 {
809         int ret = connection_get_current_profile(connection, &profile_temp);
810
811         if (all_features_not_supported)
812                 CHECK_RETURN("connection_get_current_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
813         else
814                 CHECK_RETURN("connection_get_current_profile", ret, CONNECTION_ERROR_NONE);
815         return 0;
816 }
817
818 /**
819  * @testcase            utc_connection_get_current_profile_n
820  * @since_tizen         2.3
821  * @type                Negative
822  * @description         connection_get_current_profile should fail with invalid parameter.
823  * @scenario            Verify connection_get_current_profile by passing invalid parameter.
824  */
825 int utc_connection_get_current_profile_n(void)
826 {
827         int ret;
828         connection_profile_h profile = NULL;
829
830         if (all_features_not_supported) {
831                 ret = connection_get_current_profile(connection, NULL);
832                 CHECK_RETURN("connection_get_current_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
833                 return 0;
834         }
835
836         ret = connection_get_current_profile(NULL, NULL);
837         CHECK_RETURN("connection_get_current_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
838         ret = connection_get_current_profile(connection, NULL);
839         CHECK_RETURN("connection_get_current_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
840         ret = connection_get_current_profile(NULL, &profile);
841         CHECK_RETURN("connection_get_current_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
842
843         return 0;
844 }
845
846 /**
847  * @testcase            utc_connection_get_default_cellular_service_profile_p
848  * @since_tizen         2.3
849  * @type                Positive
850  * @description         Gets the default profile which provides the given cellular service.
851  * @scenario            Invoking connection_get_default_cellular_service_profile with valid parameter.
852  */
853 int utc_connection_get_default_cellular_service_profile_p(void)
854 {
855         connection_profile_h profile = NULL;
856
857         if (!telephony_supported) {
858                 int ret = connection_get_default_cellular_service_profile(connection, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET, &profile);
859                 CHECK_RETURN("connection_get_default_cellular_service_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
860                 return 0;
861         }
862
863         connection_cellular_state_e state;
864         int ret = connection_get_cellular_state(connection, &state);
865         PRINT_RETURN("connection_get_cellular_state", ret);
866         if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
867                 return 0;
868
869         int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
870         ret = connection_get_default_cellular_service_profile(connection, service_type, &profile);
871         CHECK_RETURN("connection_get_default_cellular_service_profile", ret, CONNECTION_ERROR_NONE);
872
873         service_type = CONNECTION_CELLULAR_SERVICE_TYPE_MMS;
874         ret = connection_get_default_cellular_service_profile(connection, service_type, &profile);
875         CHECK_RETURN("connection_get_default_cellular_service_profile", ret, CONNECTION_ERROR_NONE);
876
877         return 0;
878 }
879
880 /**
881  * @testcase            utc_connection_get_default_cellular_service_profile_n
882  * @since_tizen         2.3
883  * @type                Negative
884  * @description         connection_get_default_cellular_service_profile should fail with invalid parameter.
885  * @scenario            Verify connection_get_default_cellular_service_profile by passing invalid parameter.
886  */
887 int utc_connection_get_default_cellular_service_profile_n(void)
888 {
889         connection_profile_h profile = NULL;
890
891         if (!telephony_supported) {
892                 int ret = connection_get_default_cellular_service_profile(NULL, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET, NULL);
893                 CHECK_RETURN("connection_get_default_cellular_service_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
894                 return 0;
895         }
896
897         int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
898         int ret = connection_get_default_cellular_service_profile(NULL, service_type, NULL);
899         CHECK_RETURN("connection_get_default_cellular_service_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
900         service_type = CONNECTION_CELLULAR_SERVICE_TYPE_MMS;
901         ret = connection_get_default_cellular_service_profile(connection, service_type, NULL);
902         CHECK_RETURN("connection_get_default_cellular_service_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
903         service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
904         ret = connection_get_default_cellular_service_profile(NULL, service_type, &profile);
905         CHECK_RETURN("connection_get_default_cellular_service_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
906
907         return 0;
908 }
909
910 /**
911  * @testcase            utc_connection_set_default_cellular_service_profile_p
912  * @since_tizen         2.3
913  * @type                Positive
914  * @description         Sets the default profile which provides the given cellular service.
915  * @scenario            Invoking connection_set_default_cellular_service_profile with valid parameter.
916  */
917 int utc_connection_set_default_cellular_service_profile_p(void)
918 {
919         int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
920
921         if (!telephony_supported) {
922                 int ret = connection_set_default_cellular_service_profile(connection, service_type, profile_cellular);
923                 CHECK_RETURN("connection_set_default_cellular_service_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
924                 return 0;
925         }
926
927         connection_cellular_state_e state;
928         int ret = connection_get_cellular_state(connection, &state);
929         PRINT_RETURN("connection_get_cellular_state", ret);
930         if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
931                 return 0;
932
933         ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular);
934         CHECK_RETURN("connection_set_default_cellular_service_profile", ret, CONNECTION_ERROR_NONE);
935
936         ret = connection_set_default_cellular_service_profile(connection, service_type, profile_cellular);
937         CHECK_RETURN("connection_set_default_cellular_service_profile", ret, CONNECTION_ERROR_NONE);
938
939         return 0;
940 }
941
942 /**
943  * @testcase            utc_connection_set_default_cellular_service_profile_n
944  * @since_tizen         2.3
945  * @type                Negative
946  * @description         connection_set_default_cellular_service_profile should fail with invalid parameter.
947  * @scenario            Verify connection_set_default_cellular_service_profile by passing invalid parameter.
948  */
949 int utc_connection_set_default_cellular_service_profile_n(void)
950 {
951         int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
952
953         if (!telephony_supported) {
954                 int ret = connection_set_default_cellular_service_profile(NULL, service_type, NULL);
955                 CHECK_RETURN("connection_set_default_cellular_service_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
956                 return 0;
957         }
958
959         int ret = connection_set_default_cellular_service_profile(NULL, service_type, NULL);
960         CHECK_RETURN("connection_set_default_cellular_service_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
961         ret = connection_set_default_cellular_service_profile(connection, service_type, NULL);
962         CHECK_RETURN("connection_set_default_cellular_service_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
963         service_type = CONNECTION_CELLULAR_SERVICE_TYPE_TETHERING;
964         ret = connection_get_default_cellular_service_profile(NULL, service_type, profile_cellular);
965         CHECK_RETURN("connection_set_default_cellular_service_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
966
967         return 0;
968 }
969
970 /**
971  * @testcase            utc_connection_set_default_cellular_service_profile_async_p
972  * @since_tizen         2.3
973  * @type                Positive
974  * @description         Sets the default profile which provides the given cellular service, asynchronously.
975  * @scenario            Invoking connection_set_default_cellular_service_profile_async with valid parameter.
976  */
977 int utc_connection_set_default_cellular_service_profile_async_p(void)
978 {
979         int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
980
981         if (!telephony_supported) {
982                 int ret = connection_set_default_cellular_service_profile_async(connection, service_type, NULL, test_connection_set_default_callback, NULL);
983                 CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_NOT_SUPPORTED);
984                 return 0;
985         }
986
987         connection_cellular_state_e state;
988         int ret = connection_get_cellular_state(connection, &state);
989         PRINT_RETURN("connection_get_cellular_state", ret);
990         if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
991                 return 0;
992
993         ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular);
994         CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_NONE);
995
996         ret = connection_set_default_cellular_service_profile_async(connection, service_type, profile_cellular, test_connection_set_default_callback, NULL);
997         CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_NONE);
998         test_connection_set_default_callback(CONNECTION_ERROR_NONE, NULL);
999
1000         return 0;
1001 }
1002
1003 /**
1004  * @testcase            utc_connection_set_default_cellular_service_profile_async_n
1005  * @since_tizen         2.3
1006  * @type                Negative
1007  * @description         connection_set_default_cellular_service_profile_async should fail with invalid parameter.
1008  * @scenario            Verify connection_set_default_cellular_service_profile_async by passing invalid parameter.
1009  */
1010 int utc_connection_set_default_cellular_service_profile_async_n(void)
1011 {
1012         int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
1013
1014         if (!telephony_supported) {
1015                 int ret = connection_set_default_cellular_service_profile_async(NULL, service_type, NULL, NULL, NULL);
1016                 CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1017                 return 0;
1018         }
1019
1020         int ret = connection_set_default_cellular_service_profile_async(NULL, service_type, NULL, NULL, NULL);
1021         CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1022         ret = connection_set_default_cellular_service_profile_async(connection, service_type, profile_cellular, NULL, NULL);
1023         CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1024         ret = connection_set_default_cellular_service_profile_async(connection, service_type, NULL, test_connection_set_default_callback, NULL);
1025         CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1026         service_type = CONNECTION_CELLULAR_SERVICE_TYPE_TETHERING;
1027         ret = connection_set_default_cellular_service_profile_async(NULL, service_type, profile_cellular, test_connection_set_default_callback, NULL);
1028         CHECK_RETURN("connection_set_default_cellular_service_profile_async", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1029
1030         return 0;
1031 }
1032
1033 /**
1034  * @testcase            utc_connection_set_type_changed_cb_n
1035  * @since_tizen         2.3
1036  * @type                Negative
1037  * @description         connection_set_type_changed_cb should fail with invalid parameter.
1038  * @scenario            Verify connection_set_type_changed_cb by passing invalid parameter.
1039  */
1040 int utc_connection_set_type_changed_cb_n(void)
1041 {
1042         int ret;
1043
1044         if (all_features_not_supported) {
1045                 ret = connection_set_type_changed_cb(connection, NULL, NULL);
1046                 CHECK_RETURN("connection_set_type_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1047                 return 0;
1048         }
1049
1050         ret = connection_set_type_changed_cb(NULL, NULL, NULL);
1051         CHECK_RETURN("connection_set_type_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1052         ret = connection_set_type_changed_cb(NULL, test_network_state_changed_cb, NULL);
1053         CHECK_RETURN("connection_set_type_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1054         ret = connection_set_type_changed_cb(connection, NULL, NULL);
1055         CHECK_RETURN("connection_set_type_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1056
1057         return 0;
1058 }
1059
1060 /**
1061  * @testcase            utc_connection_set_type_changed_cb_p
1062  * @since_tizen         2.3
1063  * @type                Positive
1064  * @description         Registers the callback that is called when the type of the current connection is changed.
1065  * @scenario            Invoking connection_set_type_changed_cb with valid parameter.
1066  */
1067 int utc_connection_set_type_changed_cb_p(void)
1068 {
1069         int ret;
1070
1071         if (all_features_not_supported) {
1072                 ret = connection_set_type_changed_cb(connection, NULL, NULL);
1073                 CHECK_RETURN("connection_set_type_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1074                 return 0;
1075         }
1076
1077         ret = connection_set_type_changed_cb(connection, test_network_state_changed_cb, NULL);
1078         CHECK_RETURN("connection_set_type_changed_cb", ret, CONNECTION_ERROR_NONE);
1079         test_network_state_changed_cb(CONNECTION_TYPE_CELLULAR, NULL);
1080
1081         return 0;
1082 }
1083
1084 /**
1085  * @testcase            utc_connection_unset_type_changed_cb_n
1086  * @since_tizen         2.3
1087  * @type                Negative
1088  * @description         connection_unset_type_changed_cb should fail with invalid parameter.
1089  * @scenario            Verify connection_unset_type_changed_cb by passing invalid parameter.
1090  */
1091 int utc_connection_unset_type_changed_cb_n(void)
1092 {
1093         int ret = connection_unset_type_changed_cb(NULL);
1094
1095         if (all_features_not_supported)
1096                 CHECK_RETURN("connection_unset_type_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1097         else
1098                 CHECK_RETURN("connection_unset_type_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1099         return 0;
1100 }
1101
1102 /**
1103  * @testcase            utc_connection_unset_type_changed_cb_p
1104  * @since_tizen         2.3
1105  * @type                Positive
1106  * @description         Unregisters the callback that is called when the type of current connection is changed.
1107  * @scenario            Invoking connection_unset_type_changed_cb with valid parameter.
1108  */
1109 int utc_connection_unset_type_changed_cb_p(void)
1110 {
1111         int ret = connection_unset_type_changed_cb(connection);
1112
1113         if (all_features_not_supported)
1114                 CHECK_RETURN("connection_unset_type_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1115         else
1116                 CHECK_RETURN("connection_unset_type_changed_cb", ret, CONNECTION_ERROR_NONE);
1117         return 0;
1118 }
1119
1120 /**
1121  * @testcase            utc_connection_set_ip_address_changed_cb_n
1122  * @since_tizen         2.3
1123  * @type                Negative
1124  * @description         connection_set_ip_address_changed_cb should fail with invalid parameter.
1125  * @scenario            Verify connection_set_ip_address_changed_cb by passing invalid parameter.
1126  */
1127 int utc_connection_set_ip_address_changed_cb_n(void)
1128 {
1129         int ret;
1130
1131         if (all_features_not_supported) {
1132                 ret = connection_set_ip_address_changed_cb(connection, NULL, NULL);
1133                 CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1134                 return 0;
1135         }
1136
1137         ret = connection_set_ip_address_changed_cb(NULL, NULL, NULL);
1138         CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1139         ret = connection_set_ip_address_changed_cb(NULL, test_ip_address_changed_cb, NULL);
1140         CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1141         ret = connection_set_ip_address_changed_cb(connection, NULL, NULL);
1142         CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1143
1144         return 0;
1145 }
1146
1147 /**
1148  * @testcase            utc_connection_set_ip_address_changed_cb_p
1149  * @since_tizen         2.3
1150  * @type                Positive
1151  * @description         Registers the callback that is called when the IP address is changed.
1152  * @scenario            Invoking connection_set_ip_address_changed_cb with valid parameter.
1153  */
1154 int utc_connection_set_ip_address_changed_cb_p(void)
1155 {
1156         int ret;
1157
1158         if (all_features_not_supported) {
1159                 ret = connection_set_ip_address_changed_cb(connection, NULL, NULL);
1160                 CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1161                 return 0;
1162         }
1163
1164         ret = connection_set_ip_address_changed_cb(connection, test_ip_address_changed_cb, NULL);
1165         CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_NONE);
1166         test_ip_address_changed_cb(NULL, NULL, NULL);
1167
1168         return 0;
1169 }
1170
1171 /**
1172  * @testcase            utc_connection_unset_ip_address_changed_cb_n
1173  * @since_tizen         2.3
1174  * @type                Negative
1175  * @description         connection_unset_ip_address_changed_cb should fail with invalid parameter.
1176  * @scenario            Verify connection_unset_ip_address_changed_cb by passing invalid parameter.
1177  */
1178 int utc_connection_unset_ip_address_changed_cb_n(void)
1179 {
1180         int ret = connection_unset_ip_address_changed_cb(NULL);
1181
1182         if (all_features_not_supported)
1183                 CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1184         else
1185                 CHECK_RETURN("connection_set_ip_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1186         return 0;
1187 }
1188
1189 /**
1190  * @testcase            utc_connection_unset_ip_address_changed_cb_p
1191  * @since_tizen         2.3
1192  * @type                Positive
1193  * @description         Unregisters the callback that is called when the IP address is changed.
1194  * @scenario            Invoking connection_unset_ip_address_changed_cb with valid parameter.
1195  */
1196 int utc_connection_unset_ip_address_changed_cb_p(void)
1197 {
1198         int ret = connection_unset_ip_address_changed_cb(connection);
1199
1200         if (all_features_not_supported)
1201                 CHECK_RETURN("connection_unset_ip_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1202         else
1203                 CHECK_RETURN("connection_unset_ip_address_changed_cb", ret, CONNECTION_ERROR_NONE);
1204         return 0;
1205 }
1206
1207 /**
1208  * @testcase            utc_connection_set_proxy_address_changed_cb_n
1209  * @since_tizen         2.3
1210  * @type                Negative
1211  * @description         connection_set_proxy_address_changed_cb should fail with invalid parameter.
1212  * @scenario            Verify connection_set_proxy_address_changed_cb by passing invalid parameter.
1213  */
1214 int utc_connection_set_proxy_address_changed_cb_n(void)
1215 {
1216         int ret;
1217
1218         if (all_features_not_supported) {
1219                 ret = connection_set_proxy_address_changed_cb(connection, NULL, NULL);
1220                 CHECK_RETURN("connection_set_proxy_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1221                 return 0;
1222         }
1223
1224         ret = connection_set_proxy_address_changed_cb(NULL, NULL, NULL);
1225         CHECK_RETURN("connection_set_proxy_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1226         ret = connection_set_proxy_address_changed_cb(NULL, test_proxy_address_changed_cb, NULL);
1227         CHECK_RETURN("connection_set_proxy_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1228         ret = connection_set_proxy_address_changed_cb(connection, NULL, NULL);
1229         CHECK_RETURN("connection_set_proxy_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1230
1231         return 0;
1232 }
1233
1234 /**
1235  * @testcase            utc_connection_set_proxy_address_changed_cb_p
1236  * @since_tizen         2.3
1237  * @type                Positive
1238  * @description         Registers the callback that is called when the proxy address is changed.
1239  * @scenario            Invoking connection_set_proxy_address_changed_cb with valid parameter.
1240  */
1241 int utc_connection_set_proxy_address_changed_cb_p(void)
1242 {
1243         int ret;
1244
1245         if (all_features_not_supported) {
1246                 ret = connection_set_proxy_address_changed_cb(connection, NULL, NULL);
1247                 CHECK_RETURN("connection_set_proxy_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1248                 return 0;
1249         }
1250
1251         ret = connection_set_proxy_address_changed_cb(connection, test_proxy_address_changed_cb, NULL);
1252         CHECK_RETURN("connection_set_proxy_address_changed_cb", ret, CONNECTION_ERROR_NONE);
1253         test_proxy_address_changed_cb(NULL, NULL, NULL);
1254
1255         return 0;
1256 }
1257
1258 /**
1259  * @testcase            utc_connection_unset_proxy_address_changed_cb_n
1260  * @since_tizen         2.3
1261  * @type                Negative
1262  * @description         connection_unset_proxy_address_changed_cb should fail with invalid parameter.
1263  * @scenario            Verify connection_unset_proxy_address_changed_cb by passing invalid parameter.
1264  */
1265 int utc_connection_unset_proxy_address_changed_cb_n(void)
1266 {
1267         int ret = connection_unset_proxy_address_changed_cb(NULL);
1268
1269         if (all_features_not_supported)
1270                 CHECK_RETURN("connection_unset_proxy_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1271         else
1272                 CHECK_RETURN("connection_unset_proxy_address_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1273         return 0;
1274 }
1275
1276 /**
1277  * @testcase            utc_connection_unset_proxy_address_changed_cb_p
1278  * @since_tizen         2.3
1279  * @type                Positive
1280  * @description         Unregisters the callback that is called when the proxy address is changed.
1281  * @scenario            Invoking connection_unset_proxy_address_changed_cb with valid parameter.
1282  */
1283 int utc_connection_unset_proxy_address_changed_cb_p(void)
1284 {
1285         int ret = connection_unset_proxy_address_changed_cb(connection);
1286
1287         if (all_features_not_supported)
1288                 CHECK_RETURN("connection_unset_proxy_address_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1289         else
1290                 CHECK_RETURN("connection_unset_proxy_address_changed_cb", ret, CONNECTION_ERROR_NONE);
1291         return 0;
1292 }
1293
1294 /**
1295  * @testcase            utc_connection_get_statistics_p
1296  * @since_tizen         2.3
1297  * @type                Positive
1298  * @description         Gets the statistics information.
1299  * @scenario            Invoking connection_get_statistics with valid parameter.
1300  */
1301 int utc_connection_get_statistics_p(void)
1302 {
1303         long long stat;
1304
1305         if (telephony_supported) {
1306                 int ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &stat);
1307                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1308                 ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &stat);
1309                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1310                 ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &stat);
1311                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1312                 ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &stat);
1313                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1314         } else {
1315                 int ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &stat);
1316                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1317         }
1318
1319         if (wifi_supported) {
1320                 int ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &stat);
1321                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1322                 ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &stat);
1323                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1324                 ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &stat);
1325                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1326                 ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &stat);
1327                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NONE);
1328         } else {
1329                 int ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &stat);
1330                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1331         }
1332
1333         return 0;
1334 }
1335
1336 /**
1337  * @testcase            utc_connection_get_statistics_n
1338  * @since_tizen         2.3
1339  * @type                Negative
1340  * @description         connection_get_statistics should fail with invalid parameter.
1341  * @scenario            Verify connection_get_statistics by passing invalid parameter.
1342  */
1343 int utc_connection_get_statistics_n(void)
1344 {
1345         int ret;
1346         long long stat;
1347
1348         if (telephony_supported == false && wifi_supported == false) {
1349                 ret = connection_get_statistics(NULL, -1, -1, NULL);
1350                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1351                 return 0;
1352         }
1353
1354         ret = connection_get_statistics(NULL, -1, -1, NULL);
1355         CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1356         ret = connection_get_statistics(connection, -1, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &stat);
1357         CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1358         ret = connection_get_statistics(connection, -1, -1, &stat);
1359         CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1360
1361         if (telephony_supported) {
1362                 ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, -1, &stat);
1363                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1364                 ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, NULL);
1365                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1366                 ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, -1, NULL);
1367                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1368         } else {
1369                 ret = connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, -1, &stat);
1370                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1371         }
1372
1373         if (wifi_supported) {
1374                 ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, -1, &stat);
1375                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1376                 ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, NULL);
1377                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1378                 ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, -1, NULL);
1379                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1380         } else {
1381                 ret = connection_get_statistics(connection, CONNECTION_TYPE_WIFI, -1, &stat);
1382                 CHECK_RETURN("connection_get_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1383         }
1384
1385         return 0;
1386 }
1387
1388 /**
1389  * @testcase            utc_connection_reset_statistics_p
1390  * @since_tizen         2.3
1391  * @type                Positive
1392  * @description         Resets the statistics information.
1393  * @scenario            Invoking connection_reset_statistics with valid parameter.
1394  */
1395 int utc_connection_reset_statistics_p(void)
1396 {
1397         int ret = 0;
1398         if (telephony_supported) {
1399                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
1400                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1401                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
1402                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1403                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
1404                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1405                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
1406                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1407         } else {
1408                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
1409                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1410         }
1411
1412         if (wifi_supported) {
1413                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
1414                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1415                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
1416                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1417                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
1418                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1419                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
1420                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NONE);
1421         } else {
1422                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
1423                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1424         }
1425
1426         return 0;
1427 }
1428
1429 /**
1430  * @testcase            utc_connection_reset_statistics_n
1431  * @since_tizen         2.3
1432  * @type                Negative
1433  * @description         connection_reset_statistics should fail with invalid parameter.
1434  * @scenario            Verify connection_reset_statistics by passing invalid parameter.
1435  */
1436 int utc_connection_reset_statistics_n(void)
1437 {
1438         int ret;
1439         if (telephony_supported == false && wifi_supported == false) {
1440                 ret = connection_reset_statistics(NULL, -1, -1);
1441                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1442                 return 0;
1443         }
1444
1445         ret = connection_reset_statistics(NULL, -1, -1);
1446         CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1447         ret = connection_reset_statistics(connection, -1, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
1448         CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1449
1450         if (telephony_supported) {
1451                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, -1);
1452                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1453         } else {
1454                 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, -1);
1455                 CHECK_RETURN("connection_reset_statistics", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1456         }
1457
1458         return 0;
1459 }
1460
1461 /**
1462  * @testcase            utc_connection_add_route_n
1463  * @since_tizen         2.3
1464  * @type                Negative
1465  * @description         connection_add_route should fail with invalid parameter.
1466  * @scenario            Verify connection_add_route by passing invalid parameter.
1467  */
1468 int utc_connection_add_route_n(void)
1469 {
1470         int ret;
1471
1472         if (!route_supported || all_features_not_supported) {
1473                 ret = connection_add_route(connection, NULL, NULL);
1474                 CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1475                 return 0;
1476         }
1477
1478         ret = connection_add_route(NULL, NULL, NULL);
1479         CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1480
1481         ret = connection_add_route(NULL, "pdp0", "192.168.129.3");
1482         CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1483
1484         ret = connection_add_route(connection, "pdp0", NULL);
1485         CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1486
1487         ret = connection_add_route(connection, NULL, "192.168.129.3");
1488         CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1489
1490         return 0;
1491 }
1492
1493 /**
1494  * @testcase            utc_connection_add_route_p
1495  * @since_tizen         2.3
1496  * @type                Positive
1497  * @description         Adds a IPv4 route to the routing table.You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
1498  * @scenario            Invoking connection_add_route with valid parameter.
1499  */
1500 int utc_connection_add_route_p(void)
1501 {
1502         int ret;
1503         char* interface_name = NULL;
1504
1505         if (!route_supported || all_features_not_supported) {
1506                 ret = connection_add_route(connection, interface_name, "192.168.129.3");
1507                 CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1508                 return 0;
1509         }
1510
1511         ret = connection_get_current_profile(connection, &profile_temp);
1512         PRINT_RETURN("connection_get_current_profile", ret);
1513
1514         ret = connection_profile_get_network_interface_name(profile_temp, &interface_name);
1515         PRINT_RETURN("connection_get_current_profile", ret);
1516
1517         ret = connection_add_route(connection, interface_name, "192.168.129.3");
1518         FREE_RESOURCE(interface_name);
1519         CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_NONE);
1520
1521         return 0;
1522 }
1523
1524 /**
1525  * @testcase            utc_connection_remove_route_n
1526  * @since_tizen         2.3
1527  * @type                Negative
1528  * @description         connection_remove_route should fail with invalid parameter.
1529  * @scenario            Verify connection_remove_route by passing invalid parameter.
1530  */
1531 int utc_connection_remove_route_n(void)
1532 {
1533         int ret;
1534
1535         if (!route_supported || all_features_not_supported) {
1536                 ret = connection_remove_route(NULL, NULL, NULL);
1537                 CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1538                 return 0;
1539         }
1540
1541         ret = connection_remove_route(NULL, NULL, NULL);
1542         CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1543
1544         ret = connection_remove_route(NULL, "pdp0", "192.168.129.3");
1545         CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1546
1547         ret = connection_remove_route(connection, "pdp0", NULL);
1548         CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1549
1550         ret = connection_add_route(connection, NULL, "192.168.129.3");
1551         CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1552
1553         return 0;
1554 }
1555
1556 /**
1557  * @testcase            utc_connection_remove_route_p
1558  * @since_tizen         2.3
1559  * @type                Positive
1560  * @description         Removes a IPv4 route from the routing table.get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
1561  * @scenario            Invoking connection_remove_route with valid parameter.
1562  */
1563 int utc_connection_remove_route_p(void)
1564 {
1565         int ret;
1566         char* interface_name = NULL;
1567
1568         if (!route_supported || all_features_not_supported) {
1569                 ret = connection_remove_route(connection, interface_name, "192.168.129.3");
1570                 CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1571                 return 0;
1572         }
1573
1574         ret = connection_get_current_profile(connection, &profile_temp);
1575         PRINT_RETURN("connection_get_current_profile", ret);
1576
1577         ret = connection_profile_get_network_interface_name(profile_temp, &interface_name);
1578         PRINT_RETURN("connection_profile_get_network_interface_name", ret);
1579
1580         ret = connection_remove_route(connection, interface_name, "192.168.129.3");
1581         FREE_RESOURCE(interface_name);
1582         CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_NONE);
1583
1584         return 0;
1585 }
1586
1587 /**
1588  * @testcase            utc_connection_add_route_ipv6_n
1589  * @since_tizen         2.3.1
1590  * @type                Negative
1591  * @description         connection_add_route_ipv6 should fail with invalid parameter.
1592  * @scenario            Verify connection_add_route_ipv6 by passing invalid parameter.
1593  */
1594 int utc_connection_add_route_ipv6_n(void)
1595 {
1596         int ret;
1597
1598         if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
1599                 ret = connection_add_route_ipv6(NULL, NULL, NULL, NULL);
1600                 CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1601                 return 0;
1602         }
1603
1604         ret = connection_add_route_ipv6(NULL, NULL, NULL, NULL);
1605         CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1606
1607         ret = connection_add_route_ipv6(connection, NULL, "2001:db8:1:0::1", "fe80::");
1608         CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1609
1610         ret = connection_add_route_ipv6(connection, NULL, NULL, "fe80::");
1611         CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1612
1613         return 0;
1614 }
1615
1616 /**
1617  * @testcase            utc_connection_add_route_ipv6_p
1618  * @since_tizen         2.3.1
1619  * @type                Positive
1620  * @description         Adds a IPv6 route to the routing table.
1621  * @scenario            Invoking connection_add_route_ipv6 with valid parameter.
1622  */
1623 int utc_connection_add_route_ipv6_p(void)
1624 {
1625         int ret;
1626         char* interface_name = NULL;
1627
1628         if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
1629                 ret = connection_add_route_ipv6(connection, interface_name, "2001:db8:1:0::1", "fe80::");
1630                 CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1631                 return 0;
1632         }
1633
1634         ret = connection_get_current_profile(connection, &profile_temp);
1635         PRINT_RETURN("connection_get_current_profile", ret);
1636         ret = connection_profile_get_network_interface_name(profile_temp, &interface_name);
1637         PRINT_RETURN("connection_profile_get_network_interface_name", ret);
1638
1639         ret = connection_add_route_ipv6(connection, interface_name, "2001:db8:1:0::1", "fe80::");
1640         FREE_RESOURCE(interface_name);
1641         CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_NONE);
1642
1643         return 0;
1644 }
1645
1646 /**
1647  * @testcase            utc_connection_remove_route_ipv6_n
1648  * @since_tizen         2.3.1
1649  * @type                Negative
1650  * @description         connection_add_route_ipv6 should fail with invalid parameter.
1651  * @scenario            Verify connection_add_route_ipv6 by passing invalid parameter.
1652  */
1653 int utc_connection_remove_route_ipv6_n(void)
1654 {
1655         int ret;
1656
1657         if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
1658                 ret = connection_remove_route_ipv6(NULL, NULL, NULL, NULL);
1659                 CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1660                 return 0;
1661         }
1662
1663         ret = connection_remove_route_ipv6(NULL, NULL, NULL, NULL);
1664         CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1665
1666         ret = connection_remove_route_ipv6(connection, NULL, "2001:db8:1:0::1", "fe80::");
1667         CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1668
1669         ret = connection_remove_route_ipv6(connection, NULL, NULL, "fe80::");
1670         CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1671
1672         return 0;
1673 }
1674
1675 /**
1676  * @testcase            utc_connection_remove_route_ipv6_p
1677  * @since_tizen         2.3.1
1678  * @type                Positive
1679  * @description         Removes a IPV6 route from the routing table.
1680  * @scenario            Invoking connection_remove_route_ipv6 with valid parameter.
1681  */
1682 int utc_connection_remove_route_ipv6_p(void)
1683 {
1684         int ret;
1685         char* interface_name = NULL;
1686
1687         if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
1688                 ret = connection_remove_route_ipv6(connection, interface_name, "2001:db8:1:0::1", "fe80::");
1689                 FREE_RESOURCE(interface_name);
1690                 CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1691                 return 0;
1692         }
1693
1694         ret = connection_get_current_profile(connection, &profile_temp);
1695         PRINT_RETURN("connection_get_current_profile", ret);
1696         ret = connection_profile_get_network_interface_name(profile_temp, &interface_name);
1697         PRINT_RETURN("connection_profile_get_network_interface_name", ret);
1698
1699         ret = connection_remove_route_ipv6(connection, interface_name, "2001:db8:1:0::1", "fe80::");
1700         FREE_RESOURCE(interface_name);
1701         CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_NONE);
1702
1703         return 0;
1704 }
1705
1706 /**
1707  * @testcase            utc_connection_add_route_entry_n
1708  * @since_tizen         4.0
1709  * @type                Negative
1710  * @description         connection_add_route_entry should fail with invalid parameter.
1711  * @scenario            Verify connection_add_route_entry by passing invalid parameter.
1712  */
1713 int utc_connection_add_route_entry_n(void)
1714 {
1715         int ret;
1716
1717         if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
1718                 ret = connection_add_route_entry(NULL, -1, NULL, NULL, NULL);
1719                 CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1720                 return 0;
1721         }
1722
1723         ret = connection_add_route_entry(NULL, -1, NULL, NULL, NULL);
1724         CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1725
1726         ret = connection_add_route_entry(connection, -1, NULL, "2001:db8:1:0::1", "fe80::");
1727         CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1728
1729         ret = connection_add_route_entry(connection, -1, NULL, NULL, "fe80::");
1730         CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1731
1732         return 0;
1733 }
1734
1735 /**
1736  * @testcase            utc_connection_add_route_entry_p
1737  * @since_tizen         4.0
1738  * @type                Positive
1739  * @description         Adds a route to the routing table.
1740  * @scenario            Invoking connection_add_route_entry with valid parameter.
1741  */
1742 int utc_connection_add_route_entry_p(void)
1743 {
1744         int ret;
1745         char* interface_name = NULL;
1746
1747         if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
1748                 ret = connection_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, interface_name, "2001:db8:1:0::1", "fe80::");
1749                 CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1750                 return 0;
1751         }
1752
1753         ret = connection_get_current_profile(connection, &profile_temp);
1754         PRINT_RETURN("connection_get_current_profile", ret);
1755         connection_profile_get_network_interface_name(profile_temp, &interface_name);
1756         PRINT_RETURN("connection_profile_get_network_interface_name", ret);
1757
1758         ret = connection_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV4, interface_name, "192.168.10.30", "192.168.10.1");
1759         CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_NONE);
1760
1761         ret = connection_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, interface_name, "2001:db8:1:0::1", "fe80::");
1762         FREE_RESOURCE(interface_name);
1763         CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_NONE);
1764
1765         return 0;
1766 }
1767
1768 /**
1769  * @testcase            utc_connection_remove_route_entry_n
1770  * @since_tizen         4.0
1771  * @type                Negative
1772  * @description         connection_add_route_entry should fail with invalid parameter.
1773  * @scenario            Verify connection_add_route_entry by passing invalid parameter.
1774  */
1775 int utc_connection_remove_route_entry_n(void)
1776 {
1777         int ret;
1778
1779         if (all_features_not_supported) {
1780                 ret = connection_remove_route_entry(NULL, -1, NULL, NULL, NULL);
1781                 CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1782                 return 0;
1783         }
1784
1785         ret = connection_remove_route_entry(NULL, -1, NULL, NULL, NULL);
1786         CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1787
1788         ret = connection_remove_route_entry(connection, -1, NULL, "2001:db8:1:0::1", "fe80::");
1789         CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1790
1791         ret = connection_remove_route_entry(connection, -1, NULL, NULL, "fe80::");
1792         CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1793
1794         return 0;
1795 }
1796
1797 /**
1798  * @testcase            utc_connection_remove_route_entry_p
1799  * @since_tizen         4.0
1800  * @type                Positive
1801  * @description         Removes a route from the routing table.
1802  * @scenario            Invoking connection_remove_route_entry with valid parameter.
1803  */
1804 int utc_connection_remove_route_entry_p(void)
1805 {
1806         int ret;
1807         char* interface_name = NULL;
1808
1809         if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
1810                 ret = connection_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, interface_name, "2001:db8:1:0::1", "fe80::");
1811                 FREE_RESOURCE(interface_name);
1812                 CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1813                 return 0;
1814         }
1815
1816         ret = connection_get_current_profile(connection, &profile_temp);
1817         PRINT_RETURN("connection_get_current_profile", ret);
1818         connection_profile_get_network_interface_name(profile_temp, &interface_name);
1819         PRINT_RETURN("connection_profile_get_network_interface_name", ret);
1820
1821         ret = connection_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV4, interface_name, "192.168.10.30", "192.168.10.1");
1822         CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_NONE);
1823
1824         ret = connection_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, interface_name, "2001:db8:1:0::1", "fe80::");
1825         FREE_RESOURCE(interface_name);
1826         CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_NONE);
1827
1828         return 0;
1829 }
1830
1831 /**
1832  * @testcase            utc_connection_get_profile_iterator_n
1833  * @since_tizen         2.3
1834  * @type                Negative
1835  * @description         connection_get_profile_iterator should fail with invalid parameter.
1836  * @scenario            Verify connection_get_profile_iterator by passing invalid parameter.
1837  */
1838 int utc_connection_get_profile_iterator_n(void)
1839 {
1840         int ret;
1841         connection_profile_iterator_h profile_iter;
1842
1843         if (all_features_not_supported) {
1844                 ret = connection_get_profile_iterator(connection, 3, &profile_iter);
1845                 CHECK_RETURN("connection_get_profile_iterator", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1846                 return 0;
1847         }
1848
1849         ret = connection_get_profile_iterator(NULL, 3, NULL);
1850         CHECK_RETURN("connection_get_profile_iterator", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1851         ret = connection_get_profile_iterator(NULL, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
1852         CHECK_RETURN("connection_get_profile_iterator", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1853         ret = connection_get_profile_iterator(connection, 3, &profile_iter);
1854         CHECK_RETURN("connection_get_profile_iterator", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1855
1856         return 0;
1857 }
1858
1859 /**
1860  * @testcase            utc_connection_get_profile_iterator_p
1861  * @since_tizen         2.3
1862  * @type                Positive
1863  * @description         Gets a profiles iterator.
1864  * @scenario            Invoking connection_get_profile_iterator with valid parameter.
1865  */
1866 int utc_connection_get_profile_iterator_p(void)
1867 {
1868         int ret;
1869         connection_profile_iterator_h profile_iter;
1870
1871         if (all_features_not_supported) {
1872                 ret = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
1873                 CHECK_RETURN("connection_get_profile_iterator", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1874                 return 0;
1875         }
1876
1877         ret = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
1878         CHECK_RETURN("connection_get_profile_iterator", ret, CONNECTION_ERROR_NONE);
1879         ret = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter);
1880         CHECK_RETURN("connection_get_profile_iterator", ret, CONNECTION_ERROR_NONE);
1881
1882         return 0;
1883 }
1884
1885 /**
1886  * @testcase            utc_connection_destroy_profile_iterator_n
1887  * @since_tizen         2.3
1888  * @type                Negative
1889  * @description         connection_destroy_profile_iterator should fail with invalid parameter.
1890  * @scenario            Verify connection_destroy_profile_iterator by passing invalid parameter.
1891  */
1892 int utc_connection_destroy_profile_iterator_n(void)
1893 {
1894         int ret = connection_destroy_profile_iterator(NULL);
1895
1896         if (all_features_not_supported)
1897                 CHECK_RETURN("connection_destroy_profile_iterator", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1898         else
1899                 CHECK_RETURN("connection_destroy_profile_iterator", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1900         return 0;
1901 }
1902
1903 /**
1904  * @testcase            utc_connection_destroy_profile_iterator_p
1905  * @since_tizen         2.3
1906  * @type                Positive
1907  * @description         Destroys a profiles iterator.
1908  * @scenario            Invoking connection_destroy_profile_iterator with valid parameter.
1909  */
1910 int utc_connection_destroy_profile_iterator_p(void)
1911 {
1912         int ret;
1913         connection_profile_iterator_h profile_iter = NULL;
1914
1915         if (all_features_not_supported) {
1916                 ret = connection_destroy_profile_iterator(profile_iter);
1917                 CHECK_RETURN("connection_destroy_profile_iterator", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1918                 return 0;
1919         }
1920
1921         ret = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
1922         PRINT_RETURN("connection_get_profile_iterator", ret);
1923
1924         ret = connection_destroy_profile_iterator(profile_iter);
1925         CHECK_RETURN("connection_destroy_profile_iterator", ret, CONNECTION_ERROR_NONE);
1926
1927         return 0;
1928 }
1929
1930 /**
1931  * @testcase            utc_connection_profile_iterator_has_next_n
1932  * @since_tizen         2.3
1933  * @type                Negative
1934  * @description         connection_profile_iterator_has_next should fail with invalid parameter.
1935  * @scenario            Verify connection_profile_iterator_has_next by passing invalid parameter.
1936  */
1937 int utc_connection_profile_iterator_has_next_n(void)
1938 {
1939         int ret = connection_profile_iterator_has_next(NULL);
1940         if (all_features_not_supported)
1941                 CHECK_RETURN("connection_profile_iterator_has_next", get_last_result(), CONNECTION_ERROR_NOT_SUPPORTED);
1942         else
1943                 CHECK_RETURN("connection_profile_iterator_has_next", ret, false);
1944         return 0;
1945 }
1946
1947 /**
1948  * @testcase            utc_connection_profile_iterator_has_next_p
1949  * @since_tizen         2.3
1950  * @type                Positive
1951  * @description         Checks whether the next element of a profile iterator exists or not.
1952  * @scenario            Invoking connection_profile_iterator_has_next with valid parameter.
1953  */
1954 int utc_connection_profile_iterator_has_next_p(void)
1955 {
1956         int ret;
1957         connection_profile_iterator_h profile_iter = NULL;
1958
1959         if (all_features_not_supported) {
1960                 ret = connection_profile_iterator_has_next(profile_iter);
1961                 CHECK_RETURN("connection_profile_iterator_has_next", get_last_result(), CONNECTION_ERROR_NOT_SUPPORTED);
1962                 return 0;
1963         }
1964
1965         ret = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter);
1966         PRINT_RETURN("connection_get_profile_iterator", ret);
1967
1968         ret = connection_profile_iterator_has_next(profile_iter);
1969         CHECK_RETURN("connection_profile_iterator_has_next", ret, true);
1970
1971         ret = connection_destroy_profile_iterator(profile_iter);
1972         PRINT_RETURN("connection_destroy_profile_iterator", ret);
1973
1974         return 0;
1975 }
1976
1977 /**
1978  * @testcase            utc_connection_profile_iterator_next_n
1979  * @since_tizen         2.3
1980  * @type                Negative
1981  * @description         connection_profile_iterator_next should fail with invalid parameter.
1982  * @scenario            Verify connection_profile_iterator_next by passing invalid parameter.
1983  */
1984 int utc_connection_profile_iterator_next_n(void)
1985 {
1986         connection_profile_h profile_h;
1987
1988         int ret = connection_profile_iterator_next(NULL, &profile_h);
1989
1990         if (all_features_not_supported)
1991                 CHECK_RETURN("connection_profile_iterator_next", ret, CONNECTION_ERROR_NOT_SUPPORTED);
1992         else
1993                 CHECK_RETURN("connection_profile_iterator_next", ret, CONNECTION_ERROR_INVALID_PARAMETER);
1994         return 0;
1995 }
1996
1997 /**
1998  * @testcase            utc_connection_profile_iterator_next_p
1999  * @since_tizen         2.3
2000  * @type                Positive
2001  * @description         Moves the profile iterator to the next position and gets a profile handle.
2002  * @scenario            Invoking connection_profile_iterator_next with valid parameter.
2003  */
2004 int utc_connection_profile_iterator_next_p(void)
2005 {
2006         int ret;
2007         connection_profile_iterator_h profile_iter = NULL;
2008         connection_profile_h profile_h = NULL;
2009
2010         if (all_features_not_supported) {
2011                 ret = connection_profile_iterator_next(profile_iter, &profile_h);
2012                 CHECK_RETURN("connection_profile_iterator_next", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2013                 return 0;
2014         }
2015
2016         ret = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
2017         PRINT_RETURN("connection_get_profile_iterator", ret);
2018
2019         while (connection_profile_iterator_has_next(profile_iter)) {
2020                 ret = connection_profile_iterator_next(profile_iter, &profile_h);
2021                 CHECK_RETURN("connection_profile_iterator_next", ret, CONNECTION_ERROR_NONE);
2022         }
2023
2024         return 0;
2025 }
2026
2027 /**
2028  * @testcase            utc_connection_add_profile_p
2029  * @since_tizen         2.3
2030  * @type                Positive
2031  * @description         Creates a profile handle.The profile name, which you get from connection_profile_get_name(), will include the keyword you set.
2032  * @scenario            Invoking connection_profile_create with valid parameter.
2033  */
2034 int utc_connection_add_profile_p(void)
2035 {
2036         if (telephony_supported) {
2037                 int ret = connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, CUSTOM_PROFILE_NAME, &profile_cellular);
2038                 PRINT_RETURN("connection_profile_create", ret);
2039                 ret = connection_profile_set_cellular_service_type(profile_cellular, CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION);
2040                 PRINT_RETURN("connection_profile_set_cellular_service_type", ret);
2041
2042                 connection_cellular_state_e state;
2043                 ret = connection_get_cellular_state(connection, &state);
2044                 PRINT_RETURN("connection_get_cellular_state", ret);
2045
2046                 ret = connection_add_profile(connection, profile_cellular);
2047                 CHECK_RETURN("connection_add_profile", ret, CONNECTION_ERROR_NONE);
2048         } else {
2049                 int ret = connection_add_profile(connection, profile_cellular);
2050                 CHECK_RETURN("connection_add_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2051         }
2052
2053         return 0;
2054 }
2055
2056 /**
2057  * @testcase            utc_connection_add_profile_n
2058  * @since_tizen         2.3
2059  * @type                Negative
2060  * @description         connection_add_profile should fail with invalid parameter.
2061  * @scenario            Verify connection_add_profile by passing invalid parameter.
2062  */
2063 int utc_connection_add_profile_n(void)
2064 {
2065         connection_profile_h profile = NULL;
2066
2067         if (telephony_supported) {
2068                 int ret = connection_add_profile(NULL, NULL);
2069                 CHECK_RETURN("connection_add_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2070                 ret = connection_add_profile(NULL, &profile);
2071                 CHECK_RETURN("connection_add_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2072                 ret = connection_add_profile(connection, NULL);
2073                 CHECK_RETURN("connection_add_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2074         } else  {
2075                 int ret = connection_add_profile(NULL, NULL);
2076                 CHECK_RETURN("connection_add_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2077         }
2078         return 0;
2079 }
2080
2081 /**
2082  * @testcase            utc_connection_close_profile_p
2083  * @since_tizen         2.3
2084  * @type                Positive
2085  * @description         Closes a connection of profile.
2086  * @scenario            Invoking connection_close_profile with valid parameter.
2087  */
2088 int utc_connection_close_profile_p(void)
2089 {
2090         int ret;
2091         connection_cellular_state_e state;
2092
2093         if (!telephony_supported && !wifi_supported && !bt_tethering_supported) {
2094                 ret = connection_close_profile(connection, profile_temp, test_connection_closed_callback, NULL);
2095                 CHECK_RETURN("connection_close_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2096                 return 0;
2097         }
2098
2099         if (telephony_supported) {
2100                 ret = connection_get_cellular_state(connection, &state);
2101                 PRINT_RETURN("connection_get_cellular_state", ret);
2102                 if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE) {
2103                         fprintf(stderr, "Cellular state is out of service at %s:%d", __FILE__, __LINE__);
2104                         return 0;
2105                 }
2106         }
2107
2108         ret = connection_get_current_profile(connection, &profile_temp);
2109         PRINT_RETURN("connection_get_current_profile", ret);
2110
2111         ret = connection_close_profile(connection, profile_temp, test_connection_closed_callback, NULL);
2112         PRINT_RETURN("connection_close_profile", ret);
2113         test_connection_closed_callback(CONNECTION_ERROR_NONE, NULL);
2114         CHECK_RETURN(CALLBACK_RETURN, g_CallbackRet, CONNECTION_ERROR_NONE);
2115
2116         return 0;
2117 }
2118
2119 /**
2120  * @testcase            utc_connection_close_profile_n
2121  * @since_tizen         2.3
2122  * @type                Negative
2123  * @description         connection_close_profile should fail with invalid parameter.
2124  * @scenario            Verify connection_close_profile by passing invalid parameter.
2125  */
2126 int utc_connection_close_profile_n(void)
2127 {
2128         int ret;
2129         connection_profile_h profile = NULL;
2130
2131         if (!telephony_supported && !wifi_supported && !bt_tethering_supported) {
2132                 ret = connection_close_profile(NULL, NULL, NULL, NULL);
2133                 CHECK_RETURN("connection_close_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2134                 return 0;
2135         }
2136
2137         ret = connection_close_profile(NULL, NULL, NULL, NULL);
2138         CHECK_RETURN("connection_close_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2139         ret = connection_close_profile(NULL, profile, test_connection_closed_callback, NULL);
2140         CHECK_RETURN("connection_close_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2141         ret = connection_close_profile(connection, profile, NULL, NULL);
2142         CHECK_RETURN("connection_close_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2143
2144         return 0;
2145 }
2146
2147 /**
2148  * @testcase            utc_connection_remove_profile_p
2149  * @since_tizen         2.3
2150  * @type                Positive
2151  * @description         Removes an existing profile.
2152  * @scenario            Invoking connection_remove_profile with valid parameter.
2153  */
2154 int utc_connection_remove_profile_p(void)
2155 {
2156         int ret;
2157
2158         if (!telephony_supported && !wifi_supported) {
2159                 ret = connection_remove_profile(connection, profile_temp);
2160                 CHECK_RETURN("connection_remove_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2161                 return 0;
2162         }
2163
2164         ret = connection_remove_profile(connection, profile_cellular);
2165         CHECK_RETURN("connection_remove_profile", ret, CONNECTION_ERROR_NONE);
2166
2167         return 0;
2168 }
2169
2170 /**
2171  * @testcase            utc_connection_remove_profile_n
2172  * @since_tizen         2.3
2173  * @type                Negative
2174  * @description         connection_remove_profile should fail with invalid parameter.
2175  * @scenario            Verify connection_remove_profile by passing invalid parameter.
2176  */
2177 int utc_connection_remove_profile_n(void)
2178 {
2179         int ret;
2180         connection_profile_h profile = NULL;
2181
2182         if (!telephony_supported && !wifi_supported) {
2183                 ret = connection_remove_profile(NULL, NULL);
2184                 CHECK_RETURN("connection_remove_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2185                 return 0;
2186         }
2187
2188         ret = connection_remove_profile(NULL, NULL);
2189         CHECK_RETURN("connection_remove_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2190         ret = connection_remove_profile(NULL, profile);
2191         CHECK_RETURN("connection_remove_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2192         ret = connection_remove_profile(connection, NULL);
2193         CHECK_RETURN("connection_remove_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2194
2195         return 0;
2196 }
2197
2198 /**
2199  * @testcase            utc_connection_update_profile_p
2200  * @since_tizen         2.3
2201  * @type                Positive
2202  * @description         Updates an existing profile.
2203  * @scenario            Invoking connection_update_profile with valid parameter.
2204  */
2205 int utc_connection_update_profile_p(void)
2206 {
2207         connection_profile_h profile_h = NULL;
2208         int ret = test_get_any_profile(&profile_h);
2209
2210         if (!telephony_supported && !wifi_supported && !ethernet_supported) {
2211                 ret = connection_update_profile(connection, profile_temp);
2212                 CHECK_RETURN("connection_update_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2213                 return 0;
2214         }
2215
2216         assert(profile_h);
2217         profile_temp = profile_h;
2218
2219         ret = connection_update_profile(connection, profile_temp);
2220         CHECK_RETURN("connection_update_profile", ret, CONNECTION_ERROR_NONE);
2221
2222         return 0;
2223 }
2224
2225 /**
2226  * @testcase            utc_connection_update_profile_n
2227  * @since_tizen         2.3
2228  * @type                Negative
2229  * @description         connection_update_profile should fail with invalid parameter.
2230  * @scenario            Verify connection_update_profile by passing invalid parameter.
2231  */
2232 int utc_connection_update_profile_n(void)
2233 {
2234         int ret;
2235         connection_profile_h profile = NULL;
2236
2237         if (!telephony_supported && !wifi_supported && !ethernet_supported) {
2238                 ret = connection_update_profile(NULL, NULL);
2239                 CHECK_RETURN("connection_update_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2240                 return 0;
2241         }
2242
2243         ret = connection_update_profile(NULL, NULL);
2244         CHECK_RETURN("connection_update_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2245         ret = connection_update_profile(NULL, profile);
2246         CHECK_RETURN("connection_update_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2247         ret = connection_update_profile(connection, NULL);
2248         CHECK_RETURN("connection_update_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2249
2250         return 0;
2251 }
2252
2253 /**
2254  * @testcase            utc_connection_open_profile_p
2255  * @since_tizen         2.3
2256  * @type                Positive
2257  * @description         Opens a connection of profile, asynchronously.
2258  * @scenario            Invoking connection_open_profile with valid parameter.
2259  */
2260 int utc_connection_open_profile_p(void)
2261 {
2262         connection_profile_h profile_h = NULL;
2263         int ret = test_get_any_profile(&profile_h);
2264
2265         if (!telephony_supported && !wifi_supported && !bt_tethering_supported) {
2266                 ret = connection_open_profile(connection, profile_temp, test_connection_opened_callback, NULL);
2267                 CHECK_RETURN("connection_open_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2268                 return 0;
2269         }
2270
2271         assert(profile_h);
2272         profile_temp = profile_h;
2273
2274         ret = connection_open_profile(connection, profile_temp, test_connection_opened_callback, NULL);
2275         CHECK_RETURN("connection_open_profile", ret, CONNECTION_ERROR_NONE);
2276         test_connection_opened_callback(CONNECTION_ERROR_NONE, NULL);
2277
2278         return 0;
2279 }
2280
2281 /**
2282  * @testcase            utc_connection_open_profile_n
2283  * @since_tizen         2.3
2284  * @type                Negative
2285  * @description         connection_open_profile should fail with invalid parameter.
2286  * @scenario            Verify connection_open_profile by passing invalid parameter.
2287  */
2288 int utc_connection_open_profile_n(void)
2289 {
2290         int ret;
2291         connection_profile_h profile = NULL;
2292
2293         if (!telephony_supported && !wifi_supported && !bt_tethering_supported) {
2294                 ret = connection_open_profile(NULL, NULL, NULL, NULL);
2295                 CHECK_RETURN("connection_open_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2296                 return 0;
2297         }
2298
2299         ret = connection_open_profile(NULL, NULL, NULL, NULL);
2300         CHECK_RETURN("connection_open_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2301         ret = connection_open_profile(NULL, profile, test_connection_opened_callback, NULL);
2302         CHECK_RETURN("connection_open_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2303         ret = connection_open_profile(connection, profile, NULL, NULL);
2304         CHECK_RETURN("connection_open_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2305
2306         return 0;
2307 }
2308
2309 /**
2310  * @testcase            utc_connection_reset_profile_p
2311  * @since_tizen         2.3
2312  * @type                Positive
2313  * @description         Resets the cellular profile.
2314  * @scenario            Invoking connection_reset_profile with valid parameter.
2315  */
2316 int utc_connection_reset_profile_p(void)
2317 {
2318         if (telephony_supported) {
2319                 connection_reset_profile(connection, CONNECTION_RESET_DEFAULT_PROFILE,
2320                                 0, test_connection_reset_profile_callback, NULL);
2321                 CHECK_RETURN(CALLBACK_RETURN, g_CallbackRet, CONNECTION_ERROR_NONE);
2322                 test_connection_reset_profile_callback(CONNECTION_ERROR_NONE, NULL);
2323         } else {
2324                 int ret = connection_reset_profile(connection, CONNECTION_RESET_DEFAULT_PROFILE,
2325                                 0, test_connection_reset_profile_callback, NULL);
2326                 CHECK_RETURN("connection_reset_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2327                 test_connection_reset_profile_callback(CONNECTION_ERROR_NONE, NULL);
2328         }
2329
2330         return 0;
2331 }
2332
2333 /**
2334  * @testcase            utc_connection_reset_profile_n
2335  * @since_tizen         2.3
2336  * @type                Negative
2337  * @description         connection_reset_profile should fail with invalid parameter.
2338  * @scenario            Verify connection_reset_profile by passing invalid parameter.
2339  */
2340 int utc_connection_reset_profile_n(void)
2341 {
2342         if (telephony_supported) {
2343                 int ret = connection_reset_profile(NULL, CONNECTION_RESET_DEFAULT_PROFILE,
2344                                 0, test_connection_reset_profile_callback, NULL);
2345                 CHECK_RETURN("connection_reset_profile", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2346         } else {
2347                 int ret = connection_reset_profile(NULL, CONNECTION_RESET_DEFAULT_PROFILE,
2348                                 0, test_connection_reset_profile_callback, NULL);
2349                 CHECK_RETURN("connection_reset_profile", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2350         }
2351         return 0;
2352 }
2353
2354 /**
2355  * @testcase            utc_connection_foreach_ipv6_address_p
2356  * @since_tizen         4.0
2357  * @type                Positive
2358  * @description         Gets IPv6 addresses
2359  * @scenario            Invoking connection_foreach_ipv6_address with valid parameter.
2360  */
2361 int utc_connection_foreach_ipv6_address_p(void)
2362 {
2363         int ret;
2364
2365         if (telephony_supported) {
2366                 ret = connection_foreach_ipv6_address(connection, CONNECTION_TYPE_CELLULAR,
2367                                 test_connection_ipv6_address_callback, NULL);
2368                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_NONE);
2369         } else if (wifi_supported) {
2370                 ret = connection_foreach_ipv6_address(connection, CONNECTION_TYPE_WIFI,
2371                                 test_connection_ipv6_address_callback, NULL);
2372                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_NONE);
2373         } else if (ethernet_supported) {
2374                 ret = connection_foreach_ipv6_address(connection, CONNECTION_TYPE_ETHERNET,
2375                                 test_connection_ipv6_address_callback, NULL);
2376                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_NONE);
2377         } else {
2378                 ret = connection_foreach_ipv6_address(connection, CONNECTION_TYPE_WIFI,
2379                                 test_connection_ipv6_address_callback, NULL);
2380                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2381         }
2382
2383         return 0;
2384 }
2385
2386 /**
2387  * @testcase            utc_connection_foreach_ipv6_address_n
2388  * @since_tizen         4.0
2389  * @type                Negative
2390  * @description         connection_foreach_ipv6_address should fail with invalid parameter.
2391  * @scenario            Verify connection_foreach_ipv6_address by passing invalid parameter.
2392  */
2393 int utc_connection_foreach_ipv6_address_n(void)
2394 {
2395         int ret;
2396
2397         if (telephony_supported) {
2398                 ret = connection_foreach_ipv6_address(NULL, CONNECTION_TYPE_CELLULAR,
2399                                 test_connection_ipv6_address_callback, NULL);
2400                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2401         } else if (wifi_supported) {
2402                 ret = connection_foreach_ipv6_address(NULL, CONNECTION_TYPE_WIFI,
2403                                 test_connection_ipv6_address_callback, NULL);
2404                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2405         } else if (ethernet_supported) {
2406                 ret = connection_foreach_ipv6_address(NULL, CONNECTION_TYPE_ETHERNET,
2407                                 test_connection_ipv6_address_callback, NULL);
2408                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2409         } else {
2410                 ret = connection_foreach_ipv6_address(NULL, CONNECTION_TYPE_WIFI,
2411                                 test_connection_ipv6_address_callback, NULL);
2412                 CHECK_RETURN("connection_foreach_ipv6_address", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2413         }
2414
2415         return 0;
2416 }
2417
2418 /**
2419  * @testcase            utc_connection_set_ethernet_cable_state_changed_cb_n
2420  * @since_tizen         4.0
2421  * @type                Negative
2422  * @description         connection_set_ethernet_cable_state_changed_cb should fail with invalid parameter.
2423  * @scenario            Verify connection_set_ethernet_cable_state_changed_cb by passing invalid parameter.
2424  */
2425 int utc_connection_set_ethernet_cable_state_changed_cb_n(void)
2426 {
2427         int ret;
2428         if (ethernet_supported == false) {
2429                 ret = connection_set_ethernet_cable_state_changed_cb(NULL, NULL, NULL);
2430                 CHECK_RETURN("connection_set_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2431                 return 0;
2432         }
2433
2434         ret = connection_set_ethernet_cable_state_changed_cb(NULL,
2435                         test_connection_set_ethernet_callback, NULL);
2436         CHECK_RETURN("connection_set_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2437         ret = connection_set_ethernet_cable_state_changed_cb(connection, NULL, NULL);
2438         CHECK_RETURN("connection_set_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2439
2440         return 0;
2441 }
2442
2443 int utc_connection_set_ethernet_cable_state_changed_cb_p(void)
2444 {
2445         int ret;
2446         if (ethernet_supported == false) {
2447                 ret = connection_set_ethernet_cable_state_changed_cb(NULL, NULL, NULL);
2448                 CHECK_RETURN("connection_set_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2449                 return 0;
2450         }
2451
2452         ret = connection_set_ethernet_cable_state_changed_cb(connection, test_connection_set_ethernet_callback, NULL);
2453         CHECK_RETURN("connection_set_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_NONE);
2454
2455         return 0;
2456 }
2457
2458 /**
2459  * @testcase            utc_connection_unset_ethernet_cable_state_changed_cb_n
2460  * @since_tizen         4.0
2461  * @type                Negative
2462  * @description         connection_unset_ethernet_cable_state_changed_cb should fail with invalid parameter.
2463  * @scenario            Verify connection_unset_ethernet_cable_state_changed_cb by passing invalid parameter.
2464  */
2465 int utc_connection_unset_ethernet_cable_state_changed_cb_n(void)
2466 {
2467         int ret;
2468         ret = connection_unset_ethernet_cable_state_changed_cb(NULL);
2469
2470         if (ethernet_supported == false)
2471                 CHECK_RETURN("connection_unset_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2472         else
2473                 CHECK_RETURN("connection_unset_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2474         return 0;
2475 }
2476
2477 int utc_connection_unset_ethernet_cable_state_changed_cb_p(void)
2478 {
2479         int ret;
2480         ret = connection_unset_ethernet_cable_state_changed_cb(connection);
2481
2482         if (ethernet_supported == false)
2483                 CHECK_RETURN("connection_unset_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2484         else
2485                 CHECK_RETURN("connection_unset_ethernet_cable_state_changed_cb", ret, CONNECTION_ERROR_NONE);
2486         return 0;
2487 }
2488
2489 /**
2490  * @testcase            utc_connection_set_internet_state_changed_cb_p
2491  * @since_tizen         5.5
2492  * @type                Positive
2493  * @description         Set internet state changed callback.
2494  * @scenario            Verify connection_set_internet_state_changed_cb by passing valid parameter.
2495  */
2496 int utc_connection_set_internet_state_changed_cb_p(void)
2497 {
2498         int ret;
2499         ret = connection_set_internet_state_changed_cb(connection,
2500                                test_connection_internet_state_changed_callback, NULL);
2501
2502         CHECK_RETURN("connection_set_internet_state_changed_cb", ret, CONNECTION_ERROR_NONE);
2503
2504         return 0;
2505 }
2506
2507 /**
2508  * @testcase            utc_connection_set_internet_state_changed_cb_n1
2509  * @since_tizen         5.5
2510  * @type                Negative
2511  * @description         connection_set_internet_state_changed_cb should fail when connection is NULL.
2512  * @scenario            Verify connection_set_internet_state_changed_cb by passing connection as NULL.
2513  */
2514 int utc_connection_set_internet_state_changed_cb_n1(void)
2515 {
2516         int ret;
2517         ret = connection_set_internet_state_changed_cb(NULL,
2518                                test_connection_internet_state_changed_callback, NULL);
2519
2520         CHECK_RETURN("connection_set_internet_state_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2521
2522         return 0;
2523 }
2524
2525 /**
2526  * @testcase            utc_connection_set_internet_state_changed_cb_n2
2527  * @since_tizen         5.5
2528  * @type                Negative
2529  * @description         connection_set_internet_state_changed_cb should fail when callback is NULL.
2530  * @scenario            Verify connection_set_internet_state_changed_cb by passing callback as NULL.
2531  */
2532 int utc_connection_set_internet_state_changed_cb_n2(void)
2533 {
2534         int ret;
2535         ret = connection_set_internet_state_changed_cb(connection, NULL, NULL);
2536
2537         CHECK_RETURN("connection_set_internet_state_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2538
2539         return 0;
2540 }
2541
2542 /**
2543  * @testcase            utc_connection_unset_internet_state_changed_cb_p
2544  * @since_tizen         5.5
2545  * @type                Positive
2546  * @description         Unset internet state changed callback.
2547  * @scenario            Verify connection_unset_internet_state_changed_cb by passing valid parameter.
2548  */
2549 int utc_connection_unset_internet_state_changed_cb_p(void)
2550 {
2551         int ret;
2552         ret = connection_unset_internet_state_changed_cb(connection);
2553
2554         CHECK_RETURN("connection_unset_internet_state_changed_cb", ret, CONNECTION_ERROR_NONE);
2555
2556         return 0;
2557 }
2558
2559 /**
2560  * @testcase            utc_connection_unset_internet_state_changed_cb_n
2561  * @since_tizen         5.5
2562  * @type                Negative
2563  * @description         connection_unset_internet_state_changed_cb should fail when connection is NULL.
2564  * @scenario            Verify connection_unset_internet_state_changed_cb by passing connection as NULL.
2565  */
2566 int utc_connection_unset_internet_state_changed_cb_n(void)
2567 {
2568         int ret;
2569         ret = connection_unset_internet_state_changed_cb(NULL);
2570
2571         CHECK_RETURN("connection_unset_internet_state_changed_cb", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2572
2573         return 0;
2574 }
2575
2576 /**
2577  * @testcase            utc_connection_destroy_p
2578  * @since_tizen         2.3
2579  * @type                Positive
2580  * @description         Destroys the connection handle.
2581  * @scenario            Invoking connection_destroy with valid parameter.
2582  */
2583 int utc_connection_destroy_p(void)
2584 {
2585         int ret = connection_destroy(connection);
2586
2587         if (all_features_not_supported)
2588                 CHECK_RETURN("connection_destroy", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2589         else
2590                 CHECK_RETURN("connection_destroy", ret, CONNECTION_ERROR_NONE);
2591         return 0;
2592 }
2593
2594 /**
2595  * @testcase            utc_connection_destroy_n
2596  * @since_tizen         2.3
2597  * @type                Negative
2598  * @description         connection_destroy should fail with invalid parameter.
2599  * @scenario            Verify connection_destroy by passing invalid parameter.
2600  */
2601 int utc_connection_destroy_n(void)
2602 {
2603         int ret = connection_destroy(NULL);
2604
2605         if (all_features_not_supported)
2606                 CHECK_RETURN("connection_destroy", ret, CONNECTION_ERROR_NOT_SUPPORTED);
2607         else
2608                 CHECK_RETURN("connection_destroy", ret, CONNECTION_ERROR_INVALID_PARAMETER);
2609         return 0;
2610 }