From 4c91623cda33ab64d158e826fda6aa71f0ac6566 Mon Sep 17 00:00:00 2001 From: hyunuktak Date: Wed, 7 Sep 2016 14:57:13 +0900 Subject: [PATCH] [UTC][wifi][Non-acr][Modified TCs to connect wifi for pre/post condition] Change-Id: I7195c3662d4f5dbfd30d87f78487ce3d625dfd57 Signed-off-by: hyunuktak --- src/utc/wifi/tct-wifi-core_common_iot.h | 12 +- src/utc/wifi/tct-wifi-core_mobile.h | 12 +- src/utc/wifi/tct-wifi-core_tv.h | 12 +- src/utc/wifi/tct-wifi-core_wearable.h | 12 +- src/utc/wifi/utc-network-wifi.c | 263 +++++++++++++++----------------- 5 files changed, 148 insertions(+), 163 deletions(-) diff --git a/src/utc/wifi/tct-wifi-core_common_iot.h b/src/utc/wifi/tct-wifi-core_common_iot.h index 2cc6781..17e954f 100755 --- a/src/utc/wifi/tct-wifi-core_common_iot.h +++ b/src/utc/wifi/tct-wifi-core_common_iot.h @@ -217,9 +217,6 @@ extern int utc_wifi_scan_p(void); extern int utc_wifi_scan_n(void); extern int utc_wifi_deactivate_n(void); extern int utc_wifi_deactivate_p(void); -extern int utc_wifi_connect_n1(void); -extern int utc_wifi_connect_n2(void); -extern int utc_wifi_connect_p(void); extern int utc_wifi_disconnect_n1(void); extern int utc_wifi_disconnect_n2(void); extern int utc_wifi_disconnect_p(void); @@ -238,6 +235,9 @@ extern int utc_wifi_tdls_set_state_changed_cb_p(void); extern int utc_wifi_tdls_set_state_changed_cb_n(void); extern int utc_wifi_tdls_unset_state_changed_cb_p(void); extern int utc_wifi_tdls_unset_state_changed_cb_n(void); +extern int utc_wifi_connect_n1(void); +extern int utc_wifi_connect_n2(void); +extern int utc_wifi_connect_p(void); testcase tc_array[] = { {"utc_wifi_ap_create_p", utc_wifi_ap_create_p, utc_wifi_ap_startup, utc_wifi_ap_cleanup}, @@ -429,9 +429,6 @@ testcase tc_array[] = { {"utc_wifi_scan_n", utc_wifi_scan_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_n", utc_wifi_deactivate_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_p", utc_wifi_deactivate_p, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n1", utc_wifi_disconnect_n1, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n2", utc_wifi_disconnect_n2, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_p", utc_wifi_disconnect_p, utc_wifi_startup, utc_wifi_cleanup}, @@ -450,6 +447,9 @@ testcase tc_array[] = { {"utc_wifi_tdls_set_state_changed_cb_n", utc_wifi_tdls_set_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_p", utc_wifi_tdls_unset_state_changed_cb_p, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_n", utc_wifi_tdls_unset_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, + {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {NULL, NULL} }; diff --git a/src/utc/wifi/tct-wifi-core_mobile.h b/src/utc/wifi/tct-wifi-core_mobile.h index 2cc6781..17e954f 100755 --- a/src/utc/wifi/tct-wifi-core_mobile.h +++ b/src/utc/wifi/tct-wifi-core_mobile.h @@ -217,9 +217,6 @@ extern int utc_wifi_scan_p(void); extern int utc_wifi_scan_n(void); extern int utc_wifi_deactivate_n(void); extern int utc_wifi_deactivate_p(void); -extern int utc_wifi_connect_n1(void); -extern int utc_wifi_connect_n2(void); -extern int utc_wifi_connect_p(void); extern int utc_wifi_disconnect_n1(void); extern int utc_wifi_disconnect_n2(void); extern int utc_wifi_disconnect_p(void); @@ -238,6 +235,9 @@ extern int utc_wifi_tdls_set_state_changed_cb_p(void); extern int utc_wifi_tdls_set_state_changed_cb_n(void); extern int utc_wifi_tdls_unset_state_changed_cb_p(void); extern int utc_wifi_tdls_unset_state_changed_cb_n(void); +extern int utc_wifi_connect_n1(void); +extern int utc_wifi_connect_n2(void); +extern int utc_wifi_connect_p(void); testcase tc_array[] = { {"utc_wifi_ap_create_p", utc_wifi_ap_create_p, utc_wifi_ap_startup, utc_wifi_ap_cleanup}, @@ -429,9 +429,6 @@ testcase tc_array[] = { {"utc_wifi_scan_n", utc_wifi_scan_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_n", utc_wifi_deactivate_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_p", utc_wifi_deactivate_p, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n1", utc_wifi_disconnect_n1, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n2", utc_wifi_disconnect_n2, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_p", utc_wifi_disconnect_p, utc_wifi_startup, utc_wifi_cleanup}, @@ -450,6 +447,9 @@ testcase tc_array[] = { {"utc_wifi_tdls_set_state_changed_cb_n", utc_wifi_tdls_set_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_p", utc_wifi_tdls_unset_state_changed_cb_p, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_n", utc_wifi_tdls_unset_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, + {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {NULL, NULL} }; diff --git a/src/utc/wifi/tct-wifi-core_tv.h b/src/utc/wifi/tct-wifi-core_tv.h index 2cc6781..17e954f 100755 --- a/src/utc/wifi/tct-wifi-core_tv.h +++ b/src/utc/wifi/tct-wifi-core_tv.h @@ -217,9 +217,6 @@ extern int utc_wifi_scan_p(void); extern int utc_wifi_scan_n(void); extern int utc_wifi_deactivate_n(void); extern int utc_wifi_deactivate_p(void); -extern int utc_wifi_connect_n1(void); -extern int utc_wifi_connect_n2(void); -extern int utc_wifi_connect_p(void); extern int utc_wifi_disconnect_n1(void); extern int utc_wifi_disconnect_n2(void); extern int utc_wifi_disconnect_p(void); @@ -238,6 +235,9 @@ extern int utc_wifi_tdls_set_state_changed_cb_p(void); extern int utc_wifi_tdls_set_state_changed_cb_n(void); extern int utc_wifi_tdls_unset_state_changed_cb_p(void); extern int utc_wifi_tdls_unset_state_changed_cb_n(void); +extern int utc_wifi_connect_n1(void); +extern int utc_wifi_connect_n2(void); +extern int utc_wifi_connect_p(void); testcase tc_array[] = { {"utc_wifi_ap_create_p", utc_wifi_ap_create_p, utc_wifi_ap_startup, utc_wifi_ap_cleanup}, @@ -429,9 +429,6 @@ testcase tc_array[] = { {"utc_wifi_scan_n", utc_wifi_scan_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_n", utc_wifi_deactivate_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_p", utc_wifi_deactivate_p, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n1", utc_wifi_disconnect_n1, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n2", utc_wifi_disconnect_n2, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_p", utc_wifi_disconnect_p, utc_wifi_startup, utc_wifi_cleanup}, @@ -450,6 +447,9 @@ testcase tc_array[] = { {"utc_wifi_tdls_set_state_changed_cb_n", utc_wifi_tdls_set_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_p", utc_wifi_tdls_unset_state_changed_cb_p, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_n", utc_wifi_tdls_unset_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, + {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {NULL, NULL} }; diff --git a/src/utc/wifi/tct-wifi-core_wearable.h b/src/utc/wifi/tct-wifi-core_wearable.h index 2cc6781..17e954f 100755 --- a/src/utc/wifi/tct-wifi-core_wearable.h +++ b/src/utc/wifi/tct-wifi-core_wearable.h @@ -217,9 +217,6 @@ extern int utc_wifi_scan_p(void); extern int utc_wifi_scan_n(void); extern int utc_wifi_deactivate_n(void); extern int utc_wifi_deactivate_p(void); -extern int utc_wifi_connect_n1(void); -extern int utc_wifi_connect_n2(void); -extern int utc_wifi_connect_p(void); extern int utc_wifi_disconnect_n1(void); extern int utc_wifi_disconnect_n2(void); extern int utc_wifi_disconnect_p(void); @@ -238,6 +235,9 @@ extern int utc_wifi_tdls_set_state_changed_cb_p(void); extern int utc_wifi_tdls_set_state_changed_cb_n(void); extern int utc_wifi_tdls_unset_state_changed_cb_p(void); extern int utc_wifi_tdls_unset_state_changed_cb_n(void); +extern int utc_wifi_connect_n1(void); +extern int utc_wifi_connect_n2(void); +extern int utc_wifi_connect_p(void); testcase tc_array[] = { {"utc_wifi_ap_create_p", utc_wifi_ap_create_p, utc_wifi_ap_startup, utc_wifi_ap_cleanup}, @@ -429,9 +429,6 @@ testcase tc_array[] = { {"utc_wifi_scan_n", utc_wifi_scan_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_n", utc_wifi_deactivate_n, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_deactivate_p", utc_wifi_deactivate_p, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, - {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n1", utc_wifi_disconnect_n1, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_n2", utc_wifi_disconnect_n2, utc_wifi_startup, utc_wifi_cleanup}, {"utc_wifi_disconnect_p", utc_wifi_disconnect_p, utc_wifi_startup, utc_wifi_cleanup}, @@ -450,6 +447,9 @@ testcase tc_array[] = { {"utc_wifi_tdls_set_state_changed_cb_n", utc_wifi_tdls_set_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_p", utc_wifi_tdls_unset_state_changed_cb_p, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, {"utc_wifi_tdls_unset_state_changed_cb_n", utc_wifi_tdls_unset_state_changed_cb_n, utc_wifi_tdls_startup, utc_wifi_tdls_cleanup}, + {"utc_wifi_connect_n1", utc_wifi_connect_n1, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_n2", utc_wifi_connect_n2, utc_wifi_startup, utc_wifi_cleanup}, + {"utc_wifi_connect_p", utc_wifi_connect_p, utc_wifi_startup, utc_wifi_cleanup}, {NULL, NULL} }; diff --git a/src/utc/wifi/utc-network-wifi.c b/src/utc/wifi/utc-network-wifi.c index e83d88f..dd256ae 100755 --- a/src/utc/wifi/utc-network-wifi.c +++ b/src/utc/wifi/utc-network-wifi.c @@ -282,6 +282,49 @@ static bool __utc_wifi_found_specific_aps_callback(wifi_ap_h ap, void *user_data return true; } +static int wifi_pre_connect(void) +{ + bool activated; + int ret = WIFI_ERROR_NONE; + wifi_ap_h ap_h; + wifi_connection_state_e connection_state; + char configValue[CONFIG_VALUE_LEN_MAX] = {0,}; + + ret = wifi_is_activated(&activated); + assert_eq(ret, WIFI_ERROR_NONE); + if(activated == false) { + wifi_activate(__test_activated_callback, NULL); + RUN_GMAIN_LOOP; + assert_eq(g_CallbackRet, WIFI_ERROR_NONE); + } + + ret = wifi_get_connection_state(&connection_state); + assert_eq(ret, WIFI_ERROR_NONE); + if(connection_state == WIFI_CONNECTION_STATE_CONNECTED) { + ret = wifi_get_connected_ap(&ap_h); + assert_eq(ret, WIFI_ERROR_NONE); + return WIFI_ERROR_NONE; + } + + wifi_scan(__test_scan_request_callback, NULL); + RUN_GMAIN_LOOP; + assert_eq(g_CallbackRet, WIFI_ERROR_NONE); + + if(_get_value_from_configfile("WIFI_WPSACCESSPOINTNAME", configValue) == false) + return WIFI_ERROR_OPERATION_FAILED; + if(_get_value_from_configfile("WIFI_ACCESSPOINTPIN", g_passPhrase) == false) + return WIFI_ERROR_OPERATION_FAILED; + + wifi_foreach_found_aps(__utc_wifi_foreach_found_aps_callback, configValue); + RUN_GMAIN_LOOP; + assert_eq(g_CallbackRet, WIFI_ERROR_NONE); + + ret = wifi_get_connected_ap(&ap_h); + assert_eq(ret, WIFI_ERROR_NONE); + + return WIFI_ERROR_NONE; +} + /** * @testcase utc_wifi_initialize_p * @since_tizen 2.3 @@ -1435,109 +1478,6 @@ int utc_wifi_deactivate_p(void) } /** - * @testcase utc_wifi_connect_n1 - * @since_tizen 2.3 - * @type Negative - * @description Verify wifi_connect by passing invalid parameters. - * @scenario Try to connect Wi-Fi before initialization and ensure WIFI_ERROR_INVALID_OPERATION is reported. - */ -int utc_wifi_connect_n1(void) -{ - int ret = WIFI_ERROR_NONE; - if(g_wifi_supported == false) { - ret = wifi_connect(g_hAp, __test_activated_callback, NULL); - assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); - return 0; - } - - wifi_deinitialize(); - - ret = wifi_connect(g_hAp, __test_activated_callback, NULL); - wifi_initialize(); - - assert_eq(ret, WIFI_ERROR_INVALID_OPERATION); - - return 0; -} - -/** - * @testcase utc_wifi_connect_n2 - * @since_tizen 2.3 - * @type Negative - * @description Verify wifi_connect by passing invalid parameters. - * @scenario Try to connect Wi-Fi with invalid AP handle and ensure WIFI_ERROR_INVALID_PARAMETER is reported. - */ -int utc_wifi_connect_n2(void) -{ - int ret = WIFI_ERROR_NONE; - if(g_wifi_supported == false) { - ret = wifi_connect(NULL, __test_activated_callback, NULL); - assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); - return 0; - } - - ret = wifi_connect(NULL, __test_activated_callback, NULL); - - assert_eq(ret, WIFI_ERROR_INVALID_PARAMETER); - - return 0; -} - -/** - * @testcase utc_wifi_connect_p - * @since_tizen 2.3 - * @type Positive - * @description Connects the access point asynchronously.. - * @scenario Create AP handle and activate Wi-Fi. On acivattion Wi-Fi connection will - * be initiated to the AP. - */ -int utc_wifi_connect_p(void) -{ - bool activated; - int ret = WIFI_ERROR_NONE; - wifi_ap_h ap_h; - wifi_connection_state_e connection_state; - char configValue[CONFIG_VALUE_LEN_MAX] = {0,}; - - if(g_wifi_supported == false) { - ret = wifi_connect(g_hAp, __test_activated_callback, NULL); - assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); - return 0; - } - - ret = wifi_is_activated(&activated); - assert_eq(ret, WIFI_ERROR_NONE); - if(activated == false) { - wifi_activate(__test_activated_callback, NULL); - RUN_GMAIN_LOOP; - assert_eq(g_CallbackRet, WIFI_ERROR_NONE); - } - - ret = wifi_get_connection_state(&connection_state); - assert_eq(ret, WIFI_ERROR_NONE); - if(connection_state == WIFI_CONNECTION_STATE_CONNECTED) { - ret = wifi_get_connected_ap(&ap_h); - assert_eq(ret, WIFI_ERROR_NONE); - return 0; - } - - wifi_scan(__test_scan_request_callback, NULL); - RUN_GMAIN_LOOP; - assert_eq(g_CallbackRet, WIFI_ERROR_NONE); - - if(_get_value_from_configfile("WIFI_WPSACCESSPOINTNAME", configValue) == false) - return -1; - if(_get_value_from_configfile("WIFI_ACCESSPOINTPIN", g_passPhrase) == false) - return -1; - - wifi_foreach_found_aps(__utc_wifi_foreach_found_aps_callback, configValue); - RUN_GMAIN_LOOP; - assert_eq(g_CallbackRet, WIFI_ERROR_NONE); - - return 0; -} - -/** * @testcase utc_wifi_disconnect_n1 * @since_tizen 2.3 * @type Negative @@ -1603,6 +1543,9 @@ int utc_wifi_disconnect_p(void) return 0; } + ret = wifi_pre_connect(); + assert_eq(ret, WIFI_ERROR_NONE); + ret = wifi_get_connected_ap(&g_hAp); assert_eq(ret, WIFI_ERROR_NONE); @@ -1733,48 +1676,14 @@ int utc_wifi_connect_by_wps_pbc_n2(void) int utc_wifi_get_connected_ap_p(void) { int ret = 0; - bool activated; - wifi_ap_h ap_h; - wifi_connection_state_e connection_state; - char configValue[CONFIG_VALUE_LEN_MAX] = {0,}; if(g_wifi_supported == false) { - ret = WIFI_ERROR_NONE; - ret = wifi_get_connected_ap(&ap_h); + ret = wifi_get_connected_ap(&g_hAp); assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); return 0; } - ret = wifi_is_activated(&activated); - assert_eq(ret, WIFI_ERROR_NONE); - if(activated == false) { - wifi_activate(__test_activated_callback, NULL); - RUN_GMAIN_LOOP; - assert_eq(g_CallbackRet, WIFI_ERROR_NONE); - } - - ret = wifi_get_connection_state(&connection_state); - assert_eq(ret, WIFI_ERROR_NONE); - if(connection_state == WIFI_CONNECTION_STATE_CONNECTED) { - ret = wifi_get_connected_ap(&ap_h); - assert_eq(ret, WIFI_ERROR_NONE); - return 0; - } - - wifi_scan(__test_scan_request_callback, NULL); - RUN_GMAIN_LOOP; - assert_eq(g_CallbackRet, WIFI_ERROR_NONE); - - if(_get_value_from_configfile("WIFI_WPSACCESSPOINTNAME", configValue) == false) - return -1; - if(_get_value_from_configfile("WIFI_ACCESSPOINTPIN", g_passPhrase) == false) - return -1; - - wifi_foreach_found_aps(__utc_wifi_foreach_found_aps_callback, configValue); - RUN_GMAIN_LOOP; - assert_eq(g_CallbackRet, WIFI_ERROR_NONE); - - ret = wifi_get_connected_ap(&ap_h); + ret = wifi_pre_connect(); assert_eq(ret, WIFI_ERROR_NONE); return 0; @@ -1867,6 +1776,9 @@ int utc_wifi_forget_ap_p(void) return 0; } + ret = wifi_pre_connect(); + assert_eq(ret, WIFI_ERROR_NONE); + ret = wifi_get_connected_ap(&g_hAp); assert_eq(ret, WIFI_ERROR_NONE); @@ -1875,3 +1787,76 @@ int utc_wifi_forget_ap_p(void) return 0; } + +/** + * @testcase utc_wifi_connect_n1 + * @since_tizen 2.3 + * @type Negative + * @description Verify wifi_connect by passing invalid parameters. + * @scenario Try to connect Wi-Fi before initialization and ensure WIFI_ERROR_INVALID_OPERATION is reported. + */ +int utc_wifi_connect_n1(void) +{ + int ret = WIFI_ERROR_NONE; + if(g_wifi_supported == false) { + ret = wifi_connect(g_hAp, __test_activated_callback, NULL); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } + + wifi_deinitialize(); + + ret = wifi_connect(g_hAp, __test_activated_callback, NULL); + wifi_initialize(); + + assert_eq(ret, WIFI_ERROR_INVALID_OPERATION); + + return 0; +} + +/** + * @testcase utc_wifi_connect_n2 + * @since_tizen 2.3 + * @type Negative + * @description Verify wifi_connect by passing invalid parameters. + * @scenario Try to connect Wi-Fi with invalid AP handle and ensure WIFI_ERROR_INVALID_PARAMETER is reported. + */ +int utc_wifi_connect_n2(void) +{ + int ret = WIFI_ERROR_NONE; + if(g_wifi_supported == false) { + ret = wifi_connect(NULL, __test_activated_callback, NULL); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } + + ret = wifi_connect(NULL, __test_activated_callback, NULL); + + assert_eq(ret, WIFI_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_wifi_connect_p + * @since_tizen 2.3 + * @type Positive + * @description Connects the access point asynchronously.. + * @scenario Create AP handle and activate Wi-Fi. On acivattion Wi-Fi connection will + * be initiated to the AP. + */ +int utc_wifi_connect_p(void) +{ + int ret = WIFI_ERROR_NONE; + + if(g_wifi_supported == false) { + ret = wifi_connect(g_hAp, __test_activated_callback, NULL); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } + + ret = wifi_pre_connect(); + assert_eq(ret, WIFI_ERROR_NONE); + + return 0; +} -- 2.7.4