[ITC][ACR-1371][Autofill][Add APIs for sending autofill error] 89/203189/3
authorp.chauhan <p.chauhan@samsung.com>
Wed, 10 Apr 2019 10:49:28 +0000 (16:19 +0530)
committermanoj gupta <manoj.g2@samsung.com>
Tue, 16 Apr 2019 08:57:15 +0000 (08:57 +0000)
Change-Id: Ia970d7ec2076d15ddbd6086d9b4714cb97c6b081
Signed-off-by: p.chauhan <p.chauhan@samsung.com>
src/itc/autofill/ITs-autofill.c
src/itc/autofill/tct-autofill-native_mobile.h
src/itc/autofill/tct-autofill-native_tizeniot.h
src/itc/autofill/tct-autofill-native_wearable.h

index 5416ae037eeab6d1258fe6882e6b9877c2cf1aae..5130f0490c2df8c566478c7f6f25c6633a538b7f 100755 (executable)
@@ -155,8 +155,203 @@ void AutofillFillResponseItemCb(autofill_fill_response_item_h hFillResponseItem,
         return;
 }
 
+/**
+* @function                    AutofillErrorInfoReceivedCb
+* @description                 Callback Function to receive Autofill Error info.
+* @parameters                  autofill_h hAutofill, autofill_error_info_h hAutofillErrorInfo, void *user_data
+* @return                      NA
+*/
+void AutofillErrorInfoReceivedCb(autofill_h hAutofill, autofill_error_info_h hAutofillErrorInfo, void *user_data)
+{
+       FPRINTF("[Line: %d][%s] %s Callback invoked\\n", __LINE__, API_NAMESPACE, "AutofillErrorInfoReceivedCb");
+       return;
+}
+
 /****************************************************Callback End***********************************************************/
 
+/**
+* @testcase                            ITc_autofill_error_info_create_destroy_p
+* @since_tizen                         5.5
+* @author                              SRID(p.chauhan)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                        auto
+* @description                         Creates and destroys autofill error information.
+* @scenario                            Creates and destroys autofill error information.
+* @apicovered                          autofill_error_info_create, autofill_error_info_destroy
+* @passcase                            autofill_error_info_create, autofill_error_info_destroy return(s) 0
+* @failcase                            autofill_error_info_create, autofill_error_info_destroy return(s) 1
+* @precondition                                N/A
+* @postcondition                       N/A
+* */
+int ITc_autofill_error_info_create_destroy_p(void)
+{
+       START_TEST;
+
+       autofill_error_info_h hAutofillErrorInfo = NULL;
+       int nRet = 0;
+
+       nRet = autofill_error_info_create(&hAutofillErrorInfo);
+       PRINT_RESULT(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_create", AutofillGetError(nRet));
+       CHECK_HANDLE(hAutofillErrorInfo, "autofill_error_info_create");
+
+       nRet = autofill_error_info_destroy(hAutofillErrorInfo);
+       PRINT_RESULT(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_destroy", AutofillGetError(nRet));
+
+       return 0;
+}
+
+/**
+* @testcase                            ITc_autofill_error_info_set_get_app_id_p
+* @since_tizen                         5.5
+* @author                              SRID(p.chauhan)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                        auto
+* @description                         Sets and gets the app id in autofill error information.
+* @scenario                            Creates the handle and Sets and gets the app id in autofill error information and destroys it.
+* @apicovered                          autofill_error_info_set_app_id, autofill_error_info_get_app_id
+* @passcase                            autofill_error_info_set_app_id, autofill_error_info_get_app_id return(s) 0
+* @failcase                            autofill_error_info_set_app_id, autofill_error_info_get_app_id return(s) 1
+* @precondition                                autofill_error_info_create
+* @postcondition                       autofill_error_info_destroy
+* */
+int ITc_autofill_error_info_set_get_app_id_p(void)
+{
+       START_TEST;
+
+       autofill_error_info_h hAutofillErrorInfo = NULL;
+       char *pszAppId = NULL;
+       int nRet = 0;
+
+       nRet = autofill_error_info_create(&hAutofillErrorInfo);
+       PRINT_RESULT(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_create", AutofillGetError(nRet));
+       CHECK_HANDLE(hAutofillErrorInfo, "autofill_error_info_create");
+
+       nRet = autofill_error_info_set_app_id(hAutofillErrorInfo, g_pszAppId);
+       PRINT_RESULT_CLEANUP(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_set_app_id", AutofillGetError(nRet), autofill_error_info_destroy(hAutofillErrorInfo));
+
+       nRet = autofill_error_info_get_app_id(hAutofillErrorInfo, &pszAppId);
+       PRINT_RESULT_CLEANUP(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_get_app_id", AutofillGetError(nRet), autofill_error_info_destroy(hAutofillErrorInfo));
+       CHECK_HANDLE_CLEANUP(pszAppId, "autofill_error_info_get_app_id", autofill_error_info_destroy(hAutofillErrorInfo));
+
+       if(0 != strncmp(pszAppId, g_pszAppId, strlen(g_pszAppId)))
+       {
+               FPRINTF("[Line : %d][%s] autofill_error_info_get_app_id failed.pszAppId = %d\\n", __LINE__, API_NAMESPACE, pszAppId);
+               FREE_MEMORY(pszAppId);
+               autofill_error_info_destroy(hAutofillErrorInfo);
+               return 1;
+       }
+
+       FREE_MEMORY(pszAppId);
+
+       nRet = autofill_error_info_destroy(hAutofillErrorInfo);
+       PRINT_RESULT_NORETURN(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_destroy", AutofillGetError(nRet));
+
+       return 0;
+}
+
+/**
+* @testcase                            ITc_autofill_error_info_set_get_error_code_p
+* @since_tizen                         5.5
+* @author                              SRID(p.chauhan)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                        auto
+* @description                         Sets and gets the error code in autofill error information.
+* @scenario                            Creates handle and Sets and gets all error codes in autofill error information and destroys the handle.
+* @apicovered                          autofill_error_info_set_error_code, autofill_error_info_get_error_code
+* @passcase                            autofill_error_info_set_error_code, autofill_error_info_get_error_code return(s) 0
+* @failcase                            autofill_error_info_set_error_code, autofill_error_info_get_error_code return(s) 1
+* @precondition                                autofill_error_info_create
+* @postcondition                       autofill_error_info_destroy
+* */
+int ITc_autofill_error_info_set_get_error_code_p(void)
+{
+       START_TEST;
+
+       autofill_error_info_h hAutofillErrorInfo = NULL;
+       int nRet = 0;
+
+       autofill_error_e eErrorCodeArr[] = {
+               AUTOFILL_ERROR_NONE,
+               AUTOFILL_ERROR_INVALID_PARAMETER,
+               AUTOFILL_ERROR_PERMISSION_DENIED,
+               AUTOFILL_ERROR_NOT_INITIALIZED,
+               AUTOFILL_ERROR_OPERATION_FAILED,
+               AUTOFILL_ERROR_OUT_OF_MEMORY,
+               AUTOFILL_ERROR_AUTHENTICATION_FAILED,
+               AUTOFILL_ERROR_COMMIT_FAILED,
+               AUTOFILL_ERROR_FILL_RESPONSE_FAILED,
+               AUTOFILL_ERROR_SERVICE_NOT_CONNECTED,
+               AUTOFILL_ERROR_SERVICE_NOT_ALLOWED,
+               AUTOFILL_ERROR_SERVICE_NOT_ACTIVATED,
+               AUTOFILL_ERROR_SAVED_VALUES_NOT_FOUND,
+       };
+
+       int nErrorCodeSize = sizeof(eErrorCodeArr)/sizeof(eErrorCodeArr[0]);
+       autofill_error_e eErrorCode;
+
+       nRet = autofill_error_info_create(&hAutofillErrorInfo);
+       PRINT_RESULT(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_create", AutofillGetError(nRet));
+       CHECK_HANDLE(hAutofillErrorInfo, "autofill_error_info_create");
+
+       for(int nErrorCodeCounter = 0; nErrorCodeCounter<nErrorCodeSize; nErrorCodeCounter++)
+       {
+
+               nRet = autofill_error_info_set_error_code(hAutofillErrorInfo, eErrorCodeArr[nErrorCodeCounter]);
+               PRINT_RESULT_CLEANUP(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_set_error_code", AutofillGetError(nRet), autofill_error_info_destroy(hAutofillErrorInfo));
+
+               nRet = autofill_error_info_get_error_code(hAutofillErrorInfo, &eErrorCode);
+               PRINT_RESULT_CLEANUP(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_get_error_code", AutofillGetError(nRet), autofill_error_info_destroy(hAutofillErrorInfo));
+
+               if( eErrorCode != eErrorCodeArr[nErrorCodeCounter])
+               {
+                       FPRINTF("[Line : %d][%s] autofill_error_info_get_error_code failed. eErrorCode = %d\\n", __LINE__, API_NAMESPACE, eErrorCode);
+                       autofill_error_info_destroy(hAutofillErrorInfo);
+                       return 1;
+               }
+       }
+
+       nRet = autofill_error_info_destroy(hAutofillErrorInfo);
+       PRINT_RESULT_NORETURN(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_destroy", AutofillGetError(nRet));
+
+       return 0;
+}
+
+/**
+* @testcase                            ITc_autofill_error_info_set_unset_received_cb_p
+* @since_tizen                         5.5
+* @author                              SRID(p.chauhan)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                        auto
+* @description                         Sets and unsets the callback to receive the error information.
+* @scenario                            Creates handle and Sets and unsets the callback to receive the error information then destroys it.
+* @apicovered                          autofill_error_info_set_received_cb, autofill_error_info_unset_received_cb
+* @passcase                            autofill_error_info_set_received_cb, autofill_error_info_unset_received_cb return(s) 0
+* @failcase                            autofill_error_info_set_received_cb, autofill_error_info_unset_received_cb return(s) 1
+* @precondition                                autofill_create
+* @postcondition                       autofill_destroy
+* */
+int ITc_autofill_error_info_set_unset_received_cb_p(void)
+{
+       START_TEST;
+
+       autofill_h hAutofill = NULL;
+       int nRet = 0;
+
+       nRet = autofill_create(&hAutofill);
+       PRINT_RESULT(nRet, AUTOFILL_ERROR_NONE, "autofill_create", AutofillGetError(nRet));
+       CHECK_HANDLE(hAutofill, "autofill_create");
+
+       nRet = autofill_error_info_set_received_cb(hAutofill, AutofillErrorInfoReceivedCb, NULL);
+       PRINT_RESULT_CLEANUP(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_set_received_cb", AutofillGetError(nRet), autofill_destroy(hAutofill));
+
+       nRet = autofill_error_info_unset_received_cb(hAutofill);
+       PRINT_RESULT_CLEANUP(nRet, AUTOFILL_ERROR_NONE, "autofill_error_info_unset_received_cb", AutofillGetError(nRet), autofill_destroy(hAutofill));
+
+       nRet = autofill_destroy(hAutofill);
+       PRINT_RESULT_NORETURN(nRet, AUTOFILL_ERROR_NONE, "autofill_destroy", AutofillGetError(nRet));
+
+       return 0;
+}
 /**
 * @testcase                            ITc_autofill_item_create_destroy_p
 * @since_tizen                         5.5
index d6dc3a64a60c18ae22f80d599f08152e71892a02..9fa952e31246f8237cba9c58dab6c8efb0da646b 100755 (executable)
@@ -84,6 +84,10 @@ extern int ITc_autofill_service_set_unset_fill_requested_cb_p(void);
 extern int ITc_autofill_service_set_unset_commited_cb_p(void);
 extern int ITc_autofill_service_set_unset_terminate_received_cb_p(void);
 extern int ITc_autofill_auth_info_request_p(void);
+extern int ITc_autofill_error_info_create_destroy_p(void);
+extern int ITc_autofill_error_info_set_get_app_id_p(void);
+extern int ITc_autofill_error_info_set_get_error_code_p(void);
+extern int ITc_autofill_error_info_set_unset_received_cb_p(void);
 
 testcase tc_array[] = {
        {"ITc_autofill_item_create_destroy_p",ITc_autofill_item_create_destroy_p,ITs_autofill_startup,ITs_autofill_cleanup},
@@ -145,6 +149,10 @@ testcase tc_array[] = {
        {"ITc_autofill_service_set_unset_commited_cb_p", ITc_autofill_service_set_unset_commited_cb_p,ITs_autofill_service_startup,ITs_autofill_service_cleanup},
        {"ITc_autofill_service_set_unset_terminate_received_cb_p",  ITc_autofill_service_set_unset_terminate_received_cb_p, ITs_autofill_service_startup, ITs_autofill_service_cleanup},
        {"ITc_autofill_auth_info_request_p", ITc_autofill_auth_info_request_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_create_destroy_p", ITc_autofill_error_info_create_destroy_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_get_app_id_p", ITc_autofill_error_info_set_get_app_id_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_get_error_code_p", ITc_autofill_error_info_set_get_error_code_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_unset_received_cb_p", ITc_autofill_error_info_set_unset_received_cb_p,ITs_autofill_startup,ITs_autofill_cleanup},
        {NULL, NULL}
 };
 
index d6dc3a64a60c18ae22f80d599f08152e71892a02..9fa952e31246f8237cba9c58dab6c8efb0da646b 100755 (executable)
@@ -84,6 +84,10 @@ extern int ITc_autofill_service_set_unset_fill_requested_cb_p(void);
 extern int ITc_autofill_service_set_unset_commited_cb_p(void);
 extern int ITc_autofill_service_set_unset_terminate_received_cb_p(void);
 extern int ITc_autofill_auth_info_request_p(void);
+extern int ITc_autofill_error_info_create_destroy_p(void);
+extern int ITc_autofill_error_info_set_get_app_id_p(void);
+extern int ITc_autofill_error_info_set_get_error_code_p(void);
+extern int ITc_autofill_error_info_set_unset_received_cb_p(void);
 
 testcase tc_array[] = {
        {"ITc_autofill_item_create_destroy_p",ITc_autofill_item_create_destroy_p,ITs_autofill_startup,ITs_autofill_cleanup},
@@ -145,6 +149,10 @@ testcase tc_array[] = {
        {"ITc_autofill_service_set_unset_commited_cb_p", ITc_autofill_service_set_unset_commited_cb_p,ITs_autofill_service_startup,ITs_autofill_service_cleanup},
        {"ITc_autofill_service_set_unset_terminate_received_cb_p",  ITc_autofill_service_set_unset_terminate_received_cb_p, ITs_autofill_service_startup, ITs_autofill_service_cleanup},
        {"ITc_autofill_auth_info_request_p", ITc_autofill_auth_info_request_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_create_destroy_p", ITc_autofill_error_info_create_destroy_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_get_app_id_p", ITc_autofill_error_info_set_get_app_id_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_get_error_code_p", ITc_autofill_error_info_set_get_error_code_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_unset_received_cb_p", ITc_autofill_error_info_set_unset_received_cb_p,ITs_autofill_startup,ITs_autofill_cleanup},
        {NULL, NULL}
 };
 
index d6dc3a64a60c18ae22f80d599f08152e71892a02..9fa952e31246f8237cba9c58dab6c8efb0da646b 100755 (executable)
@@ -84,6 +84,10 @@ extern int ITc_autofill_service_set_unset_fill_requested_cb_p(void);
 extern int ITc_autofill_service_set_unset_commited_cb_p(void);
 extern int ITc_autofill_service_set_unset_terminate_received_cb_p(void);
 extern int ITc_autofill_auth_info_request_p(void);
+extern int ITc_autofill_error_info_create_destroy_p(void);
+extern int ITc_autofill_error_info_set_get_app_id_p(void);
+extern int ITc_autofill_error_info_set_get_error_code_p(void);
+extern int ITc_autofill_error_info_set_unset_received_cb_p(void);
 
 testcase tc_array[] = {
        {"ITc_autofill_item_create_destroy_p",ITc_autofill_item_create_destroy_p,ITs_autofill_startup,ITs_autofill_cleanup},
@@ -145,6 +149,10 @@ testcase tc_array[] = {
        {"ITc_autofill_service_set_unset_commited_cb_p", ITc_autofill_service_set_unset_commited_cb_p,ITs_autofill_service_startup,ITs_autofill_service_cleanup},
        {"ITc_autofill_service_set_unset_terminate_received_cb_p",  ITc_autofill_service_set_unset_terminate_received_cb_p, ITs_autofill_service_startup, ITs_autofill_service_cleanup},
        {"ITc_autofill_auth_info_request_p", ITc_autofill_auth_info_request_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_create_destroy_p", ITc_autofill_error_info_create_destroy_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_get_app_id_p", ITc_autofill_error_info_set_get_app_id_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_get_error_code_p", ITc_autofill_error_info_set_get_error_code_p,ITs_autofill_startup,ITs_autofill_cleanup},
+       {"ITc_autofill_error_info_set_unset_received_cb_p", ITc_autofill_error_info_set_unset_received_cb_p,ITs_autofill_startup,ITs_autofill_cleanup},
        {NULL, NULL}
 };