From fa7bd6f012c7253d4feb32fb77c3f3357f61c95d Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Mon, 20 Jun 2016 21:17:30 +0900 Subject: [PATCH] [UTC][http][NON-ACR] Add missing testcases Change-Id: I976f17d6a4f8b3b127a6bcd35c4b8fff09ddc0fb Signed-off-by: Seonah Moon --- src/utc/http/tct-http-core_common_iot.h | 14 +++ src/utc/http/tct-http-core_mobile.h | 14 +++ src/utc/http/tct-http-core_tv.h | 34 ++++++ src/utc/http/tct-http-core_wearable.h | 14 +++ src/utc/http/utc-network-http.c | 183 ++++++++++++++++++++++++++++++++ 5 files changed, 259 insertions(+) diff --git a/src/utc/http/tct-http-core_common_iot.h b/src/utc/http/tct-http-core_common_iot.h index d516030..2746b2f 100755 --- a/src/utc/http/tct-http-core_common_iot.h +++ b/src/utc/http/tct-http-core_common_iot.h @@ -21,6 +21,8 @@ extern void utc_http_startup(void); extern void utc_http_cleanup(void); +extern int utc_http_init_n(void); +extern int utc_http_init_p(void); extern int utc_http_session_create_p(void); extern int utc_http_session_create_n(void); extern int utc_http_session_destroy_n(void); @@ -103,12 +105,19 @@ extern int utc_http_transaction_get_credentials_n(void); extern int utc_http_transaction_get_credentials_p(void); extern int utc_http_transaction_open_authentication_n(void); extern int utc_http_transaction_open_authentication_p(void); +extern int utc_http_transaction_resume_n(void); +extern int utc_http_transaction_pause_n(void); +extern int utc_http_transaction_response_get_status_text_n(void); +extern int utc_http_transaction_response_get_version_n(void); +extern int utc_http_transaction_get_realm_n(void); extern int utc_http_transaction_submit_n(void); extern int utc_http_transaction_submit_p(void); extern int utc_http_deinit_n(void); extern int utc_http_deinit_p(void); testcase tc_array[] = { + {"utc_http_init_n", utc_http_init_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_init_p", utc_http_init_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_p", utc_http_session_create_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_n", utc_http_session_create_n, utc_http_startup, utc_http_cleanup}, {"utc_http_session_destroy_n", utc_http_session_destroy_n, utc_http_startup, utc_http_cleanup}, @@ -191,6 +200,11 @@ testcase tc_array[] = { {"utc_http_transaction_get_credentials_p", utc_http_transaction_get_credentials_p, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_open_authentication_n", utc_http_transaction_open_authentication_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_open_authentication_p", utc_http_transaction_open_authentication_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_resume_n", utc_http_transaction_resume_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_pause_n", utc_http_transaction_pause_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_status_text_n", utc_http_transaction_response_get_status_text_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_version_n", utc_http_transaction_response_get_version_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_realm_n", utc_http_transaction_get_realm_n}, {"utc_http_transaction_submit_n", utc_http_transaction_submit_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_submit_p", utc_http_transaction_submit_p, utc_http_startup, utc_http_cleanup}, {"utc_http_deinit_p", utc_http_deinit_p, utc_http_startup, utc_http_cleanup}, diff --git a/src/utc/http/tct-http-core_mobile.h b/src/utc/http/tct-http-core_mobile.h index d516030..2746b2f 100755 --- a/src/utc/http/tct-http-core_mobile.h +++ b/src/utc/http/tct-http-core_mobile.h @@ -21,6 +21,8 @@ extern void utc_http_startup(void); extern void utc_http_cleanup(void); +extern int utc_http_init_n(void); +extern int utc_http_init_p(void); extern int utc_http_session_create_p(void); extern int utc_http_session_create_n(void); extern int utc_http_session_destroy_n(void); @@ -103,12 +105,19 @@ extern int utc_http_transaction_get_credentials_n(void); extern int utc_http_transaction_get_credentials_p(void); extern int utc_http_transaction_open_authentication_n(void); extern int utc_http_transaction_open_authentication_p(void); +extern int utc_http_transaction_resume_n(void); +extern int utc_http_transaction_pause_n(void); +extern int utc_http_transaction_response_get_status_text_n(void); +extern int utc_http_transaction_response_get_version_n(void); +extern int utc_http_transaction_get_realm_n(void); extern int utc_http_transaction_submit_n(void); extern int utc_http_transaction_submit_p(void); extern int utc_http_deinit_n(void); extern int utc_http_deinit_p(void); testcase tc_array[] = { + {"utc_http_init_n", utc_http_init_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_init_p", utc_http_init_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_p", utc_http_session_create_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_n", utc_http_session_create_n, utc_http_startup, utc_http_cleanup}, {"utc_http_session_destroy_n", utc_http_session_destroy_n, utc_http_startup, utc_http_cleanup}, @@ -191,6 +200,11 @@ testcase tc_array[] = { {"utc_http_transaction_get_credentials_p", utc_http_transaction_get_credentials_p, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_open_authentication_n", utc_http_transaction_open_authentication_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_open_authentication_p", utc_http_transaction_open_authentication_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_resume_n", utc_http_transaction_resume_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_pause_n", utc_http_transaction_pause_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_status_text_n", utc_http_transaction_response_get_status_text_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_version_n", utc_http_transaction_response_get_version_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_realm_n", utc_http_transaction_get_realm_n}, {"utc_http_transaction_submit_n", utc_http_transaction_submit_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_submit_p", utc_http_transaction_submit_p, utc_http_startup, utc_http_cleanup}, {"utc_http_deinit_p", utc_http_deinit_p, utc_http_startup, utc_http_cleanup}, diff --git a/src/utc/http/tct-http-core_tv.h b/src/utc/http/tct-http-core_tv.h index 68f274d..2746b2f 100755 --- a/src/utc/http/tct-http-core_tv.h +++ b/src/utc/http/tct-http-core_tv.h @@ -21,6 +21,8 @@ extern void utc_http_startup(void); extern void utc_http_cleanup(void); +extern int utc_http_init_n(void); +extern int utc_http_init_p(void); extern int utc_http_session_create_p(void); extern int utc_http_session_create_n(void); extern int utc_http_session_destroy_n(void); @@ -93,12 +95,29 @@ extern int utc_http_transaction_request_get_cookie_n(void); extern int utc_http_transaction_request_get_cookie_p(void); extern int utc_http_transaction_request_write_body_n(void); extern int utc_http_transaction_request_write_body_p(void); +extern int utc_http_transaction_set_http_auth_scheme_n(void); +extern int utc_http_transaction_set_http_auth_scheme_p(void); +extern int utc_http_transaction_get_http_auth_scheme_n(void); +extern int utc_http_transaction_get_http_auth_scheme_p(void); +extern int utc_http_transaction_set_credentials_n(void); +extern int utc_http_transaction_set_credentials_p(void); +extern int utc_http_transaction_get_credentials_n(void); +extern int utc_http_transaction_get_credentials_p(void); +extern int utc_http_transaction_open_authentication_n(void); +extern int utc_http_transaction_open_authentication_p(void); +extern int utc_http_transaction_resume_n(void); +extern int utc_http_transaction_pause_n(void); +extern int utc_http_transaction_response_get_status_text_n(void); +extern int utc_http_transaction_response_get_version_n(void); +extern int utc_http_transaction_get_realm_n(void); extern int utc_http_transaction_submit_n(void); extern int utc_http_transaction_submit_p(void); extern int utc_http_deinit_n(void); extern int utc_http_deinit_p(void); testcase tc_array[] = { + {"utc_http_init_n", utc_http_init_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_init_p", utc_http_init_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_p", utc_http_session_create_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_n", utc_http_session_create_n, utc_http_startup, utc_http_cleanup}, {"utc_http_session_destroy_n", utc_http_session_destroy_n, utc_http_startup, utc_http_cleanup}, @@ -171,6 +190,21 @@ testcase tc_array[] = { {"utc_http_transaction_request_get_cookie_p", utc_http_transaction_request_get_cookie_p, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_request_write_body_n", utc_http_transaction_request_write_body_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_request_write_body_p", utc_http_transaction_request_write_body_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_set_http_auth_scheme_n", utc_http_transaction_set_http_auth_scheme_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_set_http_auth_scheme_p", utc_http_transaction_set_http_auth_scheme_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_http_auth_scheme_n", utc_http_transaction_get_http_auth_scheme_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_http_auth_scheme_p", utc_http_transaction_get_http_auth_scheme_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_set_credentials_n", utc_http_transaction_set_credentials_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_set_credentials_p", utc_http_transaction_set_credentials_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_credentials_n", utc_http_transaction_get_credentials_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_credentials_p", utc_http_transaction_get_credentials_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_open_authentication_n", utc_http_transaction_open_authentication_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_open_authentication_p", utc_http_transaction_open_authentication_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_resume_n", utc_http_transaction_resume_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_pause_n", utc_http_transaction_pause_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_status_text_n", utc_http_transaction_response_get_status_text_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_version_n", utc_http_transaction_response_get_version_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_realm_n", utc_http_transaction_get_realm_n}, {"utc_http_transaction_submit_n", utc_http_transaction_submit_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_submit_p", utc_http_transaction_submit_p, utc_http_startup, utc_http_cleanup}, {"utc_http_deinit_p", utc_http_deinit_p, utc_http_startup, utc_http_cleanup}, diff --git a/src/utc/http/tct-http-core_wearable.h b/src/utc/http/tct-http-core_wearable.h index d516030..2746b2f 100755 --- a/src/utc/http/tct-http-core_wearable.h +++ b/src/utc/http/tct-http-core_wearable.h @@ -21,6 +21,8 @@ extern void utc_http_startup(void); extern void utc_http_cleanup(void); +extern int utc_http_init_n(void); +extern int utc_http_init_p(void); extern int utc_http_session_create_p(void); extern int utc_http_session_create_n(void); extern int utc_http_session_destroy_n(void); @@ -103,12 +105,19 @@ extern int utc_http_transaction_get_credentials_n(void); extern int utc_http_transaction_get_credentials_p(void); extern int utc_http_transaction_open_authentication_n(void); extern int utc_http_transaction_open_authentication_p(void); +extern int utc_http_transaction_resume_n(void); +extern int utc_http_transaction_pause_n(void); +extern int utc_http_transaction_response_get_status_text_n(void); +extern int utc_http_transaction_response_get_version_n(void); +extern int utc_http_transaction_get_realm_n(void); extern int utc_http_transaction_submit_n(void); extern int utc_http_transaction_submit_p(void); extern int utc_http_deinit_n(void); extern int utc_http_deinit_p(void); testcase tc_array[] = { + {"utc_http_init_n", utc_http_init_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_init_p", utc_http_init_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_p", utc_http_session_create_p, utc_http_startup, utc_http_cleanup}, {"utc_http_session_create_n", utc_http_session_create_n, utc_http_startup, utc_http_cleanup}, {"utc_http_session_destroy_n", utc_http_session_destroy_n, utc_http_startup, utc_http_cleanup}, @@ -191,6 +200,11 @@ testcase tc_array[] = { {"utc_http_transaction_get_credentials_p", utc_http_transaction_get_credentials_p, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_open_authentication_n", utc_http_transaction_open_authentication_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_open_authentication_p", utc_http_transaction_open_authentication_p, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_resume_n", utc_http_transaction_resume_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_pause_n", utc_http_transaction_pause_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_status_text_n", utc_http_transaction_response_get_status_text_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_response_get_version_n", utc_http_transaction_response_get_version_n, utc_http_startup, utc_http_cleanup}, + {"utc_http_transaction_get_realm_n", utc_http_transaction_get_realm_n}, {"utc_http_transaction_submit_n", utc_http_transaction_submit_n, utc_http_startup, utc_http_cleanup}, {"utc_http_transaction_submit_p", utc_http_transaction_submit_p, utc_http_startup, utc_http_cleanup}, {"utc_http_deinit_p", utc_http_deinit_p, utc_http_startup, utc_http_cleanup}, diff --git a/src/utc/http/utc-network-http.c b/src/utc/http/utc-network-http.c index f1ce916..d3ffc66 100755 --- a/src/utc/http/utc-network-http.c +++ b/src/utc/http/utc-network-http.c @@ -151,6 +151,54 @@ void utc_http_cleanup(void) } /** + * @testcas utc_http_init_n + * @since_tizen 3.0 + * @type Negative + * @description Initializes the HTTP module. + * @scenario Invoking http_init with invalid parameter. + */ +int utc_http_init_n(void) +{ + int ret; + +#ifdef WEARABLE + if (g_internet_supported == false) { + ret = http_init(); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } +#endif + ret = http_init(); + assert_eq(ret, TIZEN_ERROR_INVALID_OPERATION); + return 0; +} + +/** + * @testcase utc_http_init_p + * @since_tizen 3.0 + * @type Positive + * @description Initializes the HTTP module. + * @scenario Invoking http_init with valid parameter. + */ +int utc_http_init_p(void) +{ + int ret; + +#ifdef WEARABLE + if (g_internet_supported == false) { + ret = http_init(); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } +#endif + ret = http_deinit(); + assert_eq(ret, TIZEN_ERROR_NONE); + ret = http_init(); + assert_eq(ret, TIZEN_ERROR_NONE); + + return 0; +} +/** * @testcase utc_http_sesssion_create_p * @since_tizen 3.0 * @type Positive @@ -2427,6 +2475,141 @@ int utc_http_transaction_open_authentication_p(void) } /** + * @testcase utc_http_transaction_resume_n + * @since_tizen 3.0 + * @type Negative + * @description Resumes the transaction. + * @scenario Invoking http_transaction_resume with invalid parameter. + */ +int utc_http_transaction_resume_n(void) +{ + int ret; + +#ifdef WEARABLE + if (g_internet_supported == false) { + ret = http_transaction_resume(NULL); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } +#endif + ret = http_transaction_resume(NULL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_http_transaction_pause_n + * @since_tizen 3.0 + * @type Negative + * @description Pauses the transaction. + * @scenario Invoking http_transaction_pause with invalid parameter. + */ +int utc_http_transaction_pause_n(void) +{ + int ret; + +#ifdef WEARABLE + if (g_internet_supported == false) { + ret = http_transaction_pause(NULL, HTTP_PAUSE_ALL); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } +#endif + ret = http_transaction_pause(NULL, HTTP_PAUSE_ALL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_http_transaction_response_get_status_text_n + * @since_tizen 3.0 + * @type Negative + * @description Gets the HTTP status text from HTTP Response. + * @scenario Invoking http_transaction_response_get_status_text with invalid parameter. + */ +int utc_http_transaction_response_get_status_text_n(void) +{ + int ret; + char *status_text; + +#ifdef WEARABLE + if (g_internet_supported == false) { + ret = http_transaction_response_get_status_text(NULL, &status_text); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } +#endif + ret = http_transaction_response_get_status_text(NULL, &status_text); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + ret = http_transaction_response_get_status_text(transaction, NULL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + ret = http_transaction_response_get_status_text(NULL, NULL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_http_transaction_response_get_version_n + * @since_tizen 3.0 + * @type Negative + * @description Gets the HTTP version from HTTP Response. + * @scenario Invoking http_transaction_response_get_version with invalid parameter. + */ +int utc_http_transaction_response_get_version_n(void) +{ + int ret; + http_version_e version; + +#ifdef WEARABLE + if (g_internet_supported == false) { + ret = http_transaction_response_get_version(NULL, &version); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } +#endif + ret = http_transaction_response_get_version(NULL, &version); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + ret = http_transaction_response_get_version(transaction, NULL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + ret = http_transaction_response_get_version(NULL, NULL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_http_transaction_get_realm_n + * @since_tizen 3.0 + * @type Negative + * @description Gets the HTTP authentication realm. + * @scenario Invoking http_transaction_get_realm with invalid parameter. + */ +int utc_http_transaction_get_realm_n(void) +{ + int ret; + char *realm; + +#ifdef WEARABLE + if (g_internet_supported == false) { + ret = http_transaction_get_realm(NULL, &realm); + assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED); + return 0; + } +#endif + ret = http_transaction_get_realm(NULL, &realm); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + ret = http_transaction_get_realm(transaction, NULL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + ret = http_transaction_get_realm(NULL, NULL); + assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** * @testcase utc_http_transaction_submit_n * @since_tizen 3.0 * @type Negative -- 2.7.4