From 5511acdd6b18a738152859040edbda4239baafe7 Mon Sep 17 00:00:00 2001 From: yeji01kim Date: Fri, 8 Jul 2016 10:25:07 +0900 Subject: [PATCH] [UTC][device-policy-manager][ACR-644][Add TCs for dpm api] Change-Id: I5886dd1b6f7c892684191bf48c5b29bff0ee321f Signed-off-by: yeji01kim --- .../utc/core-device-policy-manager-tests.spec | 76 + packaging/utc/core-device-policy-manager-tests.xml | 23 + src/utc/device-policy-manager/CMakeLists.txt | 36 + .../tct-device-policy-manager-core.c | 140 ++ .../tct-device-policy-manager-core_mobile.h | 318 ++++ .../utc-device-policy-manager-password.c | 1197 ++++++++++++++ .../utc-device-policy-manager-restriction.c | 1666 ++++++++++++++++++++ 7 files changed, 3456 insertions(+) create mode 100755 packaging/utc/core-device-policy-manager-tests.spec create mode 100755 packaging/utc/core-device-policy-manager-tests.xml create mode 100755 src/utc/device-policy-manager/CMakeLists.txt create mode 100755 src/utc/device-policy-manager/tct-device-policy-manager-core.c create mode 100755 src/utc/device-policy-manager/tct-device-policy-manager-core_mobile.h create mode 100755 src/utc/device-policy-manager/utc-device-policy-manager-password.c create mode 100755 src/utc/device-policy-manager/utc-device-policy-manager-restriction.c diff --git a/packaging/utc/core-device-policy-manager-tests.spec b/packaging/utc/core-device-policy-manager-tests.spec new file mode 100755 index 0000000..0f2de54 --- /dev/null +++ b/packaging/utc/core-device-policy-manager-tests.spec @@ -0,0 +1,76 @@ +%define MODULE_NAME device-policy-manager +%define MODULE_LIBNAME dpm +Name: core-%{MODULE_NAME}-tests +Summary: Core API unit TC (%{name}) +Version: 0.1 +Release: 0 +Group: Development/Tools +License: Apache License, Version 2.0 +Source0: %{name}-%{version}.tar.gz +BuildRequires: pkgconfig(%{MODULE_LIBNAME}) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: cmake +BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(dlog) + +%description +Core API unit TC (%{name}) + +%prep +%setup -q + +%build + +%define PREFIX "%{_libdir}/%{name}" + +export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed" + +%if %{?ASAN_BUILD:1}0 + %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_TV:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif +%else + %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_TV:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif + %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} + %endif +%endif + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install +mkdir -p %{buildroot}/usr/share/license +cp LICENSE %{buildroot}/usr/share/license/%{name} +mkdir -p %{buildroot}/usr/share/packages/ +cp packaging/utc/%{name}.xml %{buildroot}/usr/share/packages/ +mkdir -p %{buildroot}/usr/apps/%{name}/bin +%post + +%postun + + +%files +/usr/apps/%{name}/* +/usr/share/packages/%{name}.xml +/usr/share/license/%{name} \ No newline at end of file diff --git a/packaging/utc/core-device-policy-manager-tests.xml b/packaging/utc/core-device-policy-manager-tests.xml new file mode 100755 index 0000000..65470aa --- /dev/null +++ b/packaging/utc/core-device-policy-manager-tests.xml @@ -0,0 +1,23 @@ + + + + test + Core API test Application + + + + http://tizen.org/privilege/dpm.password + http://tizen.org/privilege/dpm.camera + http://tizen.org/privilege/dpm.microphone + http://tizen.org/privilege/dpm.location + http://tizen.org/privilege/dpm.storage + http://tizen.org/privilege/dpm.clipboard + http://tizen.org/privilege/dpm.debugging + http://tizen.org/privilege/dpm.wifi + http://tizen.org/privilege/dpm.bluetooth + http://tizen.org/privilege/dpm.usb + http://tizen.org/privilege/dpm.message + http://tizen.org/privilege/dpm.email + http://tizen.org/privilege/dpm.browser + + diff --git a/src/utc/device-policy-manager/CMakeLists.txt b/src/utc/device-policy-manager/CMakeLists.txt new file mode 100755 index 0000000..1656065 --- /dev/null +++ b/src/utc/device-policy-manager/CMakeLists.txt @@ -0,0 +1,36 @@ +SET(PKG_NAME "device-policy-manager") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "dpm") +SET(TC_SOURCES + utc-device-policy-manager-password.c + utc-device-policy-manager-restriction.c +) + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + ${CAPI_LIB} + capi-appfw-application + capi-system-info + glib-2.0 + dlog + elementary +) + +INCLUDE_DIRECTORIES( + ${${CAPI_LIB}_INCLUDE_DIRS} +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + bundle +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${RPM_NAME}/bin +) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie") diff --git a/src/utc/device-policy-manager/tct-device-policy-manager-core.c b/src/utc/device-policy-manager/tct-device-policy-manager-core.c new file mode 100755 index 0000000..5794538 --- /dev/null +++ b/src/utc/device-policy-manager/tct-device-policy-manager-core.c @@ -0,0 +1,140 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#ifdef MOBILE //Starts MOBILE +#include "tct-device-policy-manager-core_mobile.h" +#endif //MOBILE //End MOBILE + +#ifdef WEARABLE //Starts WEARABLE +#include "tct-device-policy-manager-core_wearable.h" +#endif //WEARABLE //End WEARABLE + +#ifdef TV //Starts TV +#include "tct-device-policy-manager-core_tv.h" +#endif //TV //End TV + +#ifdef COMMON_IOT //Starts COMMON_IOT +#include "tct-device-policy-manager-core_common_iot.h" +#endif //COMMON_IOT //End COMMON_IOT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tct_common.h" +#include +#include + +#include + +typedef struct appdata { + Evas_Object *win; + Evas_Object *conform; + Evas_Object *label; +} appdata_s; + +static bool app_create(void *data) +{ + return true; +} + +static void app_control(app_control_h app_control, void *data) +{ + char* pszGetTCName = NULL; + int i=0, result=0, nRet=0; + nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName); + if(nRet != APP_CONTROL_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName); + for ( i = 0; tc_array[i].name; i++ ) + { + if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) ) + { + DUMP_UTC_ERRLOG(); + if ( tc_array[i].startup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName); + tc_array[i].startup(); + } + + dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName); + result = tc_array[i].function(); + dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result); + + if ( tc_array[i].cleanup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName); + tc_array[i].cleanup(); + } + + CLOSE_UTC_ERRLOG(); + PRINT_TC_RESULT("%d",result); + FREE_MEMORY_TC(pszGetTCName); + return; + } + } + + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; +} + +static void app_terminate(void *data) +{ + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__); +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + appdata_s ad = {0,}; + + ui_app_lifecycle_callback_s event_callback = {0,}; + event_callback.create = app_create; + event_callback.terminate = app_terminate; + event_callback.app_control = app_control; + + //setting gcda file location for coverage + setenv("GCOV_PREFIX","/tmp",1); + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__); + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__); + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret); + PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret); + PRINT_TC_RESULT("%d",1); + return ret; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__); + return ret; +} diff --git a/src/utc/device-policy-manager/tct-device-policy-manager-core_mobile.h b/src/utc/device-policy-manager/tct-device-policy-manager-core_mobile.h new file mode 100755 index 0000000..7264b14 --- /dev/null +++ b/src/utc/device-policy-manager/tct-device-policy-manager-core_mobile.h @@ -0,0 +1,318 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef __TCT_DEVICE_POLICY_MANAGER_NATIVE_H__ +#define __TCT_DEVICE_POLICY_MANAGER_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +extern void utc_device_policy_manager_password_startup(void); +extern void utc_device_policy_manager_password_cleanup(void); + +extern int utc_dpm_password_set_quality_p(void); +extern int utc_dpm_password_set_quality_p2(void); +extern int utc_dpm_password_set_quality_p3(void); +extern int utc_dpm_password_set_quality_p4(void); +extern int utc_dpm_password_set_quality_p5(void); +extern int utc_dpm_password_set_quality_p6(void); +extern int utc_dpm_password_get_quality_p(void); +extern int utc_dpm_password_set_minimum_length_p(void); +extern int utc_dpm_password_get_minimum_length_p(void); +extern int utc_dpm_password_set_min_complex_chars_p(void); +extern int utc_dpm_password_get_min_complex_chars_p(void); +extern int utc_dpm_password_set_maximum_failed_attempts_for_wipe_p(void); +extern int utc_dpm_password_get_maximum_failed_attempts_for_wipe_p(void); +extern int utc_dpm_password_set_expires_p(void); +extern int utc_dpm_password_get_expires_p(void); +extern int utc_dpm_password_set_history_p(void); +extern int utc_dpm_password_get_history_p(void); +extern int utc_dpm_password_enforce_change_p(void); +extern int utc_dpm_password_set_max_inactivity_time_device_lock_p(void); +extern int utc_dpm_password_get_max_inactivity_time_device_lock_p(void); +extern int utc_dpm_password_set_status_p(void); +extern int utc_dpm_password_set_pattern_p(void); +extern int utc_dpm_password_get_pattern_p(void); +extern int utc_dpm_password_delete_pattern_p(void); +extern int utc_dpm_password_set_maximum_character_occurrences_p(void); +extern int utc_dpm_password_get_maximum_character_occurrences_p(void); +extern int utc_dpm_password_set_maximum_numeric_sequence_length_p(void); +extern int utc_dpm_password_get_maximum_numeric_sequence_length_p(void); +extern int utc_dpm_password_create_destroy_iterator_p(void); +extern int utc_dpm_password_iterator_next_p(void); +extern int utc_dpm_password_set_forbidden_strings_p(void); + +extern int utc_dpm_password_set_quality_n(void); +extern int utc_dpm_password_get_quality_n(void); +extern int utc_dpm_password_set_minimum_length_n(void); +extern int utc_dpm_password_get_minimum_length_n(void); +extern int utc_dpm_password_set_min_complex_chars_n(void); +extern int utc_dpm_password_get_min_complex_chars_n(void); +extern int utc_dpm_password_set_maximum_failed_attempts_for_wipe_n(void); +extern int utc_dpm_password_get_maximum_failed_attempts_for_wipe_n(void); +extern int utc_dpm_password_set_expires_n(void); +extern int utc_dpm_password_get_expires_n(void); +extern int utc_dpm_password_set_history_n(void); +extern int utc_dpm_password_get_history_n(void); +extern int utc_dpm_password_enforce_change_n(void); +extern int utc_dpm_password_set_max_inactivity_time_device_lock_n(void); +extern int utc_dpm_password_get_max_inactivity_time_device_lock_n(void); +extern int utc_dpm_password_set_status_n(void); +extern int utc_dpm_password_set_pattern_n(void); +extern int utc_dpm_password_get_pattern_n(void); +extern int utc_dpm_password_delete_pattern_n(void); +extern int utc_dpm_password_set_maximum_character_occurrences_n(void); +extern int utc_dpm_password_get_maximum_character_occurrences_n(void); +extern int utc_dpm_password_set_maximum_numeric_sequence_length_n(void); +extern int utc_dpm_password_get_maximum_numeric_sequence_length_n(void); +extern int utc_dpm_password_create_iterator_n(void); +extern int utc_dpm_password_destroy_iterator_n(void); +extern int utc_dpm_password_iterator_next_n(void); +extern int utc_dpm_password_iterator_next_n2(void); +extern int utc_dpm_password_set_forbidden_strings_n(void); + +extern void utc_device_policy_manager_restriction_startup(void); +extern void utc_device_policy_manager_restriction_cleanup(void); + +extern int utc_dpm_restriction_set_camera_state_p(void); +extern int utc_dpm_restriction_set_camera_state_p2(void); +extern int utc_dpm_restriction_get_camera_state_p(void); +extern int utc_dpm_restriction_set_microphone_state_p(void); +extern int utc_dpm_restriction_set_microphone_state_p2(void); +extern int utc_dpm_restriction_get_microphone_state_p(void); +extern int utc_dpm_restriction_set_location_state_p(void); +extern int utc_dpm_restriction_set_location_state_p2(void); +extern int utc_dpm_restriction_get_location_state_p(void); +extern int utc_dpm_restriction_set_clipboard_state_p(void); +extern int utc_dpm_restriction_set_clipboard_state_p2(void); +extern int utc_dpm_restriction_get_clipboard_state_p(void); +extern int utc_dpm_restriction_set_usb_debugging_state_p(void); +extern int utc_dpm_restriction_set_usb_debugging_state_p2(void); +extern int utc_dpm_restriction_get_usb_debugging_state_p(void); +extern int utc_dpm_restriction_set_wifi_state_p(void); +extern int utc_dpm_restriction_set_wifi_state_p2(void); +extern int utc_dpm_restriction_get_wifi_state_p(void); +extern int utc_dpm_restriction_set_wifi_hotspot_state_p(void); +extern int utc_dpm_restriction_set_wifi_hotspot_state_p2(void); +extern int utc_dpm_restriction_get_wifi_hotspot_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_tethering_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_tethering_state_p2(void); +extern int utc_dpm_restriction_get_bluetooth_tethering_state_p(void); +extern int utc_dpm_restriction_set_usb_tethering_state_p(void); +extern int utc_dpm_restriction_set_usb_tethering_state_p2(void); +extern int utc_dpm_restriction_get_usb_tethering_state_p(void); +extern int utc_dpm_restriction_set_external_storage_state_p(void); +extern int utc_dpm_restriction_set_external_storage_state_p2(void); +extern int utc_dpm_restriction_get_external_storage_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_mode_change_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_mode_change_state_p2(void); +extern int utc_dpm_restriction_get_bluetooth_mode_change_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p2(void); +extern int utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_pairing_state_p(void); +extern int utc_dpm_restriction_set_bluetooth_pairing_state_p2(void); +extern int utc_dpm_restriction_get_bluetooth_pairing_state_p(void); +extern int utc_dpm_restriction_set_popimap_email_state_p(void); +extern int utc_dpm_restriction_set_popimap_email_state_p2(void); +extern int utc_dpm_restriction_get_popimap_email_state_p(void); +extern int utc_dpm_restriction_set_messaging_state_p(void); +extern int utc_dpm_restriction_set_messaging_state_p2(void); +extern int utc_dpm_restriction_get_messaging_state_p(void); +extern int utc_dpm_restriction_set_browser_state_p(void); +extern int utc_dpm_restriction_set_browser_state_p2(void); +extern int utc_dpm_restriction_get_browser_state_p(void); + +extern int utc_dpm_restriction_set_camera_state_n(void); +extern int utc_dpm_restriction_get_camera_state_n(void); +extern int utc_dpm_restriction_set_microphone_state_n(void); +extern int utc_dpm_restriction_get_microphone_state_n(void); +extern int utc_dpm_restriction_set_location_state_n(void); +extern int utc_dpm_restriction_get_location_state_n(void); +extern int utc_dpm_restriction_set_clipboard_state_n(void); +extern int utc_dpm_restriction_get_clipboard_state_n(void); +extern int utc_dpm_restriction_set_usb_debugging_state_n(void); +extern int utc_dpm_restriction_get_usb_debugging_state_n(void); +extern int utc_dpm_restriction_set_wifi_state_n(void); +extern int utc_dpm_restriction_get_wifi_state_n(void); +extern int utc_dpm_restriction_set_wifi_hotspot_state_n(void); +extern int utc_dpm_restriction_get_wifi_hotspot_state_n(void); +extern int utc_dpm_restriction_set_bluetooth_tethering_state_n(void); +extern int utc_dpm_restriction_get_bluetooth_tethering_state_n(void); +extern int utc_dpm_restriction_set_usb_tethering_state_n(void); +extern int utc_dpm_restriction_get_usb_tethering_state_n(void); +extern int utc_dpm_restriction_set_external_storage_state_n(void); +extern int utc_dpm_restriction_get_external_storage_state_n(void); +extern int utc_dpm_restriction_set_bluetooth_mode_change_state_n(void); +extern int utc_dpm_restriction_get_bluetooth_mode_change_state_n(void); +extern int utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_n(void); +extern int utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_n(void); +extern int utc_dpm_restriction_set_bluetooth_pairing_state_n(void); +extern int utc_dpm_restriction_get_bluetooth_pairing_state_n(void); +extern int utc_dpm_restriction_set_popimap_email_state_n(void); +extern int utc_dpm_restriction_get_popimap_email_state_n(void); +extern int utc_dpm_restriction_set_messaging_state_n(void); +extern int utc_dpm_restriction_get_messaging_state_n(void); +extern int utc_dpm_restriction_set_browser_state_n(void); +extern int utc_dpm_restriction_get_browser_state_n(void); + +testcase tc_array[] = { + {"utc_dpm_password_set_quality_p", utc_dpm_password_set_quality_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_quality_p2", utc_dpm_password_set_quality_p2, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_quality_p3", utc_dpm_password_set_quality_p3, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_quality_p4", utc_dpm_password_set_quality_p4, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_quality_p5", utc_dpm_password_set_quality_p5, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_quality_p6", utc_dpm_password_set_quality_p6, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_quality_p", utc_dpm_password_get_quality_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_minimum_length_p", utc_dpm_password_set_minimum_length_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_minimum_length_p", utc_dpm_password_get_minimum_length_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_min_complex_chars_p", utc_dpm_password_set_min_complex_chars_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_min_complex_chars_p", utc_dpm_password_get_min_complex_chars_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_maximum_failed_attempts_for_wipe_p", utc_dpm_password_set_maximum_failed_attempts_for_wipe_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_maximum_failed_attempts_for_wipe_p", utc_dpm_password_get_maximum_failed_attempts_for_wipe_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_expires_p", utc_dpm_password_set_expires_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_expires_p", utc_dpm_password_get_expires_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_history_p", utc_dpm_password_set_history_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_history_p", utc_dpm_password_get_history_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_enforce_change_p", utc_dpm_password_enforce_change_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_max_inactivity_time_device_lock_p", utc_dpm_password_set_max_inactivity_time_device_lock_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_max_inactivity_time_device_lock_p", utc_dpm_password_get_max_inactivity_time_device_lock_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_status_p", utc_dpm_password_set_status_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_pattern_p", utc_dpm_password_set_pattern_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_pattern_p", utc_dpm_password_get_pattern_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_delete_pattern_p", utc_dpm_password_delete_pattern_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_maximum_character_occurrences_p", utc_dpm_password_set_maximum_character_occurrences_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_maximum_character_occurrences_p", utc_dpm_password_get_maximum_character_occurrences_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_maximum_numeric_sequence_length_p", utc_dpm_password_set_maximum_numeric_sequence_length_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_maximum_numeric_sequence_length_p", utc_dpm_password_get_maximum_numeric_sequence_length_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_create_destroy_iterator_p", utc_dpm_password_create_destroy_iterator_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_iterator_next_p", utc_dpm_password_iterator_next_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_forbidden_strings_p", utc_dpm_password_set_forbidden_strings_p, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + + {"utc_dpm_password_set_quality_n", utc_dpm_password_set_quality_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_quality_n", utc_dpm_password_get_quality_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_minimum_length_n", utc_dpm_password_set_minimum_length_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_minimum_length_n", utc_dpm_password_get_minimum_length_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_min_complex_chars_n", utc_dpm_password_set_min_complex_chars_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_min_complex_chars_n", utc_dpm_password_get_min_complex_chars_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_maximum_failed_attempts_for_wipe_n", utc_dpm_password_set_maximum_failed_attempts_for_wipe_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_maximum_failed_attempts_for_wipe_n", utc_dpm_password_get_maximum_failed_attempts_for_wipe_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_expires_n", utc_dpm_password_set_expires_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_expires_n", utc_dpm_password_get_expires_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_history_n", utc_dpm_password_set_history_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_history_n", utc_dpm_password_get_history_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_enforce_change_n", utc_dpm_password_enforce_change_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_max_inactivity_time_device_lock_n", utc_dpm_password_set_max_inactivity_time_device_lock_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_max_inactivity_time_device_lock_n", utc_dpm_password_get_max_inactivity_time_device_lock_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_status_n", utc_dpm_password_set_status_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_pattern_n", utc_dpm_password_set_pattern_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_pattern_n", utc_dpm_password_get_pattern_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_delete_pattern_n", utc_dpm_password_delete_pattern_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_maximum_character_occurrences_n", utc_dpm_password_set_maximum_character_occurrences_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_maximum_character_occurrences_n", utc_dpm_password_get_maximum_character_occurrences_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_maximum_numeric_sequence_length_n", utc_dpm_password_set_maximum_numeric_sequence_length_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_get_maximum_numeric_sequence_length_n", utc_dpm_password_get_maximum_numeric_sequence_length_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_create_iterator_n", utc_dpm_password_create_iterator_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_destroy_iterator_n", utc_dpm_password_destroy_iterator_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_iterator_next_n", utc_dpm_password_iterator_next_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_iterator_next_n2", utc_dpm_password_iterator_next_n2, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_password_set_forbidden_strings_n", utc_dpm_password_set_forbidden_strings_n, utc_device_policy_manager_password_startup, utc_device_policy_manager_password_cleanup}, + + {"utc_dpm_restriction_set_camera_state_p", utc_dpm_restriction_set_camera_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_camera_state_p2", utc_dpm_restriction_set_camera_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_camera_state_p", utc_dpm_restriction_get_camera_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_microphone_state_p", utc_dpm_restriction_set_microphone_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_microphone_state_p2", utc_dpm_restriction_set_microphone_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_microphone_state_p", utc_dpm_restriction_get_microphone_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_location_state_p", utc_dpm_restriction_set_location_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_location_state_p2", utc_dpm_restriction_set_location_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_location_state_p", utc_dpm_restriction_get_location_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_clipboard_state_p", utc_dpm_restriction_set_clipboard_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_clipboard_state_p2", utc_dpm_restriction_set_clipboard_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_clipboard_state_p", utc_dpm_restriction_get_clipboard_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_usb_debugging_state_p", utc_dpm_restriction_set_usb_debugging_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_usb_debugging_state_p2", utc_dpm_restriction_set_usb_debugging_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_usb_debugging_state_p", utc_dpm_restriction_get_usb_debugging_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_wifi_state_p", utc_dpm_restriction_set_wifi_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_wifi_state_p2", utc_dpm_restriction_set_wifi_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_wifi_state_p", utc_dpm_restriction_get_wifi_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_wifi_hotspot_state_p", utc_dpm_restriction_set_wifi_hotspot_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_wifi_hotspot_state_p2", utc_dpm_restriction_set_wifi_hotspot_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_wifi_hotspot_state_p", utc_dpm_restriction_get_wifi_hotspot_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_bluetooth_tethering_state_p", utc_dpm_restriction_set_bluetooth_tethering_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_set_bluetooth_tethering_state_p2", utc_dpm_restriction_set_bluetooth_tethering_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_restriction_cleanup}, + {"utc_dpm_restriction_get_bluetooth_tethering_state_p", utc_dpm_restriction_get_bluetooth_tethering_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_usb_tethering_state_p", utc_dpm_restriction_set_usb_tethering_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_usb_tethering_state_p2", utc_dpm_restriction_set_usb_tethering_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_usb_tethering_state_p", utc_dpm_restriction_get_usb_tethering_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_external_storage_state_p", utc_dpm_restriction_set_external_storage_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_external_storage_state_p2", utc_dpm_restriction_set_external_storage_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_external_storage_state_p", utc_dpm_restriction_get_external_storage_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_mode_change_state_p", utc_dpm_restriction_set_bluetooth_mode_change_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_mode_change_state_p2", utc_dpm_restriction_set_bluetooth_mode_change_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_bluetooth_mode_change_state_p", utc_dpm_restriction_get_bluetooth_mode_change_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p", utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p2", utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_p", utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_pairing_state_p", utc_dpm_restriction_set_bluetooth_pairing_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_pairing_state_p2", utc_dpm_restriction_set_bluetooth_pairing_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_bluetooth_pairing_state_p", utc_dpm_restriction_get_bluetooth_pairing_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_popimap_email_state_p", utc_dpm_restriction_set_popimap_email_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_popimap_email_state_p2", utc_dpm_restriction_set_popimap_email_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_popimap_email_state_p", utc_dpm_restriction_get_popimap_email_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_messaging_state_p", utc_dpm_restriction_set_messaging_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_messaging_state_p2", utc_dpm_restriction_set_messaging_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_messaging_state_p", utc_dpm_restriction_get_messaging_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_browser_state_p", utc_dpm_restriction_set_browser_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_browser_state_p2", utc_dpm_restriction_set_browser_state_p2, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_browser_state_p", utc_dpm_restriction_get_browser_state_p, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + + {"utc_dpm_restriction_set_camera_state_n", utc_dpm_restriction_set_camera_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_camera_state_n", utc_dpm_restriction_get_camera_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_microphone_state_n", utc_dpm_restriction_set_microphone_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_microphone_state_n", utc_dpm_restriction_get_microphone_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_location_state_n", utc_dpm_restriction_set_location_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_location_state_n", utc_dpm_restriction_get_location_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_clipboard_state_n", utc_dpm_restriction_set_clipboard_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_clipboard_state_n", utc_dpm_restriction_get_clipboard_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_usb_debugging_state_n", utc_dpm_restriction_set_usb_debugging_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_usb_debugging_state_n", utc_dpm_restriction_get_usb_debugging_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_wifi_state_n", utc_dpm_restriction_set_wifi_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_wifi_state_n", utc_dpm_restriction_get_wifi_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_wifi_hotspot_state_n", utc_dpm_restriction_set_wifi_hotspot_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_wifi_hotspot_state_n", utc_dpm_restriction_get_wifi_hotspot_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_tethering_state_n", utc_dpm_restriction_set_bluetooth_tethering_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_bluetooth_tethering_state_n", utc_dpm_restriction_get_bluetooth_tethering_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_usb_tethering_state_n", utc_dpm_restriction_set_usb_tethering_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_usb_tethering_state_n", utc_dpm_restriction_get_usb_tethering_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_external_storage_state_n", utc_dpm_restriction_set_external_storage_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_external_storage_state_n", utc_dpm_restriction_get_external_storage_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_mode_change_state_n", utc_dpm_restriction_set_bluetooth_mode_change_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_bluetooth_mode_change_state_n", utc_dpm_restriction_get_bluetooth_mode_change_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_n", utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_n", utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_bluetooth_pairing_state_n", utc_dpm_restriction_set_bluetooth_pairing_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_bluetooth_pairing_state_n", utc_dpm_restriction_get_bluetooth_pairing_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_popimap_email_state_n", utc_dpm_restriction_set_popimap_email_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_popimap_email_state_n", utc_dpm_restriction_get_popimap_email_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_messaging_state_n", utc_dpm_restriction_set_messaging_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_messaging_state_n", utc_dpm_restriction_get_messaging_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_set_browser_state_n", utc_dpm_restriction_set_browser_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + {"utc_dpm_restriction_get_browser_state_n", utc_dpm_restriction_get_browser_state_n, utc_device_policy_manager_restriction_startup, utc_device_policy_manager_password_cleanup}, + + {NULL, NULL} +}; + +#endif // __TCT_DEVICE_POLICY_MANAGER_NATIVE_H__ diff --git a/src/utc/device-policy-manager/utc-device-policy-manager-password.c b/src/utc/device-policy-manager/utc-device-policy-manager-password.c new file mode 100755 index 0000000..3aa3adf --- /dev/null +++ b/src/utc/device-policy-manager/utc-device-policy-manager-password.c @@ -0,0 +1,1197 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "assert.h" +#include +#include +#include +#include + +#define INT_NEGATIVE -1 +device_policy_manager_h handle; + +/** + * @function utc_device_policy_manager_password_startup + * @descripton Called before each test + * @parameter NA + * @return NA + */ +void utc_device_policy_manager_password_startup(void) +{ + handle = NULL; + handle = dpm_manager_create(); + + if (handle == NULL) { + fprintf(stderr, "dpm_manager_create failed %s:%d\n", __FILE__, __LINE__); + return; + } +} + +/** + * @function utc_device_policy_manager_password_cleanup + * @descripton Called after each test + * @parameter NA + * @return NA + */ +void utc_device_policy_manager_password_cleanup(void) +{ + if (handle != NULL) + dpm_manager_destroy(handle); +} + + +/** + * @testcase utc_dpm_password_set_quality_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_quality + */ +int utc_dpm_password_set_quality_p(void) +{ + int ret; + dpm_password_quality_e origin_quality, check_quality; + + assert(handle); + ret = dpm_password_get_quality(handle, &origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_quality(handle, DPM_PASSWORD_QUALITY_UNSPECIFIED); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_quality(handle, &check_quality); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_quality, DPM_PASSWORD_QUALITY_UNSPECIFIED); + + ret = dpm_password_set_quality(handle, origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_quality_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_quality + */ +int utc_dpm_password_set_quality_p2(void) +{ + int ret; + dpm_password_quality_e origin_quality, check_quality; + + assert(handle); + ret = dpm_password_get_quality(handle, &origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_quality(handle, DPM_PASSWORD_QUALITY_SIMPLE_PASSWORD); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_quality(handle, &check_quality); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_quality, DPM_PASSWORD_QUALITY_SIMPLE_PASSWORD); + + ret = dpm_password_set_quality(handle, origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_quality_p3 + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_quality + */ +int utc_dpm_password_set_quality_p3(void) +{ + int ret; + dpm_password_quality_e origin_quality, check_quality; + + assert(handle); + ret = dpm_password_get_quality(handle, &origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_quality(handle, DPM_PASSWORD_QUALITY_SOMETHING); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_quality(handle, &check_quality); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_quality, DPM_PASSWORD_QUALITY_SOMETHING); + + ret = dpm_password_set_quality(handle, origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_quality_p4 + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_quality + */ +int utc_dpm_password_set_quality_p4(void) +{ + int ret; + dpm_password_quality_e origin_quality, check_quality; + + assert(handle); + ret = dpm_password_get_quality(handle, &origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_quality(handle, DPM_PASSWORD_QUALITY_NUMERIC); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_quality(handle, &check_quality); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_quality, DPM_PASSWORD_QUALITY_NUMERIC); + + ret = dpm_password_set_quality(handle, origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_quality_p5 + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_quality + */ +int utc_dpm_password_set_quality_p5(void) +{ + int ret; + dpm_password_quality_e origin_quality, check_quality; + + assert(handle); + ret = dpm_password_get_quality(handle, &origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_quality(handle, DPM_PASSWORD_QUALITY_ALPHABETIC); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_quality(handle, &check_quality); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_quality, DPM_PASSWORD_QUALITY_ALPHABETIC); + + ret = dpm_password_set_quality(handle, origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_quality_p6 + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_quality + */ +int utc_dpm_password_set_quality_p6(void) +{ + int ret; + dpm_password_quality_e origin_quality, check_quality; + + assert(handle); + ret = dpm_password_get_quality(handle, &origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_quality(handle, DPM_PASSWORD_QUALITY_ALPHANUMERIC); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_quality(handle, &check_quality); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_quality, DPM_PASSWORD_QUALITY_ALPHANUMERIC); + + ret = dpm_password_set_quality(handle, origin_quality); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_quality_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_quality + */ +int utc_dpm_password_set_quality_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_quality(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_quality_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_quality + */ +int utc_dpm_password_get_quality_p(void) +{ + int ret; + dpm_password_quality_e quality; + + assert(handle); + ret = dpm_password_get_quality(handle, &quality); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_quality_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_quality + */ +int utc_dpm_password_get_quality_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_quality(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_minimum_length_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_minimum_length + */ +int utc_dpm_password_set_minimum_length_p(void) +{ + int ret; + int min_len = 10; + int origin_len, check_len; + + assert(handle); + ret = dpm_password_get_minimum_length(handle, &origin_len); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_minimum_length(handle, min_len); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_minimum_length(handle, &check_len); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_len, min_len); + + ret = dpm_password_set_minimum_length(handle, origin_len); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_minimum_length_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_minimum_length + */ +int utc_dpm_password_set_minimum_length_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_minimum_length(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_minimum_length_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_minimum_length + */ +int utc_dpm_password_get_minimum_length_p(void) +{ + int ret; + int min_len; + + assert(handle); + ret = dpm_password_get_minimum_length(handle, &min_len); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_minimum_length_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_minimum_length + */ +int utc_dpm_password_get_minimum_length_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_minimum_length(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_min_complex_chars_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_min_complex_chars + */ +int utc_dpm_password_set_min_complex_chars_p(void) +{ + int ret; + int min_len = 2; + int origin_min, check_min; + + assert(handle); + ret = dpm_password_get_min_complex_chars(handle, &origin_min); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_min_complex_chars(handle, min_len); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_min_complex_chars(handle, &check_min); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_min, min_len); + + ret = dpm_password_set_min_complex_chars(handle, origin_min); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_min_complex_chars_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_min_complex_chars + */ +int utc_dpm_password_set_min_complex_chars_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_min_complex_chars(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_min_complex_chars_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_min_complex_chars + */ +int utc_dpm_password_get_min_complex_chars_p(void) +{ + int ret; + int min_len; + + assert(handle); + ret = dpm_password_get_min_complex_chars(handle, &min_len); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_min_complex_chars_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_min_complex_chars + */ +int utc_dpm_password_get_min_complex_chars_n(void) +{ + int ret; + + assert(handle); + ret =dpm_password_get_min_complex_chars(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_maximum_failed_attempts_for_wipe_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_maximum_failed_attempts_for_wipe + */ +int utc_dpm_password_set_maximum_failed_attempts_for_wipe_p(void) +{ + int ret; + int max_attempt = 10; + int origin_max, check_max; + + assert(handle); + ret = dpm_password_get_maximum_failed_attempts_for_wipe(handle, &origin_max); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_maximum_failed_attempts_for_wipe(handle, max_attempt); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_maximum_failed_attempts_for_wipe(handle, &check_max); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_max, max_attempt); + + ret = dpm_password_set_maximum_failed_attempts_for_wipe(handle, origin_max); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_maximum_failed_attempts_for_wipe_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_maximum_failed_attempts_for_wipe + */ +int utc_dpm_password_set_maximum_failed_attempts_for_wipe_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_maximum_failed_attempts_for_wipe(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_maximum_failed_attempts_for_wipe_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_maximum_failed_attempts_for_wipe + */ +int utc_dpm_password_get_maximum_failed_attempts_for_wipe_p(void) +{ + int ret; + int max_attempt; + + assert(handle); + ret = dpm_password_get_maximum_failed_attempts_for_wipe(handle, &max_attempt); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_maximum_failed_attempts_for_wipe_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_maximum_failed_attempts_for_wipe + */ +int utc_dpm_password_get_maximum_failed_attempts_for_wipe_n(void) +{ + int ret; + + assert(handle); + ret =dpm_password_get_maximum_failed_attempts_for_wipe(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_expires_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_expires + */ +int utc_dpm_password_set_expires_p(void) +{ + int ret; + int day_expires = 100; + int origin_expires, check_expires; + + assert(handle); + ret = dpm_password_get_expires(handle, &origin_expires); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_expires(handle, day_expires); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_expires(handle, &check_expires); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_expires, day_expires); + + ret = dpm_password_set_expires(handle, origin_expires); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_expires_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_expires + */ +int utc_dpm_password_set_expires_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_expires(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_expires_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_expires + */ +int utc_dpm_password_get_expires_p(void) +{ + int ret; + int day_expires; + + assert(handle); + ret = dpm_password_get_expires(handle, &day_expires); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_expires_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_expires + */ +int utc_dpm_password_get_expires_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_expires(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_history_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_history + */ +int utc_dpm_password_set_history_p(void) +{ + int ret; + int min_history = 3; + int origin_history, check_history; + + assert(handle); + ret = dpm_password_get_history(handle, &origin_history); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_history(handle, min_history); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_history(handle, &check_history); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_history, min_history); + + ret = dpm_password_set_history(handle, origin_history); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_history_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_history + */ +int utc_dpm_password_set_history_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_history(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_history_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_history + */ +int utc_dpm_password_get_history_p(void) +{ + int ret; + int min_history; + + assert(handle); + ret = dpm_password_get_history(handle, &min_history); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_history_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_history + */ +int utc_dpm_password_get_history_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_history(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_enforce_change_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_enforce_change + */ +int utc_dpm_password_enforce_change_p(void) +{ + int ret; + + assert(handle); + ret = dpm_password_enforce_change(handle); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_enforce_change_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_enforce_change + */ +int utc_dpm_password_enforce_change_n(void) +{ + int ret; + + ret = dpm_password_enforce_change(NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_max_inactivity_time_device_lock_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_max_inactivity_time_device_lock + */ +int utc_dpm_password_set_max_inactivity_time_device_lock_p(void) +{ + int ret; + int max_time = 30; + int origin_time, check_time; + + assert(handle); + ret = dpm_password_get_max_inactivity_time_device_lock(handle, &origin_time); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_max_inactivity_time_device_lock(handle, max_time); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_max_inactivity_time_device_lock(handle, &check_time); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_time, max_time); + + ret = dpm_password_set_max_inactivity_time_device_lock(handle, origin_time); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_max_inactivity_time_device_lock_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_max_inactivity_time_device_lock + */ +int utc_dpm_password_set_max_inactivity_time_device_lock_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_max_inactivity_time_device_lock(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_max_inactivity_time_device_lock_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_max_inactivity_time_device_lock + */ +int utc_dpm_password_get_max_inactivity_time_device_lock_p(void) +{ + int ret; + int max_time; + + assert(handle); + ret = dpm_password_get_max_inactivity_time_device_lock(handle, &max_time); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_max_inactivity_time_device_lock_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_max_inactivity_time_device_lock + */ +int utc_dpm_password_get_max_inactivity_time_device_lock_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_max_inactivity_time_device_lock(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_status_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_status + */ +int utc_dpm_password_set_status_p(void) +{ + int ret; + int max_time; + + assert(handle); + ret = dpm_password_set_status(handle, DPM_PASSWORD_STATUS_NOT_CHANGED); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_set_status(handle, DPM_PASSWORD_STATUS_CHANGED); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_status_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_status + */ +int utc_dpm_password_set_status_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_status(handle, DPM_PASSWORD_STATUS_MAX_ATTEMPTS_EXCEEDED); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_pattern_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_pattern + */ +int utc_dpm_password_set_pattern_p(void) +{ + int ret; + char* pattern = "[a-zA-Z]{4}[0-9]{4}"; + char* check_pattern, *origin_pattern; + + assert(handle); + ret = dpm_password_get_pattern(handle, &origin_pattern); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_pattern(handle, pattern); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_get_pattern(handle, &check_pattern); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(strcmp(check_pattern, pattern), 0); + + ret = dpm_password_set_pattern(handle, origin_pattern); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_pattern_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_pattern + */ +int utc_dpm_password_set_pattern_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_pattern(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_pattern_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_pattern + */ +int utc_dpm_password_get_pattern_p(void) +{ + int ret; + char* pattern; + + assert(handle); + ret = dpm_password_get_pattern(handle, &pattern); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_pattern_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_pattern + */ +int utc_dpm_password_get_pattern_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_pattern(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_delete_pattern_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_delete_pattern + */ +int utc_dpm_password_delete_pattern_p(void) +{ + int ret; + char* origin_pattern; + + assert(handle); + ret = dpm_password_get_pattern(handle, &origin_pattern); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_delete_pattern(handle); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_pattern(handle, origin_pattern); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_delete_pattern_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_delete_pattern + */ +int utc_dpm_password_delete_pattern_n(void) +{ + int ret; + + ret = dpm_password_delete_pattern(NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_maximum_character_occurrences_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_maximum_character_occurrences + */ +int utc_dpm_password_set_maximum_character_occurrences_p(void) +{ + int ret; + int max_char_occur = 5; + int origin_max, check_max; + + assert(handle); + ret = dpm_password_get_maximum_character_occurrences(handle, &origin_max); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_maximum_character_occurrences(handle, max_char_occur); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_maximum_character_occurrences(handle, &check_max); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_max, max_char_occur); + + ret = dpm_password_set_maximum_character_occurrences(handle, origin_max); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_maximum_character_occurrences_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_maximum_character_occurrences + */ +int utc_dpm_password_set_maximum_character_occurrences_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_maximum_character_occurrences(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_maximum_character_occurrences_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_maximum_character_occurrences + */ +int utc_dpm_password_get_maximum_character_occurrences_p(void) +{ + int ret; + int max_char_occur; + + assert(handle); + ret = dpm_password_get_maximum_character_occurrences(handle, &max_char_occur); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_maximum_character_occurrences_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_maximum_character_occurrences + */ +int utc_dpm_password_get_maximum_character_occurrences_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_maximum_character_occurrences(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_maximum_numeric_sequence_length_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_maximum_numeric_sequence_length + */ +int utc_dpm_password_set_maximum_numeric_sequence_length_p(void) +{ + int ret; + int max_num_seq_len = 3; + int origin_len, check_len; + + assert(handle); + ret = dpm_password_get_maximum_numeric_sequence_length(handle, &origin_len); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_maximum_numeric_sequence_length(handle, max_num_seq_len); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_password_get_maximum_numeric_sequence_length(handle, &check_len); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_len, max_num_seq_len); + + ret = dpm_password_set_maximum_numeric_sequence_length(handle, origin_len); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_maximum_numeric_sequence_length_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_maximum_numeric_sequence_length + */ +int utc_dpm_password_set_maximum_numeric_sequence_length_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_maximum_numeric_sequence_length(handle, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_maximum_numeric_sequence_length_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_get_maximum_numeric_sequence_length + */ +int utc_dpm_password_get_maximum_numeric_sequence_length_p(void) +{ + int ret; + int max_num_seq_len; + + assert(handle); + ret = dpm_password_get_maximum_numeric_sequence_length(handle, &max_num_seq_len); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_get_maximum_numeric_sequence_length_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_get_maximum_numeric_sequence_length + */ +int utc_dpm_password_get_maximum_numeric_sequence_length_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_get_maximum_numeric_sequence_length(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_create_destroy_iterator_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_create_destroy_iterator + */ +int utc_dpm_password_create_destroy_iterator_p(void) +{ + int ret; + dpm_password_iterator_h iter = NULL; + + assert(handle); + iter = dpm_password_create_iterator(handle); + assert_neq(iter, NULL); + + ret = dpm_password_destroy_iterator(iter); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_create_iterator_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_create_iterator + */ +int utc_dpm_password_create_iterator_n(void) +{ + dpm_password_iterator_h iter = NULL; + + iter = dpm_password_create_iterator(NULL); + assert_eq(iter, NULL); + + return 0; +} + +/** + * @testcase utc_dpm_password_destroy_iterator_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_destroy_iterator + */ +int utc_dpm_password_destroy_iterator_n(void) +{ + int ret; + + ret = dpm_password_destroy_iterator(NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_iterator_next_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_iterator_next + */ +int utc_dpm_password_iterator_next_p(void) +{ + int ret; + dpm_password_iterator_h iter = NULL; + const char* forbidden_str; + + assert(handle); + iter = dpm_password_create_iterator(handle); + assert_neq(iter, NULL); + + ret = dpm_password_iterator_next(iter, &forbidden_str); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_destroy_iterator(iter); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_iterator_next_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_iterator_next + */ +int utc_dpm_password_iterator_next_n(void) +{ + int ret; + dpm_password_iterator_h iter = NULL; + + assert(handle); + iter = dpm_password_create_iterator(handle); + assert_neq(iter, NULL); + + ret = dpm_password_iterator_next(iter, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + ret = dpm_password_destroy_iterator(iter); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_iterator_next_n2 + * @since_tizen 3.0 + * @description Negative test case of dpm_password_iterator_next + */ +int utc_dpm_password_iterator_next_n2(void) +{ + int ret; + const char* forbidden_str; + + ret = dpm_password_iterator_next(NULL, &forbidden_str); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_forbidden_strings_p + * @since_tizen 3.0 + * @description Positive test case of dpm_password_set_forbidden_strings + */ +int utc_dpm_password_set_forbidden_strings_p(void) +{ + int ret; + const char* forbidden_strings[] = {"tizen"}; + const char* clear_strings[] = {""}; + + assert(handle); + ret = dpm_password_set_forbidden_strings(handle, forbidden_strings, 1); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_password_set_forbidden_strings(handle, clear_strings, 1); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_password_set_forbidden_strings_n + * @since_tizen 3.0 + * @description Negative test case of dpm_password_set_forbidden_strings + */ +int utc_dpm_password_set_forbidden_strings_n(void) +{ + int ret; + + assert(handle); + ret = dpm_password_set_forbidden_strings(handle, NULL, 0); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} diff --git a/src/utc/device-policy-manager/utc-device-policy-manager-restriction.c b/src/utc/device-policy-manager/utc-device-policy-manager-restriction.c new file mode 100755 index 0000000..9ff0573 --- /dev/null +++ b/src/utc/device-policy-manager/utc-device-policy-manager-restriction.c @@ -0,0 +1,1666 @@ +// +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "assert.h" +#include +#include +#include +#include + +device_policy_manager_h handle; + +#define ALLOW 1 +#define DISALLOW 0 +#define INT_NEGATIVE -1 + +/** + * @function utc_device_policy_manager_restriction_startup + * @descripton Called before each test + * @parameter NA + * @return NA + */ +void utc_device_policy_manager_restriction_startup(void) +{ + handle = NULL; + handle = dpm_manager_create(); + + if (handle == NULL) { + fprintf(stderr, "dpm_manager_create failed %s:%d\n", __FILE__, __LINE__); + return; + } +} + +/** + * @function utc_device_policy_manager_restriction_cleanup + * @descripton Called after each test + * @parameter NA + * @return NA + */ +void utc_device_policy_manager_restriction_cleanup(void) +{ + if (handle != NULL) + dpm_manager_destroy(handle); +} + + +/** + * @testcase utc_dpm_restriction_set_camera_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_camera_state + */ +int utc_dpm_restriction_set_camera_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_camera_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_camera_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_get_camera_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_camera_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_camera_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_camera_state + */ +int utc_dpm_restriction_set_camera_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_camera_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_camera_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_get_camera_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_camera_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_camera_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_camera_state + */ +int utc_dpm_restriction_set_camera_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_camera_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_camera_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_camera_state + */ +int utc_dpm_restriction_get_camera_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_camera_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_camera_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_camera_state + */ +int utc_dpm_restriction_get_camera_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_camera_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_microphone_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_microphone_state + */ +int utc_dpm_restriction_set_microphone_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_microphone_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_microphone_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_microphone_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_microphone_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_microphone_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_microphone_state + */ +int utc_dpm_restriction_set_microphone_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_microphone_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_microphone_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_microphone_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_microphone_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_microphone_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_microphone_state + */ +int utc_dpm_restriction_set_microphone_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_microphone_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_microphone_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_microphone_state + */ +int utc_dpm_restriction_get_microphone_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_microphone_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_microphone_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_microphone_state + */ +int utc_dpm_restriction_get_microphone_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_microphone_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_location_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_location_state + */ +int utc_dpm_restriction_set_location_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_location_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_location_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_location_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_location_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_location_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_location_state + */ +int utc_dpm_restriction_set_location_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_location_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_location_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_location_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_location_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_location_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_location_state + */ +int utc_dpm_restriction_set_location_state_n(void) +{ + int ret; + + ret =dpm_restriction_set_location_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_location_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_location_state + */ +int utc_dpm_restriction_get_location_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_location_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_location_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_location_state + */ +int utc_dpm_restriction_get_location_state_n(void) +{ + int ret; + + assert(handle); + ret =dpm_restriction_get_location_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_clipboard_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_clipboard_state + */ +int utc_dpm_restriction_set_clipboard_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_clipboard_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_clipboard_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_clipboard_state(handle, &check_state); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_clipboard_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_clipboard_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_clipboard_state + */ +int utc_dpm_restriction_set_clipboard_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_clipboard_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_clipboard_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_clipboard_state(handle, &check_state); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_clipboard_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_clipboard_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_clipboard_state + */ +int utc_dpm_restriction_set_clipboard_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_clipboard_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_clipboard_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_clipboard_state + */ +int utc_dpm_restriction_get_clipboard_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_clipboard_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_clipboard_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_clipboard_state + */ +int utc_dpm_restriction_get_clipboard_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_clipboard_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_usb_debugging_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_usb_debugging_state + */ +int utc_dpm_restriction_set_usb_debugging_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_usb_debugging_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_usb_debugging_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_usb_debugging_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_usb_debugging_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_usb_debugging_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_usb_debugging_state + */ +int utc_dpm_restriction_set_usb_debugging_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_usb_debugging_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_usb_debugging_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_usb_debugging_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_usb_debugging_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_usb_debugging_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_usb_debugging_state + */ +int utc_dpm_restriction_set_usb_debugging_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_usb_debugging_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_usb_debugging_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_usb_debugging_state + */ +int utc_dpm_restriction_get_usb_debugging_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_usb_debugging_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_usb_debugging_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_usb_debugging_state + */ +int utc_dpm_restriction_get_usb_debugging_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_usb_debugging_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_wifi_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_wifi_state + */ +int utc_dpm_restriction_set_wifi_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_wifi_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_wifi_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_wifi_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_wifi_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_wifi_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_wifi_state + */ +int utc_dpm_restriction_set_wifi_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_wifi_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_wifi_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_wifi_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_wifi_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_wifi_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_wifi_state + */ +int utc_dpm_restriction_set_wifi_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_wifi_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_wifi_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_wifi_state + */ +int utc_dpm_restriction_get_wifi_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_wifi_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_wifi_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_wifi_state + */ +int utc_dpm_restriction_get_wifi_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_wifi_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_wifi_hotspot_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_wifi_hotspot_state + */ +int utc_dpm_restriction_set_wifi_hotspot_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_wifi_hotspot_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_wifi_hotspot_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_wifi_hotspot_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_wifi_hotspot_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_wifi_hotspot_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_wifi_hotspot_state + */ +int utc_dpm_restriction_set_wifi_hotspot_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_wifi_hotspot_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_wifi_hotspot_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_wifi_hotspot_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_wifi_hotspot_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_wifi_hotspot_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_wifi_hotspot_state + */ +int utc_dpm_restriction_set_wifi_hotspot_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_wifi_hotspot_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_wifi_hotspot_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_wifi_hotspot_state + */ +int utc_dpm_restriction_get_wifi_hotspot_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_wifi_hotspot_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_wifi_hotspot_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_wifi_hotspot_state + */ +int utc_dpm_restriction_get_wifi_hotspot_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_wifi_hotspot_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_tethering_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_tethering_state + */ +int utc_dpm_restriction_set_bluetooth_tethering_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_tethering_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_tethering_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_tethering_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_bluetooth_tethering_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_tethering_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_tethering_state + */ +int utc_dpm_restriction_set_bluetooth_tethering_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_tethering_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_tethering_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_tethering_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_bluetooth_tethering_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_bluetooth_tethering_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_bluetooth_tethering_state + */ +int utc_dpm_restriction_set_bluetooth_tethering_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_bluetooth_tethering_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_bluetooth_tethering_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_bluetooth_tethering_state + */ +int utc_dpm_restriction_get_bluetooth_tethering_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_tethering_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_bluetooth_tethering_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_bluetooth_tethering_state + */ +int utc_dpm_restriction_get_bluetooth_tethering_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_bluetooth_tethering_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_usb_tethering_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_usb_tethering_state + */ +int utc_dpm_restriction_set_usb_tethering_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_usb_tethering_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_usb_tethering_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_usb_tethering_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_usb_tethering_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_usb_tethering_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_usb_tethering_state + */ +int utc_dpm_restriction_set_usb_tethering_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_usb_tethering_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_usb_tethering_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_usb_tethering_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_usb_tethering_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_usb_tethering_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_usb_tethering_state + */ +int utc_dpm_restriction_set_usb_tethering_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_usb_tethering_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_usb_tethering_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_usb_tethering_state + */ +int utc_dpm_restriction_get_usb_tethering_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_usb_tethering_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_usb_tethering_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_usb_tethering_state + */ +int utc_dpm_restriction_get_usb_tethering_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_usb_tethering_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_external_storage_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_external_storage_state + */ +int utc_dpm_restriction_set_external_storage_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_external_storage_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_external_storage_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_external_storage_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_external_storage_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_external_storage_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_external_storage_state + */ +int utc_dpm_restriction_set_external_storage_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_external_storage_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_external_storage_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_external_storage_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_external_storage_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_external_storage_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_external_storage_state + */ +int utc_dpm_restriction_set_external_storage_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_external_storage_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_external_storage_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_external_storage_state + */ +int utc_dpm_restriction_get_external_storage_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_external_storage_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_external_storage_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_external_storage_state + */ +int utc_dpm_restriction_get_external_storage_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_external_storage_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_mode_change_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_mode_change_state + */ +int utc_dpm_restriction_set_bluetooth_mode_change_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_mode_change_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_mode_change_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_mode_change_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_bluetooth_mode_change_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_mode_change_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_mode_change_state + */ +int utc_dpm_restriction_set_bluetooth_mode_change_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_mode_change_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_mode_change_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_mode_change_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_bluetooth_mode_change_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_mode_change_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_bluetooth_mode_change_state + */ +int utc_dpm_restriction_set_bluetooth_mode_change_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_bluetooth_mode_change_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_bluetooth_mode_change_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_bluetooth_mode_change_state + */ +int utc_dpm_restriction_get_bluetooth_mode_change_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_mode_change_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_bluetooth_mode_change_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_bluetooth_mode_change_state + */ +int utc_dpm_restriction_get_bluetooth_mode_change_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_bluetooth_mode_change_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_desktop_connectivity_state + */ +int utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_desktop_connectivity_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_desktop_connectivity_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_desktop_connectivity_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_bluetooth_desktop_connectivity_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_desktop_connectivity_state + */ +int utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_desktop_connectivity_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_desktop_connectivity_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_desktop_connectivity_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_bluetooth_desktop_connectivity_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_bluetooth_desktop_connectivity_state + */ +int utc_dpm_restriction_set_bluetooth_desktop_connectivity_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_bluetooth_desktop_connectivity_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_bluetooth_desktop_connectivity_state + */ +int utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_desktop_connectivity_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_bluetooth_desktop_connectivity_state + */ +int utc_dpm_restriction_get_bluetooth_desktop_connectivity_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_bluetooth_desktop_connectivity_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_pairing_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_pairing_state + */ +int utc_dpm_restriction_set_bluetooth_pairing_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_pairing_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_pairing_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_pairing_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_bluetooth_pairing_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_bluetooth_pairing_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_bluetooth_pairing_state + */ +int utc_dpm_restriction_set_bluetooth_pairing_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_pairing_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_bluetooth_pairing_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_bluetooth_pairing_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_bluetooth_pairing_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_set_bluetooth_pairing_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_bluetooth_pairing_state + */ +int utc_dpm_restriction_set_bluetooth_pairing_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_bluetooth_pairing_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_bluetooth_pairing_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_bluetooth_pairing_state + */ +int utc_dpm_restriction_get_bluetooth_pairing_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_bluetooth_pairing_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_get_bluetooth_pairing_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_bluetooth_pairing_state + */ +int utc_dpm_restriction_get_bluetooth_pairing_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_bluetooth_pairing_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_popimap_email_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_popimap_email_state + */ +int utc_dpm_restriction_set_popimap_email_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_popimap_email_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_popimap_email_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_popimap_email_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_popimap_email_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_popimap_email_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_popimap_email_state + */ +int utc_dpm_restriction_set_popimap_email_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_popimap_email_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_popimap_email_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_popimap_email_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_popimap_email_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_popimap_email_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_popimap_email_state + */ +int utc_dpm_restriction_set_popimap_email_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_popimap_email_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_popimap_email_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_popimap_email_state + */ +int utc_dpm_restriction_get_popimap_email_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_popimap_email_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_get_popimap_email_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_popimap_email_state + */ +int utc_dpm_restriction_get_popimap_email_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_popimap_email_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_messaging_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_messaging_state + */ +int utc_dpm_restriction_set_messaging_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_messaging_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_messaging_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_messaging_state(handle, &check_state); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_messaging_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_messaging_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_messaging_state + */ +int utc_dpm_restriction_set_messaging_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_messaging_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_messaging_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_messaging_state(handle, &check_state); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_messaging_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_messaging_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_messaging_state + */ +int utc_dpm_restriction_set_messaging_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_messaging_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_messaging_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_messaging_state + */ +int utc_dpm_restriction_get_messaging_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_messaging_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + + +/** + * @testcase utc_dpm_restriction_get_messaging_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_messaging_state + */ +int utc_dpm_restriction_get_messaging_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_messaging_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_browser_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_browser_state + */ +int utc_dpm_restriction_set_browser_state_p(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_browser_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_browser_state(handle, ALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_browser_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, ALLOW); + + ret = dpm_restriction_set_browser_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_browser_state_p2 + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_set_browser_state + */ +int utc_dpm_restriction_set_browser_state_p2(void) +{ + int ret; + int origin_state, check_state; + + assert(handle); + ret = dpm_restriction_get_browser_state(handle, &origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + ret = dpm_restriction_set_browser_state(handle, DISALLOW); + assert_eq(ret, DPM_ERROR_NONE); + ret = dpm_restriction_get_browser_state(handle, &check_state); + assert_eq(ret, DPM_ERROR_NONE); + assert_eq(check_state, DISALLOW); + + ret = dpm_restriction_set_browser_state(handle, origin_state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_set_browser_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_set_browser_state + */ +int utc_dpm_restriction_set_browser_state_n(void) +{ + int ret; + + ret = dpm_restriction_set_browser_state(NULL, INT_NEGATIVE); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_browser_state_p + * @since_tizen 3.0 + * @description Positive test case of dpm_restriction_get_browser_state + */ +int utc_dpm_restriction_get_browser_state_p(void) +{ + int ret; + int state; + + assert(handle); + ret = dpm_restriction_get_browser_state(handle, &state); + assert_eq(ret, DPM_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_dpm_restriction_get_browser_state_n + * @since_tizen 3.0 + * @description Negative test case of dpm_restriction_get_browser_state + */ +int utc_dpm_restriction_get_browser_state_n(void) +{ + int ret; + + assert(handle); + ret = dpm_restriction_get_browser_state(handle, NULL); + assert_neq(ret, DPM_ERROR_NONE); + + return 0; +} -- 2.7.4