From be8592c36b62a4e7d37f47ca2f4e2cce1be8dc88 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 12 May 2020 13:29:34 +0900 Subject: [PATCH] Add unittests Change-Id: I032a52ea87131b0d104e63bfd11412da22b19959 Signed-off-by: Jihoon Kim --- CMakeLists.txt | 10 + packaging/capi-ui-autofill.spec | 31 +- tests/CMakeLists.txt | 46 + tests/src/autofill_client_unittests.cpp | 347 ++++ tests/src/autofill_common_unittests.cpp | 3332 ++++++++++++++++++++++++++++++ tests/src/autofill_service_unittests.cpp | 277 +++ tests/src/main.cpp | 7 + 7 files changed, 4049 insertions(+), 1 deletion(-) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/src/autofill_client_unittests.cpp create mode 100644 tests/src/autofill_common_unittests.cpp create mode 100644 tests/src/autofill_service_unittests.cpp create mode 100644 tests/src/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 27785ee..8f0eeaa 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,3 +28,13 @@ ADD_SUBDIRECTORY(service_lib) ## Manager library ## ADD_SUBDIRECTORY(manager) + +## Test +IF(NOT DEFINED MINIMUM_BUILD) +ENABLE_TESTING() +SET(UTC_AUTOFILL autofill_unittests) +ADD_TEST(NAME ${UTC_AUTOFILL} COMMAND ${UTC_AUTOFILL} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests) + +ADD_SUBDIRECTORY(tests) +ENDIF(NOT DEFINED MINIMUM_BUILD) diff --git a/packaging/capi-ui-autofill.spec b/packaging/capi-ui-autofill.spec index 625c8f1..9b52652 100644 --- a/packaging/capi-ui-autofill.spec +++ b/packaging/capi-ui-autofill.spec @@ -1,3 +1,6 @@ +# test_type : one of 'GTEST' +%define test_type GTEST + Name: capi-ui-autofill Summary: Autofill Library Version: 0.1.43 @@ -6,6 +9,9 @@ Group: Graphics & UI Framework/Input License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake +#%if "%{test_type}" == "GTEST" +BuildRequires: pkgconfig(gmock) +#%endif BuildRequires: tidl BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(capi-base-common) @@ -23,6 +29,11 @@ Requires: org.tizen.autofilld Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig +%if 0%{?gcov:1} +BuildRequires: lcov +BuildRequires: zip +%endif + %description Autofill Library @@ -99,6 +110,14 @@ Requires: %{name} = %{version}-%{release} %description -n capi-ui-autofill-manager Autofill Manager Library +%package unittests +Summary: autofill tests +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description unittests +GTest for autofill + %package -n capi-ui-autofill-manager-devel Summary: Autofill Manager Library (Development) @@ -147,7 +166,7 @@ export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden" rm -rf CMakeFiles rm -rf CMakeCache.txt MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DTEST_TYPE=%{test_type} make %{?jobs:-j%jobs} %if 0%{?gcov:1} @@ -161,6 +180,13 @@ find . -name '*.gcno' -exec cp '{}' gcov-obj ';' rm -rf %{buildroot} %make_install +%check +ctest --output-on-failure %{?_smp_mflags} +%if 0%{?gcov:1} +lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info +genhtml gcov.info +%endif + %if 0%{?gcov:1} mkdir -p %{buildroot}%{_datadir}/gcov/obj install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj @@ -214,6 +240,9 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/pkgconfig/capi-ui-autofill-manager.pc %{_libdir}/libcapi-ui-autofill-manager.so +%files unittests +%{_bindir}/* + %if 0%{?gcov:1} %files gcov %{_datadir}/gcov/obj/* diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..ad28419 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,46 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(gtest-autofill CXX) + +# Find Packages +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED + dlog + ecore + glib-2.0 + rpc-port + capi-base-common + gmock +) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIE") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -std=c++11") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") + +SET(SOURCES "") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include) + +AUX_SOURCE_DIRECTORY(src SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../common AUTOFILL_COMMON_SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../client AUTOFILL_CLIENT_SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../service_lib AUTOFILL_SERVICE_SOURCES) + +ADD_DEFINITIONS("-DFULLVER=\"${FULLVER}\"") + +ADD_EXECUTABLE(${UTC_AUTOFILL} + ${AUTOFILL_COMMON_SOURCES} + ${AUTOFILL_CLIENT_SOURCES} + ${AUTOFILL_SERVICE_SOURCES} + ${SOURCES} + ) +TARGET_LINK_LIBRARIES(${UTC_AUTOFILL} ${GTEST_LIBRARIES} ${pkgs_LDFLAGS} ${EXTRA_LDFLAGS}) + +INSTALL(TARGETS ${UTC_AUTOFILL} DESTINATION /usr/bin) diff --git a/tests/src/autofill_client_unittests.cpp b/tests/src/autofill_client_unittests.cpp new file mode 100644 index 0000000..e08bbff --- /dev/null +++ b/tests/src/autofill_client_unittests.cpp @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2020 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 + +#include + +#include +#include +#include +#include +#include + +#define VIEW_ID "login" + +namespace { + +void auth_info_cb(autofill_h ah, autofill_auth_info_h auth_info, void *user_data) +{ + +} + +void fill_response_cb(autofill_h ah, autofill_fill_response_h fill_response_h, void *user_data) +{ + +} + +void error_info_cb(autofill_h ah, autofill_error_info_h error_info, void *user_data) +{ + +} + +class AutofillClientTest : public testing::Test { + public: + autofill_h af_h = NULL; + virtual void SetUp() { + eina_init(); + + int ret = autofill_create(&af_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(af_h, nullptr); + } + virtual void TearDown() { + eina_shutdown(); + + if (af_h) { + autofill_destroy(af_h); + } + + af_h = NULL; + } +}; + +/** + * @function utc_autofill_create_p + * @description Positive UTC of the function that creates autofill handle + * @parameter NA + */ +TEST_F(AutofillClientTest, utc_autofill_create_p) +{ + autofill_h ah = NULL; + int ret = autofill_create(&ah); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @function utc_autofill_create_n + * @description Negative UTC of the function that creates autofill handle + * @parameter NA + */ +TEST_F(AutofillClientTest, utc_autofill_create_n) +{ + int ret = autofill_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @function utc_autofill_destroy_p + * @description Positive UTC of the function that destroys autofill handle + * @parameter NA + */ +TEST_F(AutofillClientTest, utc_autofill_destroy_p) +{ + autofill_h ah = NULL; + int ret = autofill_create(&ah); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_destroy(ah); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @function utc_autofill_destroy_n + * @description Negative UTC of the function that destroys autofill handle + * @parameter NA + */ +TEST_F(AutofillClientTest, utc_autofill_destroy_n) +{ + int ret = autofill_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_connect_n + * @since_tizen 5.5 + * @description Negative UTC of the function that connects to autofill daemon. + */ +TEST_F(AutofillClientTest, utc_autofill_connect_n) +{ + int ret = autofill_connect(NULL, NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_request_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sends authentication information. + */ +TEST_F(AutofillClientTest, utc_autofill_auth_info_request_n) +{ + int ret = autofill_auth_info_request(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets auth info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_auth_info_set_received_cb_p) +{ + int ret = autofill_auth_info_set_received_cb(af_h, auth_info_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_received_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets auth info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_auth_info_set_received_cb_n) +{ + int ret = autofill_auth_info_set_received_cb(NULL, auth_info_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_unset_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets auth info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_auth_info_unset_received_cb_p) +{ + int ret = autofill_auth_info_unset_received_cb(af_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_unset_received_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that unsets auth info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_auth_info_unset_received_cb_n) +{ + int ret = autofill_auth_info_unset_received_cb(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_error_info_set_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets error info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_error_info_set_received_cb_p) +{ + int ret = autofill_error_info_set_received_cb(af_h, error_info_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_error_info_set_received_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets error info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_error_info_set_received_cb_n) +{ + int ret = autofill_error_info_set_received_cb(NULL, error_info_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_error_info_unset_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets error info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_error_info_unset_received_cb_p) +{ + int ret = autofill_error_info_unset_received_cb(af_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_error_info_unset_received_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that unsets error info received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_error_info_unset_received_cb_n) +{ + int ret = autofill_error_info_unset_received_cb(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_request_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sends fill request. + */ +TEST_F(AutofillClientTest, utc_autofill_fill_request_n) +{ + int ret = autofill_fill_request(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_cancel_fill_request_n + * @since_tizen 5.5 + * @description Negative UTC of the function that cancels fill request. + */ +TEST_F(AutofillClientTest, utc_autofill_cancel_fill_request_n) +{ + int ret = autofill_cancel_fill_request(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_set_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets fill response received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_fill_response_set_received_cb_p) +{ + int ret = autofill_fill_response_set_received_cb(af_h, fill_response_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_set_received_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets fill response received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_fill_response_set_received_cb_n) +{ + int ret = autofill_fill_response_set_received_cb(NULL, NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_set_received_cb_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that sets fill response received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_fill_response_set_received_cb_n2) +{ + int ret = autofill_fill_response_set_received_cb(af_h, NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_unset_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets fill response received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_fill_response_unset_received_cb_p) +{ + int ret = autofill_fill_response_unset_received_cb(af_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_unset_received_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that unsets fill response received callback. + */ +TEST_F(AutofillClientTest, utc_autofill_fill_response_unset_received_cb_n) +{ + int ret = autofill_fill_response_unset_received_cb(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_commit_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sends commit for saving autofill data. + */ +TEST_F(AutofillClientTest, utc_autofill_commit_n) +{ + int ret = AUTOFILL_ERROR_NONE; + + autofill_save_view_info_h vi_h; + + ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_commit(NULL, vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_commit_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that sends commit for saving autofill data. + */ +TEST_F(AutofillClientTest, utc_autofill_commit_n2) +{ + int ret = AUTOFILL_ERROR_NONE; + + ret = autofill_commit(af_h, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_commit_n3 + * @since_tizen 5.5 + * @description Negative UTC of the function that sends commit for saving autofill data. + */ +TEST_F(AutofillClientTest, utc_autofill_commit_n3) +{ + int ret = AUTOFILL_ERROR_NONE; + ret = autofill_commit(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +} // namespace diff --git a/tests/src/autofill_common_unittests.cpp b/tests/src/autofill_common_unittests.cpp new file mode 100644 index 0000000..038a831 --- /dev/null +++ b/tests/src/autofill_common_unittests.cpp @@ -0,0 +1,3332 @@ +/* + * Copyright (c) 2020 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 + +#include + +#include +#include +#include +#include +#include + +#define VIEW_ID "login" + +namespace { + +static bool view_info_item_cb_result = false; +static bool save_view_info_item_cb_result = false; + +static bool fill_response_group_cb_result = false; +static bool fill_response_item_cb_result = false; + +class AutofillCommonTest : public testing::Test { + public: + virtual void SetUp() { + eina_init(); + } + virtual void TearDown() { + eina_shutdown(); + } +}; + +static bool __view_info_item_cb(autofill_item_h item, void *user_data) +{ + view_info_item_cb_result = true; + return true; +} + +static bool fill_response_group_cb(autofill_fill_response_group_h group_h, void *user_data) +{ + fill_response_group_cb_result = true; + return true; +} + +static bool __save_view_info_item_cb(autofill_save_item_h item, void *user_data) +{ + save_view_info_item_cb_result = true; + return true; +} + +static bool fill_response_item_cb(autofill_fill_response_item_h item, void *user_data) +{ + fill_response_item_cb_result = true; + return true; +} + +/** + * @testcase utc_autofill_item_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_create_p) +{ + autofill_item_h it_h; + int ret = autofill_item_create(&it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); +} + +/** + * @testcase utc_autofill_item_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_create_n) +{ + int ret = autofill_item_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_destroy_p) +{ + autofill_item_h it_h = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_id(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_set_label(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_set_value(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_destroy_n) +{ + int ret = autofill_item_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_clone_p + * @since_tizen 5.5 + * @description Positive UTC of the function that clones autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_clone_p) +{ + autofill_item_h it_h = NULL, clone_h; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_id(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_set_label(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_set_value(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_clone(it_h, &clone_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + autofill_item_destroy(it_h); + autofill_item_destroy(clone_h); +} + +/** + * @testcase utc_autofill_item_clone_n + * @since_tizen 5.5 + * @description Negative UTC of the function that clones autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_clone_n) +{ + int ret = autofill_item_clone(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_set_autofill_hint_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill hint in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_autofill_hint_p) +{ + autofill_item_h it_h = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_autofill_hint(it_h, AUTOFILL_HINT_NAME); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_set_autofill_hint_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill hint in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_autofill_hint_n) +{ + int ret = autofill_item_set_autofill_hint(NULL, AUTOFILL_HINT_NAME); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_get_autofill_hint_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill hint in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_autofill_hint_p) +{ + autofill_item_h it_h = NULL; + autofill_hint_e autofill_hint; + int ret = autofill_item_create(&it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_get_autofill_hint(it_h, &autofill_hint); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_get_autofill_hint_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill hint in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_autofill_hint_n) +{ + autofill_hint_e autofill_hint; + int ret = autofill_item_get_autofill_hint(NULL, &autofill_hint); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_set_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill id in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_id_p) +{ + autofill_item_h it_h = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_id(it_h, "test"); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_set_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill id in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_id_n) +{ + int ret = autofill_item_set_id(NULL, "test"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_get_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill id in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_id_p) +{ + autofill_item_h it_h = NULL; + char *id = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_id(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_get_id(it_h, &id); + + autofill_item_destroy(it_h); + + ASSERT_NE(id, nullptr); + + if (id) + free(id); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_get_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill id in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_id_n) +{ + char *id = NULL; + int ret = autofill_item_get_id(NULL, &id); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_set_label_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill label in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_label_p) +{ + autofill_item_h it_h = NULL; + int ret = autofill_item_create(&it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_label(it_h, "test"); + + autofill_item_destroy(it_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_set_label_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill label in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_label_n) +{ + int ret = autofill_item_set_label(NULL, "test"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_get_label_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill label in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_label_p) +{ + autofill_item_h it_h = NULL; + char *label = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_label(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_get_label(it_h, &label); + + autofill_item_destroy(it_h); + + ASSERT_NE(label, nullptr); + + if (label) + free(label); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_get_label_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill label in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_label_n) +{ + char *label = NULL; + int ret = autofill_item_get_label(NULL, &label); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_set_sensitive_data_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets whether sensitive data or not in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_sensitive_data_p) +{ + autofill_item_h it_h = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_sensitive_data(it_h, true); + + autofill_item_destroy(it_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_set_sensitive_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets whether sensitive data or not in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_sensitive_data_n) +{ + int ret = autofill_item_set_sensitive_data(NULL, true); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_get_sensitive_data_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets whether sensitive data or not in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_sensitive_data_p) +{ + autofill_item_h it_h = NULL; + bool sensitive_data; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_get_sensitive_data(it_h, &sensitive_data); + + autofill_item_destroy(it_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_get_sensitive_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets whether sensitive data or not in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_sensitive_data_n) +{ + bool sensitive_data; + int ret = autofill_item_get_sensitive_data(NULL, &sensitive_data); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_set_value_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill value in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_value_p) +{ + autofill_item_h it_h = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_value(it_h, "test"); + autofill_item_destroy(it_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_set_value_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill value in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_set_value_n) +{ + int ret = autofill_item_set_value(NULL, "test"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_item_get_value_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill value in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_value_p) +{ + autofill_item_h it_h = NULL; + char *value = NULL; + int ret = autofill_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_item_set_value(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_item_get_value(it_h, &value); + + if (value) + free(value); + + autofill_item_destroy(it_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_item_get_value_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill value in an autofill item. + */ +TEST_F(AutofillCommonTest, utc_autofill_item_get_value_n) +{ + char *value = NULL; + int ret = autofill_item_get_value(NULL, &value); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_create_p) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + autofill_view_info_destroy(vi_h); +} + +/** + * @testcase utc_autofill_view_info_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_create_n) +{ + int ret = autofill_view_info_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_destroy_p) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_view_info_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_destroy_n) +{ + int ret = autofill_view_info_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_set_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets app id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_set_app_id_p) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_app_id(vi_h, "org.tizen.example"); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_view_info_set_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets app id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_set_app_id_n) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_app_id(vi_h, NULL); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_get_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets app id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_get_app_id_p) +{ + autofill_view_info_h vi_h; + char *app_id = NULL; + int ret = autofill_view_info_create(&vi_h); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_app_id(vi_h, "org.tizen.example"); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_view_info_get_app_id(vi_h, &app_id); + ASSERT_NE(app_id, nullptr); + + free(app_id); + + autofill_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_view_info_get_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets app id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_get_app_id_n) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_app_id(vi_h, "org.tizen.example"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_view_info_get_app_id(vi_h, NULL); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_set_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets view id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_set_view_id_p) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_view_id(vi_h, "login"); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_view_info_set_view_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets view id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_set_view_id_n) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_view_id(vi_h, NULL); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_get_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets view id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_get_view_id_p) +{ + autofill_view_info_h vi_h; + char *view_id = NULL; + int ret = autofill_view_info_create(&vi_h); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_view_id(vi_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_view_info_get_view_id(vi_h, &view_id); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(view_id, nullptr); + + free(view_id); + + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_view_info_get_view_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets view id in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_get_view_id_n) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_set_view_id(vi_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_view_info_get_view_id(vi_h, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_add_item_p + * @since_tizen 5.5 + * @description Positive UTC of the function that adds autofill item + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_add_item_p) +{ + autofill_item_h ai_h; + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_item_create(&ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_view_info_add_item(vi_h, ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_view_info_add_item_n + * @since_tizen 5.5 + * @description Negative UTC of the function that adds autofill item + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_add_item_n) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_add_item(vi_h, NULL); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_view_info_foreach_item_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieve autofill item in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_foreach_item_p) +{ + autofill_view_info_h vi_h; + autofill_item_h it_h; + + view_info_item_cb_result = false; + + int ret = autofill_view_info_create(&vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + autofill_item_create(&it_h); + autofill_item_set_autofill_hint(it_h, AUTOFILL_HINT_NAME); + autofill_item_set_id(it_h, "name"); + autofill_item_set_label(it_h, "Myname"); + autofill_item_set_sensitive_data(it_h, true); + + autofill_view_info_add_item(vi_h, it_h); + + ret = autofill_view_info_foreach_item(vi_h, __view_info_item_cb, NULL); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + EXPECT_EQ(view_info_item_cb_result, true); +} + +/** + * @testcase utc_autofill_view_info_foreach_item_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieve autofill item in autofill view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_view_info_foreach_item_n) +{ + autofill_view_info_h vi_h; + int ret = autofill_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_view_info_foreach_item(vi_h, NULL, NULL); + autofill_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +//auth info +/** + * @testcase utc_autofill_auth_info_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_create_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); +} + +/** + * @testcase utc_autofill_auth_info_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill authentication information. + */ +//& purpose: A purpose of a autofill_auth_info_create() negative TC. +TEST_F(AutofillCommonTest, utc_autofill_auth_info_create_n) +{ + int ret = autofill_auth_info_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_destroy_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_destroy_n) +{ + int ret = autofill_auth_info_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets app id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_app_id_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_app_id(ai_h, "org.tizen.example"); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets app id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_app_id_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_app_id(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_get_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets app id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_app_id_p) +{ + autofill_auth_info_h ai_h; + char *app_id = NULL; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_app_id(ai_h, "org.tizen.example"); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_app_id(ai_h, &app_id); + ASSERT_NE(app_id, nullptr); + + free(app_id); + + autofill_auth_info_destroy(ai_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_get_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets app id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_app_id_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_app_id(ai_h, "org.tizen.example"); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_app_id(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets view id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_view_id_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_view_id(ai_h, "login"); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_view_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets view id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_view_id_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_view_id(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_get_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets view id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_view_id_p) +{ + autofill_auth_info_h ai_h; + char *view_id = NULL; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_view_id(ai_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_view_id(ai_h, &view_id); + ASSERT_NE(view_id, nullptr); + + free(view_id); + + autofill_auth_info_destroy(ai_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_get_view_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets view id in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_view_id_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_view_id(ai_h, "login"); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_view_id(ai_h, NULL); + + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_autofill_data_present_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets whether autofill data presents or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_autofill_data_present_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_autofill_data_present(ai_h, true); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_autofill_data_present_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets whether autofill data presents or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_autofill_data_present_n) +{ + int ret = autofill_auth_info_set_autofill_data_present(NULL, true); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_get_autofill_data_present_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets whether autofill data presents or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_autofill_data_present_p) +{ + autofill_auth_info_h ai_h; + bool autofill_data_present = false; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_autofill_data_present(ai_h, true); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_autofill_data_present(ai_h, &autofill_data_present); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(autofill_data_present, true); +} + +/** + * @testcase utc_autofill_auth_info_get_autofill_data_present_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets whether autofill data presents or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_autofill_data_present_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_autofill_data_present(ai_h, true); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_autofill_data_present(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_authentication_needed_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets whether authentication is needed or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_authentication_needed_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_authentication_needed(ai_h, true); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_authentication_needed_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets whether authentication is needed or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_authentication_needed_n) +{ + int ret = autofill_auth_info_set_authentication_needed(NULL, true); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_get_authentication_needed_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets whether authentication is needed or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_authentication_needed_p) +{ + autofill_auth_info_h ai_h; + bool authentication_needed = false; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_authentication_needed(ai_h, true); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_authentication_needed(ai_h, &authentication_needed); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(authentication_needed, true); +} + +/** + * @testcase utc_autofill_auth_info_get_authentication_needed_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets whether authentication is needed or not in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_authentication_needed_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_authentication_needed(ai_h, true); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_authentication_needed(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_service_name_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets service name in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_service_name_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_name(ai_h, "autofill"); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_service_name_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets service name in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_service_name_n) +{ + int ret = autofill_auth_info_set_service_name(NULL, "autofill"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_get_service_name_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets service name in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_service_name_p) +{ + autofill_auth_info_h ai_h; + char *service_name = NULL; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_name(ai_h, "autofill"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_service_name(ai_h, &service_name); + autofill_auth_info_destroy(ai_h); + ASSERT_NE(service_name, nullptr); + + free(service_name); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_get_service_name_p + * @since_tizen 5.5 + * @description Negative UTC of the function that gets service name in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_service_name_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_name(ai_h, "autofill"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_service_name(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_service_message_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets service message in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_service_message_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_message(ai_h, "autofill"); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_service_message_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets service message in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_service_message_n) +{ + int ret = autofill_auth_info_set_service_message(NULL, "autofill"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_get_service_message_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets service message in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_service_message_p) +{ + autofill_auth_info_h ai_h; + char *service_message; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_message(ai_h, "autofill"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_service_message(ai_h, &service_message); + autofill_auth_info_destroy(ai_h); + ASSERT_NE(service_message, nullptr); + + free(service_message); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_get_service_message_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets service message in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_service_message_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_message(ai_h, "autofill"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_service_message(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_set_service_logo_image_path_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets service logo image path in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_service_logo_image_path_p) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_logo_image_path(ai_h, "autofill"); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_set_service_logo_image_path_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets service logo image path in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_set_service_logo_image_path_n) +{ + int ret = autofill_auth_info_set_service_logo_image_path(NULL, "autofill"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_auth_info_get_service_logo_image_path_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets service logo image path in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_service_logo_image_path_p) +{ + autofill_auth_info_h ai_h; + char *service_logo_image_path; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_logo_image_path(ai_h, "autofill"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_service_logo_image_path(ai_h, &service_logo_image_path); + autofill_auth_info_destroy(ai_h); + ASSERT_NE(service_logo_image_path, nullptr); + + free(service_logo_image_path); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_auth_info_get_service_logo_image_path_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets service logo image path in autofill authentication information. + */ +TEST_F(AutofillCommonTest, utc_autofill_auth_info_get_service_logo_image_path_n) +{ + autofill_auth_info_h ai_h; + int ret = autofill_auth_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_auth_info_set_service_logo_image_path(ai_h, "autofill"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_auth_info_get_service_logo_image_path(ai_h, NULL); + autofill_auth_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +// fill response +/** + * @testcase utc_autofill_fill_response_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_create_p) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); +} + +/** + * @testcase utc_autofill_fill_response_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_create_n) +{ + int ret = autofill_fill_response_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_destroy_p) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_destroy_n) +{ + int ret = autofill_fill_response_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_set_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets app id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_set_app_id_p) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_app_id(fr_h, "org.tizen.example"); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_set_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets app id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_set_app_id_n) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_app_id(fr_h, NULL); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_get_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets app id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_get_app_id_p) +{ + autofill_fill_response_h fr_h; + char *app_id = NULL; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_app_id(fr_h, "org.tizen.example"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_get_app_id(fr_h, &app_id); + ASSERT_NE(app_id, nullptr); + + free(app_id); + + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_get_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets app id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_get_app_id_n) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_app_id(fr_h, "org.tizen.example"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_get_app_id(fr_h, NULL); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_set_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets view id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_set_view_id_p) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_view_id(fr_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_set_view_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets view id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_set_view_id_n) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_view_id(fr_h, NULL); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_get_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets view id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_get_view_id_p) +{ + autofill_fill_response_h fr_h; + char *view_id = NULL; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_view_id(fr_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_get_view_id(fr_h, &view_id); + autofill_fill_response_destroy(fr_h); + ASSERT_NE(view_id, nullptr); + + free(view_id); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_get_view_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets view id in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_get_view_id_n) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_set_view_id(fr_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_get_view_id(fr_h, NULL); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_add_group_p + * @since_tizen 5.5 + * @description Positive UTC of the function that adds autofill group item in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_add_group_p) +{ + autofill_fill_response_h fr_h; + autofill_fill_response_group_h res_group; + + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_add_group(fr_h, res_group); + + autofill_fill_response_group_destroy(res_group); + + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_add_group_n + * @since_tizen 5.5 + * @description Negative UTC of the function that adds autofill group item in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_add_group_n) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_add_group(fr_h, NULL); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_foreach_group_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves each autofill group item in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_foreach_group_p) +{ + autofill_fill_response_h fr_h; + autofill_fill_response_group_h res_group; + + fill_response_group_cb_result = false; + + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + autofill_fill_response_add_group(fr_h, res_group); + + ret = autofill_fill_response_foreach_group(fr_h, fill_response_group_cb, NULL); + + autofill_fill_response_group_destroy(res_group); + autofill_fill_response_destroy(fr_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + EXPECT_EQ(fill_response_group_cb_result, true); +} + +/** + * @testcase utc_autofill_fill_response_foreach_group_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves each autofill group item in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_foreach_group_n) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_foreach_group(fr_h, NULL, NULL); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_get_group_count_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets the count of autofill group items in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_get_group_count_p) +{ + autofill_fill_response_h fr_h; + autofill_fill_response_group_h res_group; + int count = 0; + + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_add_group(fr_h, res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_get_group_count(fr_h, &count); + autofill_fill_response_group_destroy(res_group); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + EXPECT_EQ(count, 1); +} + +/** + * @testcase utc_autofill_fill_response_get_group_count_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets the count of autofill group items in autofill fill response. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_get_group_count_n) +{ + autofill_fill_response_h fr_h; + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_get_group_count(fr_h, NULL); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_group_add_item_p + * @since_tizen 5.5 + * @description Positive UTC of the function that add autofill fill response item in autofill group item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_add_item_p) +{ + autofill_fill_response_h fr_h; + autofill_fill_response_group_h res_group; + autofill_fill_response_item_h res_it_h; + + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_add_group(fr_h, res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + /* item 1 */ + autofill_fill_response_item_create(&res_it_h); + autofill_fill_response_item_set_id(res_it_h, "id"); + autofill_fill_response_item_set_presentation_text(res_it_h, "tester1"); + autofill_fill_response_item_set_value(res_it_h, "tester1"); + + /* Add item in group */ + ret = autofill_fill_response_group_add_item(res_group, res_it_h); + autofill_fill_response_group_destroy(res_group); + autofill_fill_response_destroy(fr_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_group_add_item_n + * @since_tizen 5.5 + * @description Negative UTC of the function that add autofill fill response item in autofill group item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_add_item_n) +{ + autofill_fill_response_h fr_h; + autofill_fill_response_group_h res_group; + + int ret = autofill_fill_response_create(&fr_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(fr_h, nullptr); + + ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_add_group(fr_h, res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + /* Add item in group */ + ret = autofill_fill_response_group_add_item(res_group, NULL); + autofill_fill_response_group_destroy(res_group); + autofill_fill_response_destroy(fr_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_group_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that add creates autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_create_p) +{ + autofill_fill_response_group_h res_group; + int ret = autofill_fill_response_group_create(&res_group); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_group_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that add creates autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_create_n) +{ + int ret = autofill_fill_response_group_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_group_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that add destroys autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_destroy_p) +{ + autofill_fill_response_group_h res_group; + int ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_group_destroy(res_group); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_group_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that add destroys autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_destroy_n) +{ + int ret = autofill_fill_response_group_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_group_clone_p + * @since_tizen 5.5 + * @description Positive UTC of the function that clones autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_clone_p) +{ + autofill_fill_response_group_h res_group, res_clone_group; + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + /* item 1 */ + autofill_fill_response_item_create(&res_it_h); + autofill_fill_response_item_set_id(res_it_h, "id"); + autofill_fill_response_item_set_presentation_text(res_it_h, "tester1"); + autofill_fill_response_item_set_value(res_it_h, "tester1"); + + /* Add item in group */ + ret = autofill_fill_response_group_add_item(res_group, res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_group_clone(res_group, &res_clone_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + autofill_fill_response_group_destroy(res_group); + autofill_fill_response_group_destroy(res_clone_group); +} + +/** + * @testcase utc_autofill_fill_response_group_clone_n + * @since_tizen 5.5 + * @description Negative UTC of the function that clones autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_clone_n) +{ + int ret; + ret = autofill_fill_response_group_clone(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_group_foreach_item_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieve each autofill fill response item in autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_foreach_item_p) +{ + autofill_fill_response_group_h res_group; + autofill_fill_response_item_h res_it_h; + int ret; + + fill_response_item_cb_result = false; + + ret = autofill_fill_response_group_create(&res_group); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + /* item 1 */ + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_id(res_it_h, "id"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_presentation_text(res_it_h, "tester1"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_value(res_it_h, "tester1"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + /* Add item in group */ + ret = autofill_fill_response_group_add_item(res_group, res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_group_foreach_item(res_group, fill_response_item_cb, NULL); + autofill_fill_response_group_destroy(res_group); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + EXPECT_EQ(fill_response_item_cb_result, true); +} + +/** + * @testcase utc_autofill_fill_response_group_foreach_item_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieve each autofill fill response item in autofill fill response group. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_group_foreach_item_n) +{ + int ret; + ret = autofill_fill_response_group_foreach_item(NULL, NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_create_p) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); +} + +/** + * @testcase utc_autofill_save_view_info_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_create_n) +{ + int ret = autofill_save_view_info_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_destroy_p) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_view_info_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_destroy_n) +{ + int ret = autofill_save_view_info_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_set_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets app id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_set_app_id_p) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_app_id(vi_h, "org.tizen.example"); + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_view_info_set_app_id_p + * @since_tizen 5.5 + * @description Negative UTC of the function that sets app id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_set_app_id_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_app_id(vi_h, NULL); + autofill_save_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_get_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets app id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_get_app_id_p) +{ + autofill_save_view_info_h vi_h; + char *app_id = NULL; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_app_id(vi_h, "org.tizen.example"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_view_info_get_app_id(vi_h, &app_id); + autofill_save_view_info_destroy(vi_h); + ASSERT_NE(app_id, nullptr); + + free(app_id); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_view_info_get_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets app id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_get_app_id_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_app_id(vi_h, "org.tizen.example"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_view_info_get_app_id(vi_h, NULL); + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_set_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets view id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_set_view_id_p) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_id(vi_h, "login"); + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_view_info_set_view_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets view id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_set_view_id_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_id(vi_h, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); + + autofill_save_view_info_destroy(vi_h); +} + +/** + * @testcase utc_autofill_save_view_info_get_view_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets view id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_get_view_id_p) +{ + autofill_save_view_info_h vi_h; + char *view_id = NULL; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_id(vi_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_view_info_get_view_id(vi_h, &view_id); + autofill_save_view_info_destroy(vi_h); + ASSERT_NE(view_id, nullptr); + + free(view_id); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_view_info_get_view_id_p + * @since_tizen 5.5 + * @description Negative UTC of the function that gets view id in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_get_view_id_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_id(vi_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_view_info_get_view_id(vi_h, NULL); + + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_set_view_title_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets view title in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_set_view_title_p) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_title(vi_h, "login"); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + autofill_save_view_info_destroy(vi_h); +} + +/** + * @testcase utc_autofill_save_view_info_set_view_title_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets view title in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_set_view_title_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_title(vi_h, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); + + autofill_save_view_info_destroy(vi_h); +} + +/** + * @testcase utc_autofill_save_view_info_get_view_title_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets view title in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_get_view_title_p) +{ + autofill_save_view_info_h vi_h; + char *view_title = NULL; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_title(vi_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_view_info_get_view_title(vi_h, &view_title); + autofill_save_view_info_destroy(vi_h); + ASSERT_NE(view_title, nullptr); + + free(view_title); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_view_info_get_view_title_p + * @since_tizen 5.5 + * @description Negative UTC of the function that gets view title in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_get_view_title_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_set_view_title(vi_h, "login"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_view_info_get_view_title(vi_h, NULL); + + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_add_item_p + * @since_tizen 5.5 + * @description Positive UTC of the function that adds autofill save item in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_add_item_p) +{ + autofill_save_item_h si_h; + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_item_create(&si_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_view_info_add_item(vi_h, si_h); + + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_view_info_add_item_n + * @since_tizen 5.5 + * @description Negative UTC of the function that adds autofill save item in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_add_item_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_add_item(vi_h, NULL); + + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_view_info_foreach_item_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves autofill save item in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_foreach_item_p) +{ + autofill_save_view_info_h vi_h; + autofill_save_item_h it_h; + + save_view_info_item_cb_result = false; + + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_id(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_set_label(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_set_value(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + autofill_save_view_info_add_item(vi_h, it_h); + + ret = autofill_save_view_info_foreach_item(vi_h, __save_view_info_item_cb, NULL); + autofill_save_view_info_destroy(vi_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + EXPECT_EQ(save_view_info_item_cb_result, true); +} + +/** + * @testcase utc_autofill_save_view_info_foreach_item_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves autofill save item in autofill save view information. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_view_info_foreach_item_n) +{ + autofill_save_view_info_h vi_h; + int ret = autofill_save_view_info_create(&vi_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(vi_h, nullptr); + + ret = autofill_save_view_info_foreach_item(vi_h, NULL, NULL); + autofill_save_view_info_destroy(vi_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_create_p) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_create_n) +{ + int ret; + + ret = autofill_fill_response_item_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_destroy_p) +{ + int ret; + autofill_fill_response_item_h res_it_h; + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_destroy_n) +{ + int ret; + ret = autofill_fill_response_item_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_clone_p + * @since_tizen 5.5 + * @description Positive UTC of the function that clones autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_clone_p) +{ + autofill_fill_response_item_h res_it_h, res_clone_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_id(res_it_h, "id"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_presentation_text(res_it_h, "tester1"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_value(res_it_h, "tester1"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_clone(res_it_h, &res_clone_it_h); + + autofill_fill_response_item_destroy(res_it_h); + autofill_fill_response_item_destroy(res_clone_it_h); + + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_clone_n + * @since_tizen 5.5 + * @description Negative UTC of the function that clones autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_clone_n) +{ + int ret; + + ret = autofill_fill_response_item_clone(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_set_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill id in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_id_p) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_id(res_it_h, "id"); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_set_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill id in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_id_n) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_id(res_it_h, NULL); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_get_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill id in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_id_p) +{ + char *id; + int ret; + autofill_fill_response_item_h res_it_h; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_id(res_it_h, "id"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_get_id(res_it_h, &id); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = strcmp("id", id); + if (id) + free(id); + + EXPECT_EQ(ret, 0); +} + +/** + * @testcase utc_autofill_fill_response_item_get_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill id in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_id_n) +{ + int ret; + autofill_fill_response_item_h res_it_h; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_get_id(res_it_h, NULL); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_set_value_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill value in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_value_p) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_value(res_it_h, "test"); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_set_value_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill value in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_value_n) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_value(res_it_h, NULL); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_get_value_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill value in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_value_p) +{ + char *value; + int ret; + autofill_fill_response_item_h res_it_h; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_value(res_it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_get_value(res_it_h, &value); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = strcmp("test", value); + if (value) + free(value); + + EXPECT_EQ(ret, 0); +} + +/** + * @testcase utc_autofill_fill_response_item_get_value_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill value in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_value_n) +{ + int ret; + autofill_fill_response_item_h res_it_h; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_get_value(res_it_h, NULL); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_set_presentation_text_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill presentation text in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_presentation_text_p) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_presentation_text(res_it_h, "test"); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_set_presentation_text_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill presentation text in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_presentation_text_n) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_presentation_text(res_it_h, NULL); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_get_presentation_text_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill presentation text in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_presentation_text_p) +{ + char *presentation_text; + int ret; + autofill_fill_response_item_h res_it_h; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_presentation_text(res_it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_get_presentation_text(res_it_h, &presentation_text); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = strcmp("test", presentation_text); + if (presentation_text) + free(presentation_text); + EXPECT_EQ(ret, 0); +} + +/** + * @testcase utc_autofill_fill_response_item_get_presentation_text_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill presentation text in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_presentation_text_n) +{ + int ret; + autofill_fill_response_item_h res_it_h; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_get_presentation_text(res_it_h, NULL); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_set_autofill_hint_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill hint in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_autofill_hint_p) +{ + autofill_fill_response_item_h res_it_h; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_set_autofill_hint(res_it_h, AUTOFILL_HINT_NAME); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_set_autofill_hint_p + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill hint in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_set_autofill_hint_n) +{ + int ret; + + ret = autofill_fill_response_item_set_autofill_hint(NULL, AUTOFILL_HINT_NAME); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_fill_response_item_get_autofill_hint_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill hint in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_autofill_hint_p) +{ + autofill_fill_response_item_h res_it_h; + autofill_hint_e autofill_hint; + int ret; + + ret = autofill_fill_response_item_create(&res_it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_fill_response_item_get_autofill_hint(res_it_h, &autofill_hint); + autofill_fill_response_item_destroy(res_it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_fill_response_item_get_autofill_hint_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill hint in autofill fill response item. + */ +TEST_F(AutofillCommonTest, utc_autofill_fill_response_item_get_autofill_hint_n) +{ + autofill_hint_e autofill_hint; + int ret = autofill_fill_response_item_get_autofill_hint(NULL, &autofill_hint); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +// save info +/** + * @testcase utc_autofill_save_item_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_create_p) +{ + autofill_save_item_h it_h; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); +} + +/** + * @testcase utc_autofill_save_item_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_create_n) +{ + int ret = autofill_save_item_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_destroy_p) +{ + autofill_save_item_h it_h = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_id(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_set_label(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_set_value(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_destroy_n) +{ + int ret = autofill_save_item_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_clone_p + * @since_tizen 5.5 + * @description Positive UTC of the function that clones autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_clone_p) +{ + autofill_save_item_h it_h = NULL, clone_h; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_id(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_set_label(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_set_value(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_clone(it_h, &clone_h); + + autofill_save_item_destroy(it_h); + autofill_save_item_destroy(clone_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_clone_n + * @since_tizen 5.5 + * @description Negative UTC of the function that clones autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_clone_n) +{ + int ret = autofill_save_item_clone(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_set_autofill_hint_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill hint in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_autofill_hint_p) +{ + autofill_save_item_h it_h = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_autofill_hint(it_h, AUTOFILL_HINT_NAME); + autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_set_autofill_hint_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill hint in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_autofill_hint_n) +{ + int ret = autofill_save_item_set_autofill_hint(NULL, AUTOFILL_HINT_NAME); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_get_autofill_hint_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill hint in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_autofill_hint_p) +{ + autofill_save_item_h it_h = NULL; + autofill_hint_e autofill_hint; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_get_autofill_hint(it_h, &autofill_hint); + autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_get_autofill_hint_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill hint in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_autofill_hint_n) +{ + autofill_hint_e autofill_hint; + int ret = autofill_save_item_get_autofill_hint(NULL, &autofill_hint); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_set_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill id in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_id_p) +{ + autofill_save_item_h it_h = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_id(it_h, "test"); + autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_set_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill id in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_id_n) +{ + int ret = autofill_save_item_set_id(NULL, "test"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_get_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill id in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_id_p) +{ + autofill_save_item_h it_h = NULL; + char *id = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_id(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_get_id(it_h, &id); + autofill_save_item_destroy(it_h); + + ASSERT_NE(id, nullptr); + + if (id) + free(id); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_get_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill id in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_id_n) +{ + char *id = NULL; + int ret = autofill_save_item_get_id(NULL, &id); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_set_label_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill label in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_label_p) +{ + autofill_save_item_h it_h = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_label(it_h, "test"); + autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_set_label_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill label in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_label_n) +{ + int ret = autofill_save_item_set_label(NULL, "test"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_get_label_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill label in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_label_p) +{ + autofill_save_item_h it_h = NULL; + char *label = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_label(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_get_label(it_h, &label); + autofill_save_item_destroy(it_h); + + ASSERT_NE(label, nullptr); + + if (label) + free(label); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_get_label_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill label in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_label_n) +{ + char *label = NULL; + int ret = autofill_save_item_get_label(NULL, &label); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_set_sensitive_data_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets whether sensitive data or not in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_sensitive_data_p) +{ + autofill_save_item_h it_h = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_sensitive_data(it_h, true); + autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_set_sensitive_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets whether sensitive data or not in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_sensitive_data_n) +{ + int ret = autofill_save_item_set_sensitive_data(NULL, true); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_get_sensitive_data_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets whether sensitive data or not in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_sensitive_data_p) +{ + autofill_save_item_h it_h = NULL; + bool sensitive_data; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_get_sensitive_data(it_h, &sensitive_data); + autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_get_sensitive_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets whether sensitive data or not in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_sensitive_data_n) +{ + bool sensitive_data; + int ret = autofill_save_item_get_sensitive_data(NULL, &sensitive_data); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_set_value_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets autofill value in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_value_p) +{ + autofill_save_item_h it_h = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_value(it_h, "test"); + autofill_save_item_destroy(it_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_set_value_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets autofill value in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_set_value_n) +{ + int ret = autofill_save_item_set_value(NULL, "test"); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_save_item_get_value_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets autofill value in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_value_p) +{ + autofill_save_item_h it_h = NULL; + char *value = NULL; + int ret = autofill_save_item_create(&it_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(it_h, nullptr); + + ret = autofill_save_item_set_value(it_h, "test"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_save_item_get_value(it_h, &value); + autofill_save_item_destroy(it_h); + + ASSERT_NE(value, nullptr); + + if (value) + free(value); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_save_item_get_value_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets autofill value in autofill save item. + */ +TEST_F(AutofillCommonTest, utc_autofill_save_item_get_value_n) +{ + char *value = NULL; + int ret = autofill_save_item_get_value(NULL, &value); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +//error info +/** + * @testcase utc_autofill_error_info_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_create_p) +{ + autofill_error_info_h ai_h; + int ret = autofill_error_info_create(&ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); +} + +/** + * @testcase utc_autofill_error_info_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates autofill error information. + */ +//& purpose: A purpose of a autofill_error_info_create() negative TC. +TEST_F(AutofillCommonTest, utc_autofill_error_info_create_n) +{ + int ret = autofill_error_info_create(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_error_info_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_destroy_p) +{ + autofill_error_info_h ai_h; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_error_info_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_destroy_n) +{ + int ret = autofill_error_info_destroy(NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_error_info_set_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets app id in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_set_app_id_p) +{ + autofill_error_info_h ai_h; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_set_app_id(ai_h, "org.tizen.example"); + autofill_error_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_error_info_set_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets app id in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_set_app_id_n) +{ + autofill_error_info_h ai_h; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_set_app_id(ai_h, NULL); + autofill_error_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_error_info_get_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets app id in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_get_app_id_p) +{ + autofill_error_info_h ai_h; + char *app_id = NULL; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_set_app_id(ai_h, "org.tizen.example"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_error_info_get_app_id(ai_h, &app_id); + ASSERT_NE(app_id, nullptr); + + free(app_id); + + autofill_error_info_destroy(ai_h); + + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_error_info_get_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets app id in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_get_app_id_n) +{ + autofill_error_info_h ai_h; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_set_app_id(ai_h, "org.tizen.example"); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_error_info_get_app_id(ai_h, NULL); + autofill_error_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_error_info_set_error_code_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets whether authentication is needed or not in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_set_error_code_p) +{ + autofill_error_info_h ai_h; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_set_error_code(ai_h, AUTOFILL_ERROR_AUTHENTICATION_FAILED); + autofill_error_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_error_info_set_error_code_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets whether authentication is needed or not in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_set_error_code_n) +{ + int ret = autofill_error_info_set_error_code(NULL, AUTOFILL_ERROR_AUTHENTICATION_FAILED); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_error_info_get_error_code_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets whether autofill data presents or not in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_get_error_code_p) +{ + autofill_error_info_h ai_h; + autofill_error_e error_code = AUTOFILL_ERROR_NONE; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_set_error_code(ai_h, AUTOFILL_ERROR_AUTHENTICATION_FAILED); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_error_info_get_error_code(ai_h, &error_code); + autofill_error_info_destroy(ai_h); + EXPECT_EQ(error_code, AUTOFILL_ERROR_AUTHENTICATION_FAILED); +} + +/** + * @testcase utc_autofill_error_info_get_error_code_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets whether autofill data presents or not in autofill error information. + */ +TEST_F(AutofillCommonTest, utc_autofill_error_info_get_error_code_n) +{ + autofill_error_info_h ai_h; + int ret = autofill_error_info_create(&ai_h); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + ASSERT_NE(ai_h, nullptr); + + ret = autofill_error_info_set_error_code(ai_h, AUTOFILL_ERROR_AUTHENTICATION_FAILED); + ASSERT_EQ(ret, AUTOFILL_ERROR_NONE); + + ret = autofill_error_info_get_error_code(ai_h, NULL); + autofill_error_info_destroy(ai_h); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +} // namespace diff --git a/tests/src/autofill_service_unittests.cpp b/tests/src/autofill_service_unittests.cpp new file mode 100644 index 0000000..522c67d --- /dev/null +++ b/tests/src/autofill_service_unittests.cpp @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2020 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 + +#include + +#include +#include +#include +#include + +#include + +namespace { + +static void auth_info_requested_cb(int context_id, autofill_view_info_h vi, void *user_data) +{ + +} + +static void fill_requested_cb(int context_id, autofill_view_info_h vi, void *user_data) +{ + +} + +static void cancel_fill_requested_cb(int context_id, autofill_view_info_h vi, void *user_data) +{ + +} + +static void committed_cb(int context_id, autofill_save_view_info_h vi, void *user_data) +{ + +} + +static void terminate_received_cb(void *user_data) +{ + +} + +class AutofillServiceTest : public testing::Test { + public: + virtual void SetUp() { + autofill_service_initialize(); + } + virtual void TearDown() { + autofill_service_deinitialize(); + //eina_shutdown(); + } +}; + +/** + * @testcase utc_autofill_service_deinitialize_p + * @since_tizen 5.5 + * @description Positive UTC of the function that deinitializes autofill service. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_deinitialize_p) +{ + int ret = autofill_service_deinitialize(); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); + + autofill_service_initialize(); +} + +/** + * @testcase utc_autofill_service_set_auth_info_requested_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets authentication infomation request received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_auth_info_requested_cb_p) +{ + int ret = autofill_service_set_auth_info_requested_cb(auth_info_requested_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_set_auth_info_requested_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets authentication infomation request received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_auth_info_requested_cb_n) +{ + int ret = autofill_service_set_auth_info_requested_cb(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_unset_auth_info_requested_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets authentication infomation request received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_unset_auth_info_requested_cb_p) +{ + int ret = autofill_service_unset_auth_info_requested_cb(); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_send_auth_info_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sends authentication information. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_send_auth_info_cb_n) +{ + int ret = autofill_service_send_auth_info(0, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_set_fill_requested_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets fill request received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_fill_requested_cb_p) +{ + int ret = autofill_service_set_fill_requested_cb(fill_requested_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_set_fill_requested_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets fill request received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_fill_requested_cb_n) +{ + int ret = autofill_service_set_fill_requested_cb(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_unset_fill_requested_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets fill request received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_unset_fill_requested_cb_p) +{ + int ret = autofill_service_unset_fill_requested_cb(); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_set_cancel_fill_requested_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets the callback for the cancelation of fill request. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_cancel_fill_requested_cb_p) +{ + int ret = autofill_service_set_cancel_fill_requested_cb(cancel_fill_requested_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_set_cancel_fill_requested_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets the callback for the cancelation of fill request. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_cancel_fill_requested_cb_n) +{ + int ret = autofill_service_set_cancel_fill_requested_cb(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_unset_cancel_fill_requested_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets fill request received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_unset_cancel_fill_requested_cb_p) +{ + int ret = autofill_service_unset_cancel_fill_requested_cb(); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_send_fill_response_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sends fill response. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_send_fill_response_n) +{ + int ret = autofill_service_send_fill_response(0, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_send_error_info_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sends authentication information. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_send_error_info_cb_n) +{ + int ret = autofill_service_send_error_info(0, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_set_committed_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets commit callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_committed_cb_p) +{ + int ret = autofill_service_set_committed_cb(committed_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_set_committed_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets commit callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_committed_cb_n) +{ + int ret = autofill_service_set_committed_cb(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_unset_committed_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets commit callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_unset_committed_cb_p) +{ + int ret = autofill_service_unset_committed_cb(); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_set_terminate_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets terminate received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_terminate_received_cb_p) +{ + int ret = autofill_service_set_terminate_received_cb(terminate_received_cb, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +/** + * @testcase utc_autofill_service_set_terminate_received_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets terminate received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_set_terminate_received_cb_n) +{ + int ret = autofill_service_set_terminate_received_cb(NULL, NULL); + EXPECT_EQ(ret, AUTOFILL_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_autofill_service_unset_terminate_received_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that unsets terminate received callback. + */ +TEST_F(AutofillServiceTest, utc_autofill_service_unset_terminate_received_cb_p) +{ + int ret = autofill_service_unset_terminate_received_cb(); + EXPECT_EQ(ret, AUTOFILL_ERROR_NONE); +} + +} // namespace diff --git a/tests/src/main.cpp b/tests/src/main.cpp new file mode 100644 index 0000000..a37d671 --- /dev/null +++ b/tests/src/main.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} -- 2.7.4