From dbb6e1d5220ae6b468e1cbd877f14a40c661c19b Mon Sep 17 00:00:00 2001 From: "gaurav.m2" Date: Mon, 27 Jun 2016 14:13:26 +0530 Subject: [PATCH] [ITC][http][ACR-548,663,675][Added new module] Change-Id: I52c740b767d4f182b02bd7f0bb6fb80d38e276ed Signed-off-by: gaurav.m2 --- packaging/itc/native-http-itc.spec | 66 ++ packaging/itc/native-http-itc.xml | 12 + src/itc/http/CMakeLists.txt | 38 + src/itc/http/ITs-http-common.c | 73 ++ src/itc/http/ITs-http-common.h | 97 +++ src/itc/http/ITs-http-transaction.c | 1239 +++++++++++++++++++++++++++++++ src/itc/http/ITs-http.c | 424 +++++++++++ src/itc/http/tct-http-native.c | 143 ++++ src/itc/http/tct-http-native_mobile.h | 90 +++ src/itc/http/tct-http-native_tv.h | 92 +++ src/itc/http/tct-http-native_wearable.h | 92 +++ 11 files changed, 2366 insertions(+) create mode 100755 packaging/itc/native-http-itc.spec create mode 100755 packaging/itc/native-http-itc.xml create mode 100755 src/itc/http/CMakeLists.txt create mode 100755 src/itc/http/ITs-http-common.c create mode 100755 src/itc/http/ITs-http-common.h create mode 100755 src/itc/http/ITs-http-transaction.c create mode 100755 src/itc/http/ITs-http.c create mode 100755 src/itc/http/tct-http-native.c create mode 100755 src/itc/http/tct-http-native_mobile.h create mode 100755 src/itc/http/tct-http-native_tv.h create mode 100755 src/itc/http/tct-http-native_wearable.h diff --git a/packaging/itc/native-http-itc.spec b/packaging/itc/native-http-itc.spec new file mode 100755 index 0000000..b2b3e87 --- /dev/null +++ b/packaging/itc/native-http-itc.spec @@ -0,0 +1,66 @@ +%define MODULE_NAME http +%define MODULE_LIBNAME capi-network-http +Name: native-%{MODULE_NAME}-itc +Summary: Native API Integration TC (%{name}) +Version: 0.1 +Release: 0 +Group: Development/Tools +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +BuildRequires: pkgconfig(%{MODULE_LIBNAME}) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: cmake +BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(capi-system-info) + +%description +Native API Integration TC (%{name}) + +%prep +%setup -q + +%build + +%define PREFIX "%{_libdir}/%{name}" + +export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed" + +%if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 +cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DCMAKE_INSTALL_PREFIX=%{_prefix} +%endif + +%if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 +cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DCMAKE_INSTALL_PREFIX=%{_prefix} +%endif + +%if %{?DEVICE_BUILD_TYPE_TV:1}0 +cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DCMAKE_INSTALL_PREFIX=%{_prefix} +%endif + +%if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0 +cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DCMAKE_INSTALL_PREFIX=%{_prefix} +%endif + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install +mkdir -p %{buildroot}/usr/share/license +cp LICENSE %{buildroot}/usr/share/license/%{name} + +mkdir -p %{buildroot}/usr/share/packages/ +cp packaging/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/ +mkdir -p %{buildroot}%{APP_PATH}%{name}/bin +%post + +%postun + + +%files +%{APP_PATH}%{name}/* +/usr/share/packages/native-%{MODULE_NAME}-itc.xml +/usr/share/license/%{name} diff --git a/packaging/itc/native-http-itc.xml b/packaging/itc/native-http-itc.xml new file mode 100755 index 0000000..683440e --- /dev/null +++ b/packaging/itc/native-http-itc.xml @@ -0,0 +1,12 @@ + + + + test + Native API test Application + + + + http://tizen.org/privilege/internet + http://tizen.org/privilege/network.get + + diff --git a/src/itc/http/CMakeLists.txt b/src/itc/http/CMakeLists.txt new file mode 100755 index 0000000..8766698 --- /dev/null +++ b/src/itc/http/CMakeLists.txt @@ -0,0 +1,38 @@ +SET(PKG_NAME "http") + +SET(EXEC_NAME "tct-${PKG_NAME}-native") +SET(RPM_NAME "native-${PKG_NAME}-itc") + +SET(CAPI_LIB "capi-network-http") +SET(TC_SOURCES + ITs-http-common.c + ITs-http.c + ITs-http-transaction.c +) + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + ${CAPI_LIB} + capi-appfw-application + glib-2.0 + bundle + capi-system-info + dlog + elementary +) + +INCLUDE_DIRECTORIES( + ${${CAPI_LIB}_INCLUDE_DIRS} +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + bundle +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${RPM_NAME}/bin +) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie") diff --git a/src/itc/http/ITs-http-common.c b/src/itc/http/ITs-http-common.c new file mode 100755 index 0000000..d6837fb --- /dev/null +++ b/src/itc/http/ITs-http-common.c @@ -0,0 +1,73 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "ITs-http-common.h" + +/** @addtogroup itc-http +* @ingroup itc +* @{ +*/ + +//Add helper function definitions here + +/** +* @function HttpGetError +* @description Maps error enumerators to string values +* @parameter nRet : error code returned +* @return error string +*/ +char* HttpGetError(int nRet) +{ + char *szErrorVal = NULL; + + switch ( nRet ) + { + case HTTP_ERROR_NONE: szErrorVal = "HTTP_ERROR_NONE"; break; + case HTTP_ERROR_OUT_OF_MEMORY: szErrorVal = "HTTP_ERROR_OUT_OF_MEMORY"; break; + case HTTP_ERROR_PERMISSION_DENIED: szErrorVal = "HTTP_ERROR_PERMISSION_DENIED"; break; + case HTTP_ERROR_INVALID_PARAMETER: szErrorVal = "HTTP_ERROR_INVALID_PARAMETER"; break; + case HTTP_ERROR_INVALID_OPERATION: szErrorVal = "HTTP_ERROR_INVALID_OPERATION"; break; + case HTTP_ERROR_OPERATION_FAILED: szErrorVal = "HTTP_ERROR_OPERATION_FAILED"; break; + case HTTP_ERROR_COULDNT_RESOLVE_HOST: szErrorVal = "HTTP_ERROR_COULDNT_RESOLVE_HOST"; break; + case HTTP_ERROR_COULDNT_CONNECT: szErrorVal = "HTTP_ERROR_COULDNT_CONNECT"; break; + case HTTP_ERROR_OPERATION_TIMEDOUT: szErrorVal = "HTTP_ERROR_OPERATION_TIMEDOUT"; break; + case HTTP_ERROR_SSL_CONNECT_ERROR: szErrorVal = "HTTP_ERROR_SSL_CONNECT_ERROR"; break; + case HTTP_ERROR_NOT_SUPPORTED: szErrorVal = "HTTP_ERROR_NOT_SUPPORTED"; break; + default: szErrorVal = "Unknown Error"; break; + } + return szErrorVal; +} + + +/** +* @function httpTimeout +* @description Called if some callback is not invoked for a particular timeout +* @parameter gpointer data +* @return gboolean +*/ +gboolean httpTimeout(gpointer data) +{ + GMainLoop *pMainLoop = NULL; + pMainLoop = (GMainLoop *)data; + if ( pMainLoop != NULL ) + { + g_main_loop_quit(pMainLoop); + } + FPRINTF("[Line : %d][%s] Callback Timeout\\n", __LINE__, API_NAMESPACE); + return false; +} + +/** @} */ + diff --git a/src/itc/http/ITs-http-common.h b/src/itc/http/ITs-http-common.h new file mode 100755 index 0000000..c430818 --- /dev/null +++ b/src/itc/http/ITs-http-common.h @@ -0,0 +1,97 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef _ITS_HTTP_COMMON_H_ +#define _ITS_HTTP_COMMON_H_ + +//Add test package related includes here +#include "tct_common.h" +#include +#include +#include +#include +#include + +#define API_NAMESPACE "HTTP_ITC" +#define MICROSECONDS_PER_SECOND 1000000 +#define MINCOUNT 1 +#define TIMEOUT_CB 30000 +#define HTTP_FEATURE "http://tizen.org/feature/network.internet" + +GMainLoop *g_pHttpMainLoop; +bool g_bFeatureUnsupported; +bool g_bHttpInit; +bool g_bCallbackHit; + +#ifdef WEARABLE +#define START_TEST {\ + FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\ + if(g_bFeatureUnsupported)\ + {\ + FPRINTF("[Line : %d][%s] Leaving test\\n", __LINE__, API_NAMESPACE);\ + return 0;\ + }\ + if ( !g_bHttpInit )\ + {\ + FPRINTF("[Line : %d][%s] Iotcon connection failed , Leaving test\\n", __LINE__, API_NAMESPACE);\ + return 1;\ + }\ +} +#else +#define START_TEST {\ + FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\ + if ( !g_bHttpInit )\ +{\ + FPRINTF("[Line : %d][%s] Precondition of http failed so leaving test\\n", __LINE__, API_NAMESPACE);\ + return 1;\ +}\ +} +#endif + +#define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\ + if ( Handle == NULL )\ +{\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + FreeResource;\ + return 1;\ +}\ +} + +#define RUN_POLLING_LOOP {\ + if ( !g_bCallbackHit )\ +{\ + g_pHttpMainLoop = g_main_loop_new(NULL, false);\ + nTimeoutId = g_timeout_add(TIMEOUT_CB, httpTimeout, g_pHttpMainLoop);\ + g_main_loop_run(g_pHttpMainLoop);\ + g_source_remove(nTimeoutId);\ + g_pHttpMainLoop = NULL;\ +}\ +} + + +/** @addtogroup itc-%{MODULE_NAME} +* @ingroup itc +* @{ +*/ + +//Add helper function declarations here + + + +gboolean httpTimeout(gpointer data); +char* HttpGetError(int nRet); + +/** @} */ +#endif //_ITS_HTTP_COMMON_H_ diff --git a/src/itc/http/ITs-http-transaction.c b/src/itc/http/ITs-http-transaction.c new file mode 100755 index 0000000..980e277 --- /dev/null +++ b/src/itc/http/ITs-http-transaction.c @@ -0,0 +1,1239 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "ITs-http-common.h" + +http_session_h g_hHttpSession; +http_transaction_h g_hHttpTransaction; +bool b_HttpTransactionHeaderCB = false; +bool b_HttpTransactionBodyCB = false; +bool b_HttpTransactionWriteCB = false; +bool b_HttpTransactionCompletedCB = false; +bool b_HttpTransactionProgressCB = false; + +//& set: Http + +/** @addtogroup itc-http +* @ingroup itc +* @{ +*/ + + +/** +* @function HttpTransactionHeaderCB +* @description Called when the http header is received +* @parameter http_transaction_h, char *header, size_t header_len, void *user_data +* @return NA +*/ +static void HttpTransactionHeaderCB(http_transaction_h http_transaction, char *header, size_t header_len, void *user_data) +{ + + FPRINTF("[Line : %d][%s] HttpTransactionHeaderCB callback called\\n", __LINE__, API_NAMESPACE); + + b_HttpTransactionHeaderCB = true; + + g_bCallbackHit = true; + + if ( g_pHttpMainLoop ) + { + g_main_loop_quit(g_pHttpMainLoop); + } + + return; +} + +/** +* @function HttpTransactionBodyCB +* @description Called when the http response is received +* @parameter http_transaction_h, char *body, size_t header_len, void *user_data +* @return NA +*/ +static void HttpTransactionBodyCB(http_transaction_h http_transaction, char *body, size_t size, size_t count, void *user_data) +{ + + FPRINTF("[Line : %d][%s] HttpTransactionBodyCB callback called\\n", __LINE__, API_NAMESPACE); + + b_HttpTransactionBodyCB = true; + + g_bCallbackHit = true; + + if ( g_pHttpMainLoop ) + { + g_main_loop_quit(g_pHttpMainLoop); + } + + return; +} + +/** +* @function HttpTransactionWriteCB +* @description Called when the http ready to write event is received +* @parameter http_transaction_h, int recommended_chunk_size, void *user_data +* @return NA +*/ +static void HttpTransactionWriteCB(http_transaction_h http_transaction, int recommended_chunk_size, void *user_data) +{ + + FPRINTF("[Line : %d][%s] HttpTransactionWriteCB callback called\\n", __LINE__, API_NAMESPACE); + + +b_HttpTransactionWriteCB = true; + + g_bCallbackHit = true; + + if ( g_pHttpMainLoop ) + { + g_main_loop_quit(g_pHttpMainLoop); + } + + return; +} + +/** +* @function HttpTransactionCompletedCB +* @description Called when the http transaction is completed +* @parameter http_transaction_h, void *user_data +* @return NA +*/ +static void HttpTransactionCompletedCB(http_transaction_h transaction, void *user_data) +{ + + FPRINTF("[Line : %d][%s] HttpTransactionCompletedCB callback called\\n", __LINE__, API_NAMESPACE); + b_HttpTransactionCompletedCB = true; + g_bCallbackHit = true; + + if ( g_pHttpMainLoop ) + { + g_main_loop_quit(g_pHttpMainLoop); + } + + return; +} + +/** +* @function HttpTransactionProgressCB +* @description Called to notify when the content body of the response message is being downloaded or uploaded +* @parameter http_transaction_h http_transaction, double download_total, double download_now, double upload_total, double upload_now, void *user_data +* @return NA +*/ +static void HttpTransactionProgressCB(http_transaction_h http_transaction, double download_total, double download_now, double upload_total, double upload_now, void *user_data) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] HttpTransactionProgressCB callback called\\n", __LINE__, API_NAMESPACE); +#endif + b_HttpTransactionProgressCB = true; + g_bCallbackHit = true; + + if ( g_pHttpMainLoop ) + { + g_main_loop_quit(g_pHttpMainLoop); + } + + return; +} + +/** + * @function ITs_http_startup + * @description Called before each test + * @parameter NA + * @return NA + */ +void ITs_http_transaction_startup(void) +{ + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } + g_bHttpInit = true; + g_bFeatureUnsupported = false; + + int nRet = http_init(); + +#ifdef WEARABLE + if ( !TCTCheckSystemInfoFeatureSupported(HTTP_FEATURE, API_NAMESPACE) ) + { + + if ( nRet != TIZEN_ERROR_NOT_SUPPORTED ) + { + FPRINTF("[Line : %d][%s] http_init API call returned mismatch %s error for unsupported feature\\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + g_bHttpInit = false; + } + else + { + FPRINTF("[Line : %d][%s] http_init API call correctly returned %s error for unsupported feature\\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + g_bFeatureUnsupported = true; + } + return; + } +#endif + + if ( nRet != HTTP_ERROR_NONE ) + { + FPRINTF("[Line : %d][%s] http_init failed API return %s error \\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + g_bHttpInit = false; + return; + } + + nRet = http_session_create(HTTP_SESSION_MODE_NORMAL, &g_hHttpSession); + if( nRet != HTTP_ERROR_NONE ) + { + FPRINTF("[Line : %d][%s] http_session_create failed API return %s error \\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + g_bHttpInit = false; + return; + } + + if(g_hHttpSession == NULL) + { + FPRINTF("[Line : %d][%s] http_session_create failed g_hHttpSession is NULL \\n", __LINE__, API_NAMESPACE); + g_bHttpInit = false; + return; + } + + nRet = http_session_open_transaction(g_hHttpSession, HTTP_METHOD_GET, &g_hHttpTransaction); + if( nRet != HTTP_ERROR_NONE ) + { + FPRINTF("[Line : %d][%s] http_session_create failed API return %s error \\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + g_bHttpInit = false; + return; + } + if(g_hHttpTransaction == NULL) + { + FPRINTF("[Line : %d][%s] g_hHttpTransaction handle is null \\n", __LINE__, API_NAMESPACE); + g_bHttpInit = false; + return; + } + return; +} + + +/** + * @function ITs_http_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ +void ITs_http_transaction_cleanup(void) +{ + int nRet = 0; + if(g_hHttpTransaction != NULL) + { + nRet = http_transaction_destroy(g_hHttpTransaction); + if (nRet != HTTP_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] http_transaction_destroy failed API return %s error \\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + } + g_hHttpTransaction = NULL; + } + + if(g_hHttpSession != NULL) + { + nRet = http_session_destroy(g_hHttpSession); + if (nRet != HTTP_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] http_session_destroy failed API return %s error \\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + } + g_hHttpSession = NULL; + } + + nRet = http_deinit(); + if (nRet != HTTP_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] http_deinit failed API return %s error \\n", __LINE__, API_NAMESPACE, HttpGetError(nRet)); + } + + return; +} + +/** @addtogroup itc-http-testcases +* @brief Integration testcases for module http +* @ingroup itc-http +* @{ +*/ + +//& purpose: Registers and submit callback called when receive header +//& type: auto +/** +* @testcase ITc_http_transaction_register_callbacks_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Registers and submit callback called when receive header +* @scenario call http_transaction_set_received_header_cb +* @apicovered http_transaction_set_received_header_cb +* @passcase When http_transaction_set_received_header_cb is successful. +* @failcase If API http_transaction_set_received_header_cb fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_register_callbacks_p(void) +{ + START_TEST; + int nTimeoutId = 0; + g_bCallbackHit = false; + http_method_e method; + const char uri[100] = "http://www.google.com"; + http_transaction_h transaction = NULL; + b_HttpTransactionHeaderCB = false; + b_HttpTransactionBodyCB = false; + b_HttpTransactionWriteCB = false; + b_HttpTransactionCompletedCB = false; + b_HttpTransactionProgressCB = false; + + int nRet = http_session_open_transaction(g_hHttpSession, HTTP_METHOD_GET, &transaction); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_session_open_transaction", HttpGetError(nRet)); + CHECK_HANDLE(transaction,"http_session_open_transaction"); + + nRet = http_transaction_request_get_method(transaction, &method); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_request_get_method", HttpGetError(nRet),http_transaction_destroy(transaction)); + + nRet = http_transaction_request_set_uri(transaction, uri); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_request_set_uri", HttpGetError(nRet),http_transaction_destroy(transaction)); + + //Target API + nRet = http_transaction_set_received_header_cb(transaction, HttpTransactionHeaderCB, NULL); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_set_received_header_cb", HttpGetError(nRet),http_transaction_destroy(transaction)); + + //Target API + nRet = http_transaction_set_received_body_cb(transaction, HttpTransactionBodyCB, NULL); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_set_received_body_cb", HttpGetError(nRet),http_transaction_destroy(transaction)); + + //Target API + nRet = http_transaction_set_completed_cb(transaction, HttpTransactionCompletedCB, NULL); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_set_completed_cb", HttpGetError(nRet),http_transaction_destroy(transaction)); + + //Target API + nRet = http_transaction_submit(transaction); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_submit", HttpGetError(nRet),http_transaction_destroy(transaction)); + + RUN_POLLING_LOOP; + + http_transaction_destroy(transaction); + + if ( b_HttpTransactionHeaderCB == false ) + { + FPRINTF("[Line : %d][%s] b_HttpTransactionHeaderCB failed\\n", __LINE__, API_NAMESPACE); + return 1; + } + if ( b_HttpTransactionBodyCB == false ) + { + FPRINTF("[Line : %d][%s] b_HttpTransactionBodyCB failed\\n", __LINE__, API_NAMESPACE); + return 1; + } + if ( b_HttpTransactionCompletedCB == false ) + { + FPRINTF("[Line : %d][%s] b_HttpTransactionCompletedCB failed\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose:Registers callback called when write data +//& type: auto +/** +* @testcase ITc_http_transaction_set_uploaded_cb_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Registers callback called when write data +* @scenario call http_transaction_set_uploaded_cb +* @apicovered http_transaction_set_uploaded_cb +* @passcase When http_transaction_set_uploaded_cb is successful. +* @failcase If API http_transaction_set_uploaded_cb fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_uploaded_cb_p(void) +{ + START_TEST; + int nTimeoutId = 0; + g_bCallbackHit = false; + + const char pField[20] = "Content-Length"; + const char pValue[10] = "10"; + const char uri[100] = "http://www.tizen.org"; + const char pBody[100] = "body data"; + char *pHostUri = NULL; + + int nRet = http_transaction_header_add_field(g_hHttpTransaction, pField, pValue); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_header_add_field", HttpGetError(nRet)); + + nRet = http_transaction_request_set_uri(g_hHttpTransaction, uri); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_request_set_uri", HttpGetError(nRet)); + + nRet = http_transaction_request_write_body(g_hHttpTransaction, pBody); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_request_write_body", HttpGetError(nRet)); + + nRet = http_transaction_request_get_uri(g_hHttpTransaction, &pHostUri); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_request_get_uri", HttpGetError(nRet)); + + //Target API + nRet = http_transaction_set_uploaded_cb(g_hHttpTransaction, HttpTransactionWriteCB, NULL); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_set_uploaded_cb", HttpGetError(nRet),FREE_MEMORY(pHostUri)); + + nRet = http_transaction_submit(g_hHttpTransaction); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_submit", HttpGetError(nRet),FREE_MEMORY(pHostUri)); + RUN_POLLING_LOOP; + + if ( g_bCallbackHit == false ) + { + FPRINTF("[Line : %d][%s] HttpTransactionWriteCB failed\\n", __LINE__, API_NAMESPACE); + FREE_MEMORY(pHostUri); + return 1; + } + + nRet = http_transaction_header_remove_field(g_hHttpTransaction, pField) ; + PRINT_RESULT_NORETURN(HTTP_ERROR_NONE, nRet, "http_transaction_header_remove_field", HttpGetError(nRet)); + + FREE_MEMORY(pHostUri); + + return 0; +} + +//& purpose: Registers callback that is called when data is uploaded/downloaded +//& type: auto +/** +* @testcase ITc_http_transaction_set_progress_cb_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Registers callback that is called when data is uploaded/downloaded +* @scenario call http_transaction_set_progress_cb +* @apicovered http_transaction_set_progress_cb +* @passcase When http_transaction_set_progress_cb is successful. +* @failcase If API http_transaction_set_progress_cb fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_progress_cb_p(void) +{ + START_TEST; + int nTimeoutId = 0; + g_bCallbackHit = false; + + const char pField[20] = "Content-Length"; + const char pValue[10] = "10"; + const char uri[100] = "http://www.tizen.org"; + const char pBody[100] = "body data"; + + int nRet = http_transaction_header_add_field(g_hHttpTransaction, pField, pValue); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_header_add_field", HttpGetError(nRet)); + + nRet = http_transaction_request_set_uri(g_hHttpTransaction, uri); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_request_set_uri", HttpGetError(nRet)); + + nRet = http_transaction_request_write_body(g_hHttpTransaction, pBody); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_request_write_body", HttpGetError(nRet)); + + //Target API + nRet = http_transaction_set_progress_cb(g_hHttpTransaction, HttpTransactionProgressCB, NULL); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_set_progress_cb", HttpGetError(nRet)); + + nRet = http_transaction_submit(g_hHttpTransaction); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_submit", HttpGetError(nRet)); + RUN_POLLING_LOOP; + + if ( g_bCallbackHit == false ) + { + FPRINTF("[Line : %d][%s] HttpTransactionProgressCB failed\\n", __LINE__, API_NAMESPACE); + return 1; + } + + nRet = http_transaction_header_remove_field(g_hHttpTransaction, pField) ; + PRINT_RESULT_NORETURN(HTTP_ERROR_NONE, nRet, "http_transaction_header_remove_field", HttpGetError(nRet)); + + return 0; +} + +//& purpose: Sets/Gets the timeout in seconds that is the timeout for waiting the transaction +//& type: auto +/** +* @testcase ITc_http_transaction_set_get_timeout_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Sets/Gets the timeout in seconds that is the timeout for waiting the transaction +* @scenario call http_transaction_set_timeout, http_transaction_get_timeout +* @apicovered http_transaction_set_timeout, http_transaction_get_timeout +* @passcase When http_transaction_set_timeout, http_transaction_get_timeout is successful. +* @failcase If API http_transaction_set_timeout, http_transaction_get_timeout fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_get_timeout_p(void) +{ + START_TEST; + + int nTimeout = 10; + int nGetTimout = -1; + + //Target API + int nRet = http_transaction_set_timeout(g_hHttpTransaction, nTimeout); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_set_timeout", HttpGetError(nRet)); + + //Target API + nRet = http_transaction_get_timeout(g_hHttpTransaction, &nGetTimout); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_get_timeout", HttpGetError(nRet)); + + if( nTimeout != nGetTimout) + { + FPRINTF("[Line : %d][%s] nGetTimout value not set!! \\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Sets ready to write event for a transaction +//& type: auto +/** +* @testcase ITc_http_transaction_set_ready_to_write_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Sets ready to write event for a transaction +* @scenario call http_transaction_set_ready_to_write +* @apicovered http_transaction_set_ready_to_write +* @passcase When http_transaction_set_ready_to_write is successful. +* @failcase If API http_transaction_set_ready_to_write fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_ready_to_write_p(void) +{ + START_TEST; + + bool bReadyToWrite = true; + + //Target API + int nRet = http_transaction_set_ready_to_write(g_hHttpTransaction, bReadyToWrite); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_set_ready_to_write", HttpGetError(nRet)); + + return 0; +} + +//& purpose: Sets/Gets the interface name +//& type: auto +/** +* @testcase ITc_http_transaction_set_get_interface_name_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Sets/Gets the interface name +* @scenario call http_transaction_set_interface_name , http_transaction_get_interface_name +* @apicovered http_transaction_set_interface_name, http_transaction_get_interface_name +* @passcase When http_transaction_set_interface_name, http_transaction_get_interface_name is successful. +* @failcase If API http_transaction_set_interface_name, http_transaction_get_interface_name fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_get_interface_name_p(void) +{ + START_TEST; + + const char pInterfaceName[10] = "wlan0"; + char *pGetInterfaceName; + + //Target API + int nRet = http_transaction_set_interface_name(g_hHttpTransaction, pInterfaceName); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_set_interface_name", HttpGetError(nRet)); + + //Target API + nRet = http_transaction_get_interface_name(g_hHttpTransaction, &pGetInterfaceName); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_get_interface_name", HttpGetError(nRet)); + + if ( strcmp( pGetInterfaceName, pInterfaceName ) != 0 ) + { + FPRINTF("[Line : %d][%s] pGetInterfaceName in http_transaction_get_interface_name is not same, as set\\n", __LINE__, API_NAMESPACE); + FREE_MEMORY(pGetInterfaceName); + return 1; + } + FREE_MEMORY(pGetInterfaceName); + + return 0; +} + +//& purpose: Sets/Gets the flag to verify a server certificate +//& type: auto +/** +* @testcase ITc_http_transaction_set_get_server_certificate_verification_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Sets/Gets the flag to verify a server certificate +* @scenario call http_transaction_set_server_certificate_verification, http_transaction_get_server_certificate_verification +* @apicovered http_transaction_set_server_certificate_verification, http_transaction_get_server_certificate_verification +* @passcase When http_transaction_set_server_certificate_verification, http_transaction_get_server_certificate_verification is successful. +* @failcase If API http_transaction_set_server_certificate_verification, http_transaction_get_server_certificate_verification fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_get_server_certificate_verification_p(void) +{ + START_TEST; + + bool bVerify = true; + bool bGetVerify = false; + + //Target API + int nRet = http_transaction_set_server_certificate_verification(g_hHttpTransaction, bVerify); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_set_server_certificate_verification", HttpGetError(nRet)); + + //Target API + nRet = http_transaction_get_server_certificate_verification(g_hHttpTransaction, &bGetVerify); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_get_server_certificate_verification", HttpGetError(nRet)); + + if ( bGetVerify != bVerify ) + { + FPRINTF("[Line : %d][%s] bGetVerify in http_transaction_get_server_certificate_verification is not same, as set\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Pauses/resume the transaction +//& type: auto +/** +* @testcase ITc_http_transaction_pause_resume_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Pauses/resume the transaction +* @scenario call http_transaction_pause, http_transaction_resume +* @apicovered http_transaction_pause, http_transaction_resume +* @passcase When http_transaction_pause, http_transaction_resume is successful. +* @failcase If API http_transaction_pause, http_transaction_resume fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_pause_resume_p(void) +{ + + START_TEST; + int nTimeoutId = 0; + int nRet; + http_transaction_h transaction; + const char* post_msg = "name=tizen&project=capi-network-curl"; + const char pField[20] = "Content-Length"; + const char pValue[10] = "10"; + b_HttpTransactionWriteCB = false; + + nRet = http_session_open_transaction(g_hHttpSession, HTTP_METHOD_POST, &transaction); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_session_open_transaction", HttpGetError(nRet)); + CHECK_HANDLE(transaction,"http_session_open_transaction"); + + nRet = http_transaction_request_set_uri(transaction, "http://posttestserver.com/post.php"); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_request_set_uri", HttpGetError(nRet),http_transaction_destroy(transaction)); + + nRet = http_transaction_set_ready_to_write(transaction, TRUE); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_set_ready_to_write", HttpGetError(nRet),http_transaction_destroy(transaction)); + + http_transaction_request_write_body(transaction, post_msg); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_request_write_body", HttpGetError(nRet),http_transaction_destroy(transaction)); + + http_transaction_header_add_field(transaction, pField, pValue); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_header_add_field", HttpGetError(nRet),http_transaction_destroy(transaction)); + + //Target API + nRet = http_transaction_set_uploaded_cb(g_hHttpTransaction, HttpTransactionWriteCB, NULL); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_set_uploaded_cb", HttpGetError(nRet),http_transaction_destroy(transaction)); + + nRet = http_transaction_submit(transaction); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_submit", HttpGetError(nRet),http_transaction_destroy(transaction)); + + RUN_POLLING_LOOP; + if ( b_HttpTransactionWriteCB == false ) + { + FPRINTF("[Line : %d][%s] b_HttpTransactionWriteCB failed\\n", __LINE__, API_NAMESPACE); + http_transaction_destroy(transaction); + return 1; + } + + //Target API + nRet = http_transaction_pause(g_hHttpTransaction, HTTP_PAUSE_ALL); + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_pause", HttpGetError(nRet),http_transaction_destroy(transaction)); + + //Target API + nRet = http_transaction_resume(g_hHttpTransaction) ; + PRINT_RESULT_CLEANUP(HTTP_ERROR_NONE, nRet, "http_transaction_resume", HttpGetError(nRet),http_transaction_destroy(transaction)); + + nRet = http_transaction_destroy(transaction); + PRINT_RESULT_NORETURN(HTTP_ERROR_NONE, nRet, "http_transaction_destroy", HttpGetError(nRet)); + + return 0; +} +//& purpose: Gets the Http Header Field value from custom header +//& type: auto +/** +* @testcase ITc_http_transaction_header_add_remove_field_p +* @since_tizen 3.0 +* @author SRID(shilpa.j) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Gets the Http Header Field value from custom header +* @scenario call http_transaction_header_add_field and http_transaction_header_remove_field +* @apicovered http_transaction_header_add_field .http_transaction_header_remove_field +* @passcase When http_transaction_header_add_field and http_transaction_header_remove_field is successful. +* @failcase If API http_transaction_header_add_field or http_transaction_header_remove_field fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_header_add_remove_field_p(void) +{ + START_TEST; + + const char szfield[20] = "Content-Length"; + const char szvalue[10] = "10"; + + //Target API + int nRet = http_transaction_header_add_field(g_hHttpTransaction,szfield,szvalue); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_header_add_field", HttpGetError(nRet)); + + //Target API + nRet = http_transaction_header_remove_field(g_hHttpTransaction, szfield); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_header_remove_field", HttpGetError(nRet)); + + return 0; +} + +//& purpose: Gets & Sets an HTTP method of the request header. +//& type: auto +/** +* @testcase ITc_http_transaction_request_set_get_method_p +* @since_tizen 3.0 +* @author SRID(shilpa.j) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Sets and gets HTTP method of the request header. +* @scenario call http_transaction_request_set_method and http_transaction_request_get_method +* @apicovered http_transaction_request_set_method ,http_transaction_request_get_method +* @passcase When http_transaction_request_set_method and http_transaction_request_get_method is successful. +* @failcase If API http_transaction_request_set_method or http_transaction_request_get_method fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_request_set_get_method_p(void) +{ + START_TEST; + + http_method_e method; + + http_method_e eHttpMethodType[] = { + HTTP_METHOD_GET, + HTTP_METHOD_OPTIONS, + HTTP_METHOD_HEAD, + HTTP_METHOD_DELETE, + HTTP_METHOD_TRACE, + HTTP_METHOD_POST, + HTTP_METHOD_PUT, + HTTP_METHOD_CONNECT + }; + + int nEnumSize = sizeof(eHttpMethodType) / sizeof(eHttpMethodType[0]); + int nEnumCounter = 0; + + for ( nEnumCounter=0;nEnumCounter HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED ) + { + FPRINTF("[Line : %d][%s]http_transaction_response_get_status_code returned invalid value\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Gets the Http status text from Http Response. +//& type: auto +/** +* @testcase ITc_http_transaction_response_get_status_text_p +* @since_tizen 3.0 +* @author SRID(shilpa.j) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Gets the Http status text from Http Response +* @scenario call http_transaction_response_get_status_text +* @apicovered http_transaction_response_get_status_text +* @passcase When http_transaction_response_get_status_text . +* @failcase If API http_transaction_response_get_status_text fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_response_get_status_text_p(void) +{ + START_TEST; + + char *szText=NULL; + + //Target API + int nRet = http_transaction_response_get_status_text(g_hHttpTransaction, &szText); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_response_get_status_text", HttpGetError(nRet)); + CHECK_HANDLE(szText,"http_transaction_response_get_status_text"); + + FREE_MEMORY(szText); + + return 0; +} + +//& purpose: Gets the Http response version from Http Response. +//& type: auto +/** +* @testcase ITc_http_transaction_response_get_version_p +* @since_tizen 3.0 +* @author SRID(shilpa.j) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Gets the Http response version from Http Response. +* @scenario call http_transaction_response_get_status_code +* @apicovered http_transaction_response_get_status_code +* @passcase When http_transaction_response_get_status_code . +* @failcase If API http_transaction_response_get_status_code fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_response_get_version_p(void) +{ + START_TEST; + + http_version_e version; + + //Target API + int nRet = http_transaction_response_get_version(g_hHttpTransaction, &version); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_response_get_version", HttpGetError(nRet)); + + if( version < HTTP_VERSION_1_0 || version > HTTP_VERSION_1_1 ) + { + FPRINTF("[Line : %d][%s]http_transaction_response_get_version returned invalid value\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Opens HTTP transaction with authentication information. +//& type: auto +/** +* @testcase ITc_http_trasaction_open_authentication_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Opens HTTP transaction with authentication information. +* @scenario call http_transaction_open_authentication +* @apicovered http_transaction_open_authentication +* @passcase When http_transaction_open_authentication . +* @failcase If API http_transaction_open_authentication fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_trasaction_open_authentication_p(void) +{ + START_TEST; + + http_transaction_h h_HttpAuthTransaction; + + //Target API + int nRet = http_transaction_open_authentication(g_hHttpTransaction, &h_HttpAuthTransaction); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_open_authentication", HttpGetError(nRet)); + CHECK_HANDLE( h_HttpAuthTransaction, "http_transaction_open_authentication"); + + return 0; +} + +//& purpose: Sets/Gets an HTTP credentials +//& type: auto +/** +* @testcase ITc_http_transaction_set_get_credentials_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Invoking http_transaction_set_credentials with valid parameter. +* @scenario call http_transaction_set_credentials http_transaction_get_credentials +* @apicovered http_transaction_set_credentials and http_transaction_get_credentials +* @passcase When http_transaction_set_credentials and http_transaction_get_credentials. +* @failcase If API http_transaction_set_credentials or http_transaction_get_credentials fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_get_credentials_p(void) +{ + START_TEST; + + const char pUserName[10] = "tizen"; + const char pPassword[10] = "q1w2e3r4"; + char *pGetUserName; + char *pGetPassword; + + //Target API + int nRet = http_transaction_set_credentials(g_hHttpTransaction, pUserName, pPassword); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_set_credentials", HttpGetError(nRet)); + + //Target API + nRet = http_transaction_get_credentials(g_hHttpTransaction, &pGetUserName, &pGetPassword); + PRINT_RESULT(HTTP_ERROR_NONE, nRet, "http_transaction_get_credentials", HttpGetError(nRet)); + + if ( strcmp( pUserName, pGetUserName ) != 0 ) + { + FPRINTF("[Line : %d][%s] pGetUserName in http_transaction_get_credentials is not same, as set\\n", __LINE__, API_NAMESPACE); \ + FREE_MEMORY(pGetUserName); + FREE_MEMORY(pGetPassword); + return 1; + } + if ( strcmp( pPassword, pGetPassword ) != 0 ) + { + FPRINTF("[Line : %d][%s] pGetPassword in http_transaction_get_credentials is not same, as set\\n", __LINE__, API_NAMESPACE); + FREE_MEMORY(pGetUserName); + FREE_MEMORY(pGetPassword); + return 1; + } + FREE_MEMORY(pGetUserName); + FREE_MEMORY(pGetPassword); + + return 0; +} + +//& purpose: Sets/Gets an HTTP authentication scheme. +//& type: auto +/** +* @testcase ITc_http_transaction_set_get_http_auth_scheme_p +* @since_tizen 3.0 +* @author SRID(gaurav.m2) +* @reviewer SRID(a.pandia1) +* @type auto +* @description Sets/Gets an HTTP authentication scheme. +* @scenario call http_transaction_set_http_auth_scheme http_transaction_get_http_auth_scheme +* @apicovered http_transaction_set_http_auth_scheme and http_transaction_get_http_auth_scheme +* @passcase When http_transaction_set_http_auth_scheme and http_transaction_get_http_auth_scheme. +* @failcase If API http_transaction_set_http_auth_scheme or http_transaction_get_http_auth_scheme fails. +* @precondition http_session_open_transaction() should be successfully called +* @postcondition NA +*/ +int ITc_http_transaction_set_get_http_auth_scheme_p(void) +{ + START_TEST; + http_auth_scheme_e eGetAuthScheme; + + http_auth_scheme_e eAuthScheme[] = { + HTTP_AUTH_NONE, /**< No authentication type */ + HTTP_AUTH_PROXY_BASIC, /**< The authentication type is Proxy Basic Authentication */ + HTTP_AUTH_PROXY_MD5, /**< The authentication type is Proxy Digest Authentication */ + HTTP_AUTH_WWW_BASIC, /**< The authentication Type is HTTP Basic Authentication */ + HTTP_AUTH_WWW_MD5, /**< The authentication type is HTTP Digest Authentication */ + HTTP_AUTH_PROXY_NTLM, /**< The authentication type is Proxy NTLM Authentication */ + HTTP_AUTH_WWW_NTLM, /**< The authentication type is NTLM Authentication */ + HTTP_AUTH_WWW_NEGOTIATE /**< The authentication type is Negotiate Authentication */ + }; + + int nEnumSize = sizeof(eAuthScheme) / sizeof(eAuthScheme[0]); + int nEnumCounter = 0; + + for ( nEnumCounter=0;nEnumCounter +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +typedef struct appdata { + Evas_Object *win; + Evas_Object *conform; + Evas_Object *label; +} appdata_s; + +static bool app_create(void *data) +{ + return true; +} + +static void app_control(app_control_h app_control, void *data) +{ + char* pszGetTCName = NULL; + int i=0, result=0, nRet=0; + nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName); + if(nRet != APP_CONTROL_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName); + for ( i = 0; tc_array[i].name; i++ ) + { + if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) ) + { + if ( tc_array[i].startup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName); + tc_array[i].startup(); + } + + dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName); + result = tc_array[i].function(); + dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result); + + if ( tc_array[i].cleanup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName); + tc_array[i].cleanup(); + } + + PRINT_TC_RESULT("%d",result); + FREE_MEMORY_TC(pszGetTCName); + return; + } + } + + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; +} + +static void app_terminate(void *data) +{ + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__); +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + appdata_s ad = {0,}; + + ui_app_lifecycle_callback_s event_callback = {0,}; + event_callback.create = app_create; + event_callback.terminate = app_terminate; + event_callback.app_control = app_control; + + //setting gcda file location for coverage + setenv("GCOV_PREFIX","/tmp",1); + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__); + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__); + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret); + PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret); + PRINT_TC_RESULT("%d",1); + return ret; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__); + return ret; +} diff --git a/src/itc/http/tct-http-native_mobile.h b/src/itc/http/tct-http-native_mobile.h new file mode 100755 index 0000000..a81677f --- /dev/null +++ b/src/itc/http/tct-http-native_mobile.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef __TCT_HTTP_NATIVE_H__ +#define __TCT_HTTP_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +extern void ITs_http_startup(void); +extern void ITs_http_cleanup(void); +extern void ITs_http_transaction_startup(void); +extern void ITs_http_transaction_cleanup(void); + +extern int ITc_http_init_deinit_p(void); +extern int ITc_http_session_create_destroy_p(void); +extern int ITc_http_session_set_get_auto_redirection_p(void); +extern int ITc_http_session_get_active_transaction_count_p(void); +extern int ITc_http_session_get_max_transaction_count_p(void); +extern int ITc_http_session_open_destroy_transaction_p(void); +extern int ITc_http_session_destroy_all_transactions_p(void); +extern int ITc_http_transaction_register_callbacks_p(void); +extern int ITc_http_transaction_set_uploaded_cb_p(void); +extern int ITc_http_transaction_set_progress_cb_p(void); +extern int ITc_http_transaction_set_get_timeout_p(void); +extern int ITc_http_transaction_set_ready_to_write_p(void); +extern int ITc_http_transaction_set_get_interface_name_p(void); +extern int ITc_http_transaction_set_get_server_certificate_verification_p(void); +extern int ITc_http_transaction_pause_resume_p(void); +extern int ITc_http_transaction_header_add_remove_field_p(void); +extern int ITc_http_transaction_request_set_get_method_p(void); +extern int ITc_http_transaction_request_set_get_version_p(void); +extern int ITc_http_transaction_request_set_get_uri_p(void); +extern int ITc_http_transaction_request_set_get_accept_encoding_p(void); +extern int ITc_http_transaction_request_set_get_cookie_p(void); +extern int ITc_http_transaction_request_write_body_p(void); +extern int ITc_http_transaction_response_get_status_code_p(void); +extern int ITc_http_transaction_response_get_status_text_p(void); +extern int ITc_http_transaction_response_get_version_p(void); +extern int ITc_http_trasaction_open_authentication_p(void); +extern int ITc_http_transaction_set_get_credentials_p(void); +extern int ITc_http_transaction_set_get_http_auth_scheme_p(void); +extern int ITc_http_transaction_get_realm_p(void); + +testcase tc_array[] = { + {"ITc_http_init_deinit_p", ITc_http_init_deinit_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_create_destroy_p", ITc_http_session_create_destroy_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_set_get_auto_redirection_p", ITc_http_session_set_get_auto_redirection_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_get_active_transaction_count_p", ITc_http_session_get_active_transaction_count_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_get_max_transaction_count_p", ITc_http_session_get_max_transaction_count_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_open_destroy_transaction_p", ITc_http_session_open_destroy_transaction_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_destroy_all_transactions_p", ITc_http_session_destroy_all_transactions_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_transaction_register_callbacks_p", ITc_http_transaction_register_callbacks_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_uploaded_cb_p", ITc_http_transaction_set_uploaded_cb_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_progress_cb_p", ITc_http_transaction_set_progress_cb_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_timeout_p", ITc_http_transaction_set_get_timeout_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_ready_to_write_p", ITc_http_transaction_set_ready_to_write_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_interface_name_p", ITc_http_transaction_set_get_interface_name_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_server_certificate_verification_p", ITc_http_transaction_set_get_server_certificate_verification_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_pause_resume_p", ITc_http_transaction_pause_resume_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_header_add_remove_field_p", ITc_http_transaction_header_add_remove_field_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_method_p", ITc_http_transaction_request_set_get_method_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_version_p", ITc_http_transaction_request_set_get_version_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_uri_p", ITc_http_transaction_request_set_get_uri_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_accept_encoding_p", ITc_http_transaction_request_set_get_accept_encoding_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_cookie_p", ITc_http_transaction_request_set_get_cookie_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_write_body_p", ITc_http_transaction_request_write_body_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_status_code_p", ITc_http_transaction_response_get_status_code_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_status_text_p", ITc_http_transaction_response_get_status_text_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_version_p", ITc_http_transaction_response_get_version_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_trasaction_open_authentication_p", ITc_http_trasaction_open_authentication_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_credentials_p", ITc_http_transaction_set_get_credentials_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_http_auth_scheme_p", ITc_http_transaction_set_get_http_auth_scheme_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_get_realm_p", ITc_http_transaction_get_realm_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_HTTP_NATIVE_H__ diff --git a/src/itc/http/tct-http-native_tv.h b/src/itc/http/tct-http-native_tv.h new file mode 100755 index 0000000..537b933 --- /dev/null +++ b/src/itc/http/tct-http-native_tv.h @@ -0,0 +1,92 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef __TCT_HTTP_NATIVE_H__ +#define __TCT_HTTP_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + + +extern void ITs_http_startup(void); +extern void ITs_http_cleanup(void); +extern void ITs_http_transaction_startup(void); +extern void ITs_http_transaction_cleanup(void); + +extern int ITc_http_init_deinit_p(void); +extern int ITc_http_session_create_destroy_p(void); +extern int ITc_http_session_set_get_auto_redirection_p(void); +extern int ITc_http_session_get_active_transaction_count_p(void); +extern int ITc_http_session_get_max_transaction_count_p(void); +extern int ITc_http_session_open_destroy_transaction_p(void); +extern int ITc_http_session_destroy_all_transactions_p(void); +extern int ITc_http_transaction_register_callbacks_p(void); +extern int ITc_http_transaction_set_uploaded_cb_p(void); +extern int ITc_http_transaction_set_progress_cb_p(void); +extern int ITc_http_transaction_set_get_timeout_p(void); +extern int ITc_http_transaction_set_ready_to_write_p(void); +extern int ITc_http_transaction_set_get_interface_name_p(void); +extern int ITc_http_transaction_set_get_server_certificate_verification_p(void); +extern int ITc_http_transaction_pause_resume_p(void); +extern int ITc_http_transaction_header_add_remove_field_p(void); +extern int ITc_http_transaction_request_set_get_method_p(void); +extern int ITc_http_transaction_request_set_get_version_p(void); +extern int ITc_http_transaction_request_set_get_uri_p(void); +extern int ITc_http_transaction_request_set_get_accept_encoding_p(void); +extern int ITc_http_transaction_request_set_get_cookie_p(void); +extern int ITc_http_transaction_request_write_body_p(void); +extern int ITc_http_transaction_response_get_status_code_p(void); +extern int ITc_http_transaction_response_get_status_text_p(void); +extern int ITc_http_transaction_response_get_version_p(void); +extern int ITc_http_trasaction_open_authentication_p(void); +extern int ITc_http_transaction_set_get_credentials_p(void); +extern int ITc_http_transaction_set_get_http_auth_scheme_p(void); +extern int ITc_http_transaction_get_realm_p(void); + +testcase tc_array[] = { + {"ITc_http_init_deinit_p", ITc_http_init_deinit_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_create_destroy_p", ITc_http_session_create_destroy_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_set_get_auto_redirection_p", ITc_http_session_set_get_auto_redirection_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_get_active_transaction_count_p", ITc_http_session_get_active_transaction_count_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_get_max_transaction_count_p", ITc_http_session_get_max_transaction_count_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_open_destroy_transaction_p", ITc_http_session_open_destroy_transaction_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_destroy_all_transactions_p", ITc_http_session_destroy_all_transactions_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_transaction_register_callbacks_p", ITc_http_transaction_register_callbacks_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_uploaded_cb_p", ITc_http_transaction_set_uploaded_cb_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_progress_cb_p", ITc_http_transaction_set_progress_cb_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_timeout_p", ITc_http_transaction_set_get_timeout_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_ready_to_write_p", ITc_http_transaction_set_ready_to_write_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_interface_name_p", ITc_http_transaction_set_get_interface_name_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_server_certificate_verification_p", ITc_http_transaction_set_get_server_certificate_verification_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_pause_resume_p", ITc_http_transaction_pause_resume_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_header_add_remove_field_p", ITc_http_transaction_header_add_remove_field_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_method_p", ITc_http_transaction_request_set_get_method_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_version_p", ITc_http_transaction_request_set_get_version_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_uri_p", ITc_http_transaction_request_set_get_uri_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_accept_encoding_p", ITc_http_transaction_request_set_get_accept_encoding_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_cookie_p", ITc_http_transaction_request_set_get_cookie_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_write_body_p", ITc_http_transaction_request_write_body_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_status_code_p", ITc_http_transaction_response_get_status_code_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_status_text_p", ITc_http_transaction_response_get_status_text_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_version_p", ITc_http_transaction_response_get_version_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_trasaction_open_authentication_p", ITc_http_trasaction_open_authentication_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_credentials_p", ITc_http_transaction_set_get_credentials_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_http_auth_scheme_p", ITc_http_transaction_set_get_http_auth_scheme_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_get_realm_p", ITc_http_transaction_get_realm_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {NULL, NULL} +}; + + +#endif // __TCT_HTTP_NATIVE_H__ diff --git a/src/itc/http/tct-http-native_wearable.h b/src/itc/http/tct-http-native_wearable.h new file mode 100755 index 0000000..537b933 --- /dev/null +++ b/src/itc/http/tct-http-native_wearable.h @@ -0,0 +1,92 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef __TCT_HTTP_NATIVE_H__ +#define __TCT_HTTP_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + + +extern void ITs_http_startup(void); +extern void ITs_http_cleanup(void); +extern void ITs_http_transaction_startup(void); +extern void ITs_http_transaction_cleanup(void); + +extern int ITc_http_init_deinit_p(void); +extern int ITc_http_session_create_destroy_p(void); +extern int ITc_http_session_set_get_auto_redirection_p(void); +extern int ITc_http_session_get_active_transaction_count_p(void); +extern int ITc_http_session_get_max_transaction_count_p(void); +extern int ITc_http_session_open_destroy_transaction_p(void); +extern int ITc_http_session_destroy_all_transactions_p(void); +extern int ITc_http_transaction_register_callbacks_p(void); +extern int ITc_http_transaction_set_uploaded_cb_p(void); +extern int ITc_http_transaction_set_progress_cb_p(void); +extern int ITc_http_transaction_set_get_timeout_p(void); +extern int ITc_http_transaction_set_ready_to_write_p(void); +extern int ITc_http_transaction_set_get_interface_name_p(void); +extern int ITc_http_transaction_set_get_server_certificate_verification_p(void); +extern int ITc_http_transaction_pause_resume_p(void); +extern int ITc_http_transaction_header_add_remove_field_p(void); +extern int ITc_http_transaction_request_set_get_method_p(void); +extern int ITc_http_transaction_request_set_get_version_p(void); +extern int ITc_http_transaction_request_set_get_uri_p(void); +extern int ITc_http_transaction_request_set_get_accept_encoding_p(void); +extern int ITc_http_transaction_request_set_get_cookie_p(void); +extern int ITc_http_transaction_request_write_body_p(void); +extern int ITc_http_transaction_response_get_status_code_p(void); +extern int ITc_http_transaction_response_get_status_text_p(void); +extern int ITc_http_transaction_response_get_version_p(void); +extern int ITc_http_trasaction_open_authentication_p(void); +extern int ITc_http_transaction_set_get_credentials_p(void); +extern int ITc_http_transaction_set_get_http_auth_scheme_p(void); +extern int ITc_http_transaction_get_realm_p(void); + +testcase tc_array[] = { + {"ITc_http_init_deinit_p", ITc_http_init_deinit_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_create_destroy_p", ITc_http_session_create_destroy_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_set_get_auto_redirection_p", ITc_http_session_set_get_auto_redirection_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_get_active_transaction_count_p", ITc_http_session_get_active_transaction_count_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_get_max_transaction_count_p", ITc_http_session_get_max_transaction_count_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_open_destroy_transaction_p", ITc_http_session_open_destroy_transaction_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_session_destroy_all_transactions_p", ITc_http_session_destroy_all_transactions_p, ITs_http_startup, ITs_http_cleanup}, + {"ITc_http_transaction_register_callbacks_p", ITc_http_transaction_register_callbacks_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_uploaded_cb_p", ITc_http_transaction_set_uploaded_cb_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_progress_cb_p", ITc_http_transaction_set_progress_cb_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_timeout_p", ITc_http_transaction_set_get_timeout_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_ready_to_write_p", ITc_http_transaction_set_ready_to_write_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_interface_name_p", ITc_http_transaction_set_get_interface_name_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_server_certificate_verification_p", ITc_http_transaction_set_get_server_certificate_verification_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_pause_resume_p", ITc_http_transaction_pause_resume_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_header_add_remove_field_p", ITc_http_transaction_header_add_remove_field_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_method_p", ITc_http_transaction_request_set_get_method_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_version_p", ITc_http_transaction_request_set_get_version_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_uri_p", ITc_http_transaction_request_set_get_uri_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_accept_encoding_p", ITc_http_transaction_request_set_get_accept_encoding_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_set_get_cookie_p", ITc_http_transaction_request_set_get_cookie_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_request_write_body_p", ITc_http_transaction_request_write_body_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_status_code_p", ITc_http_transaction_response_get_status_code_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_status_text_p", ITc_http_transaction_response_get_status_text_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_response_get_version_p", ITc_http_transaction_response_get_version_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_trasaction_open_authentication_p", ITc_http_trasaction_open_authentication_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_credentials_p", ITc_http_transaction_set_get_credentials_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_set_get_http_auth_scheme_p", ITc_http_transaction_set_get_http_auth_scheme_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {"ITc_http_transaction_get_realm_p", ITc_http_transaction_get_realm_p, ITs_http_transaction_startup, ITs_http_transaction_cleanup}, + {NULL, NULL} +}; + + +#endif // __TCT_HTTP_NATIVE_H__ -- 2.7.4