[ITC][battery-monitor][ACR-1426][Add TCs for module battery-monitor] 91/214591/4
authorABHISHEK JAIN <j.abhishek@samsung.com>
Tue, 24 Sep 2019 07:26:44 +0000 (12:56 +0530)
committershobhit verma <shobhit.v@samsung.com>
Wed, 25 Sep 2019 09:17:10 +0000 (09:17 +0000)
Change-Id: I402da9acdc4c4523f04757bb348ffda54ca2923e
Signed-off-by: ABHISHEK JAIN <j.abhishek@samsung.com>
13 files changed:
packaging/TCT.spec
packaging/itc/native-battery-monitor-itc.spec [new file with mode: 0755]
packaging/itc/native-battery-monitor-itc.xml [new file with mode: 0755]
src/CMakeLists.txt
src/itc/battery-monitor/CMakeLists.txt [new file with mode: 0755]
src/itc/battery-monitor/ITs-battery-monitor-common.c [new file with mode: 0755]
src/itc/battery-monitor/ITs-battery-monitor-common.h [new file with mode: 0755]
src/itc/battery-monitor/ITs-battery-monitor.c [new file with mode: 0755]
src/itc/battery-monitor/tct-battery-monitor-native.c [new file with mode: 0755]
src/itc/battery-monitor/tct-battery-monitor-native_mobile.h [new file with mode: 0755]
src/itc/battery-monitor/tct-battery-monitor-native_tizeniot.h [new file with mode: 0755]
src/itc/battery-monitor/tct-battery-monitor-native_wearable.h [new file with mode: 0755]
tct_unsupported.txt

index 8af0f56f8bbc0604264599928edb4e7d5e3b33c5..3c3216dee2549a3b6c4eafa9f93d893f9f5ca93f 100755 (executable)
@@ -195,6 +195,13 @@ Group:      Development/Tools
 %description -n native-base-utils-itc
 Native API Integration TC for base-utils
 
+%package -n native-battery-monitor-itc
+Summary:    Native API Integration TC for battery-monitor
+Group:      Development/Tools
+
+%description -n native-battery-monitor-itc
+Native API Integration TC for battery-monitor
+
 %package -n native-bluetooth-itc
 Summary:    Native API Integration TC for bluetooth
 Group:      Development/Tools
@@ -1224,6 +1231,11 @@ cp packaging/itc/native-base-utils-itc.xml %{buildroot}/opt/share/packages/
 mkdir -p %{buildroot}/opt/usr/apps/native-base-utils-itc/bin
 #cp templates/external_wrapper.sh %{buildroot}/opt/usr/apps/native-base-utils-itc/bin
 
+#native-battery-monitor-itc
+cp LICENSE %{buildroot}/opt/usr/share/license/native-battery-monitor-itc
+cp packaging/itc/native-battery-monitor-itc.xml %{buildroot}/opt/share/packages/
+mkdir -p %{buildroot}/opt/usr/apps/native-battery-monitor-itc/bin
+
 #native-bluetooth-itc
 cp LICENSE %{buildroot}/opt/usr/share/license/native-bluetooth-itc
 cp packaging/itc/native-bluetooth-itc.xml %{buildroot}/opt/share/packages/
@@ -2247,6 +2259,11 @@ pkgcmd -un org.tizen.testapp &
 /opt/share/packages/native-base-utils-itc.xml
 /opt/usr/share/license/native-base-utils-itc
 
+%files -n native-battery-monitor-itc
+/opt/usr/apps/native-battery-monitor-itc/*
+/opt/share/packages/native-battery-monitor-itc.xml
+/opt/usr/share/license/native-battery-monitor-itc
+
 %files -n native-bluetooth-itc
 /opt/usr/apps/native-bluetooth-itc/*
 /opt/share/packages/native-bluetooth-itc.xml
diff --git a/packaging/itc/native-battery-monitor-itc.spec b/packaging/itc/native-battery-monitor-itc.spec
new file mode 100755 (executable)
index 0000000..5a66b36
--- /dev/null
@@ -0,0 +1,71 @@
+%define MODULE_NAME battery-monitor
+%define MODULE_LIBNAME capi-system-battery-monitor
+Name:       native-%{MODULE_NAME}-itc
+Summary:    Native API Integration 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(capi-appfw-application)
+BuildRequires: cmake
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(dlog)
+
+%description
+Native API Integration 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="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_TV:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tizeniot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+%else
+       %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_TV:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tizeniot" -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/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/
+mkdir -p %{buildroot}%{APP_PATH}%{name}/bin
+
+%files
+%{APP_PATH}%{name}/*
+/usr/share/packages/native-%{MODULE_NAME}-itc.xml
+/usr/share/license/%{name}
diff --git a/packaging/itc/native-battery-monitor-itc.xml b/packaging/itc/native-battery-monitor-itc.xml
new file mode 100755 (executable)
index 0000000..3167c3d
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="native-battery-monitor-tests" version="0.1.0" api-version="5.5">
+       <label>NativeBatteryMonitorTest</label>
+       <author email="test@tizen.org" href="www.tizen.org">test</author>
+       <description>Native API test Application</description>
+       <ui-application appid="native.battery-monitor-tests" exec="/usr/apps/native-battery-monitor-tests/bin/tct-battery-monitor-native" nodisplay="false" multiple="false" type="capp" taskmanage="false">
+               <background-category value="background-network"/>
+               <background-category value="download"/>
+               <background-category value="iot-communication"/>
+               <background-category value="location"/>
+               <background-category value="media"/>
+               <background-category value="sensor"/>
+       </ui-application>
+       <privileges>
+               <privilege>http://tizen.org/privilege/systemmonitor</privilege>
+       </privileges>
+</manifest>
index 3a041ea123be49e58e013357199a9ba36713f218..8f650158a897489f2c4c329d90ae7309c1c26911 100755 (executable)
@@ -209,6 +209,8 @@ ELSE( DEFINED MODULE )
        ADD_SUBDIRECTORY(itc/badge)
        MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/base-utils")
        ADD_SUBDIRECTORY(itc/base-utils)
+       MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/battery-monitor")
+       ADD_SUBDIRECTORY(itc/battery-monitor)
        MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/bluetooth")
        ADD_SUBDIRECTORY(itc/bluetooth)
        MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/bundle")
diff --git a/src/itc/battery-monitor/CMakeLists.txt b/src/itc/battery-monitor/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..4001a17
--- /dev/null
@@ -0,0 +1,41 @@
+SET(PKG_NAME "battery-monitor")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-native")
+SET(RPM_NAME "native-${PKG_NAME}-itc")
+
+SET(CAPI_LIB "capi-system-battery-monitor")
+
+SET(TC_SOURCES
+       ITs-battery-monitor-common.c
+       ITs-battery-monitor.c
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+       ${CAPI_LIB}
+       capi-appfw-application
+       capi-system-info
+       glib-2.0
+       dlog
+)
+
+INCLUDE_DIRECTORIES(
+    ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+    ${${CAPI_LIB}_LIBRARIES}
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+    DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
+
diff --git a/src/itc/battery-monitor/ITs-battery-monitor-common.c b/src/itc/battery-monitor/ITs-battery-monitor-common.c
new file mode 100755 (executable)
index 0000000..2174f0a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ITs-battery-monitor-common.h"
+
+/** @addtogroup itc-battery-monitor
+*  @ingroup itc
+*  @{
+*/
+
+/**
+* @function            BatteryMonitorGetError
+* @description         Maps battery monitor error enums to string values
+* @parameter           nRet: error code returned
+* @return              error string
+*/
+char* BatteryMonitorGetError(int nRet)
+{
+       char *szErrorVal = "Unknown Error";
+       switch ( nRet )
+       {
+       case BATTERY_MONITOR_ERROR_NONE:                        szErrorVal = "BATTERY_MONITOR_ERROR_NONE"; break;
+       case BATTERY_MONITOR_ERROR_OUT_OF_MEMORY:               szErrorVal = "BATTERY_MONITOR_ERROR_OUT_OF_MEMORY"; break;
+       case BATTERY_MONITOR_ERROR_INVALID_PARAMETER:           szErrorVal = "BATTERY_MONITOR_ERROR_INVALID_PARAMETER"; break;
+       case BATTERY_MONITOR_ERROR_NO_DATA:                     szErrorVal = "BATTERY_MONITOR_ERROR_NO_DATA"; break;
+       case BATTERY_MONITOR_ERROR_PERMISSION_DENIED:           szErrorVal = "BATTERY_MONITOR_ERROR_PERMISSION_DENIED"; break;
+       case BATTERY_MONITOR_ERROR_NOT_SUPPORTED:               szErrorVal = "BATTERY_MONITOR_ERROR_NOT_SUPPORTED"; break;
+       case BATTERY_MONITOR_ERROR_RECORD_NOT_FOUND:            szErrorVal = "BATTERY_MONITOR_ERROR_RECORD_NOT_FOUND"; break;
+       case BATTERY_MONITOR_ERROR_DB_FAILED:                   szErrorVal = "BATTERY_MONITOR_ERROR_DB_FAILED"; break;
+       case BATTERY_MONITOR_ERROR_DB_NOT_OPENED:               szErrorVal = "BATTERY_MONITOR_ERROR_DB_NOT_OPENED"; break;
+       case BATTERY_MONITOR_ERROR_INTERNAL:                    szErrorVal = "BATTERY_MONITOR_ERROR_INTERNAL"; break;
+       }
+
+       return szErrorVal;
+}
+
+/** @} */
diff --git a/src/itc/battery-monitor/ITs-battery-monitor-common.h b/src/itc/battery-monitor/ITs-battery-monitor-common.h
new file mode 100755 (executable)
index 0000000..a051f2e
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ITS_BATTERY_MONITOR_COMMON_H_
+#define _ITS_BATTERY_MONITOR_COMMON_H_
+
+#include "tct_common.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <dlog.h>
+#include <system_info.h>
+#include "battery_monitor.h"
+#include <app.h>
+
+/** @addtogroup itc-battery-monitor
+*  @ingroup itc
+*  @{
+*/
+
+#define API_NAMESPACE                          "BATTERY-MONITOR_ITC"
+#define BATTERY_FEATURE                                "http://tizen.org/feature/battery"
+#define TEST_APP_ID                            "org.tizen.battery-monitor-native-itc"
+
+#define START_TEST_NO_CHECK { \
+       FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
+}
+
+bool g_bBatteryFeatureNotSupported;
+
+char* BatteryMonitorGetError(int nRet);
+
+/** @} */
+#endif  //_ITS_BATTERY_MONITOR_COMMON_H_
diff --git a/src/itc/battery-monitor/ITs-battery-monitor.c b/src/itc/battery-monitor/ITs-battery-monitor.c
new file mode 100755 (executable)
index 0000000..e67d8d5
--- /dev/null
@@ -0,0 +1,417 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ITs-battery-monitor-common.h"
+
+/** @addtogroup battery-monitor
+*  @ingroup itc
+*  @{
+*/
+
+//& set: Battery-Monitor
+/**
+* @function            ITs_battery_monitor_startup
+* @description         Called before each test, checks for battery feature
+* @parameter           NA
+* @return              NA
+*/
+void ITs_battery_monitor_startup(void)
+{
+       struct stat stBuff;
+       if ( stat(ERR_LOG, &stBuff) == 0 )
+       {
+               remove(ERR_LOG);
+       }
+#if DEBUG
+       FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_battery_monitor_startup\\n", __LINE__, API_NAMESPACE, API_NAMESPACE);
+#endif
+       g_bBatteryFeatureNotSupported = false;
+
+       bool bFeatureStatus = TCTCheckSystemInfoFeatureSupported(BATTERY_FEATURE, API_NAMESPACE);
+
+       if(!bFeatureStatus)
+       {
+               g_bBatteryFeatureNotSupported = true;
+       }
+       return;
+}
+
+/**
+ * @function           ITs_battery_monitor_cleanup
+ * @description                Called after each test
+ * @parameter          NA
+ * @return             NA
+ */
+void ITs_battery_monitor_cleanup(void)
+{
+#if DEBUG
+       FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_battery_monitor_cleanup\\n", __LINE__, API_NAMESPACE);
+#endif
+       return;
+}
+
+//& type : auto
+//& purpose: Creates and Destroy a handle to the Battery Consumption for getting resource based usage.
+/**
+* @testcase                    ITc_battery_monitor_create_destroy_p
+* @since_tizen                 5.5
+* @author                      SRID(j.abhishek)
+* @reviewer                    SRID(shobhit.v)
+* @type                                auto
+* @description                 Creates and Destroy a handle to the Battery Consumption for getting resource based usage.
+* @scenario                    Create battery monitor handle and destroy created handle\n
+*                              and check for Pass/Fail.
+* @apicovered                  battery_monitor_create, battery_monitor_destroy
+* @passcase                    battery_monitor_create, battery_monitor_destroy are successful and return correct value
+* @failcase                    battery_monitor_create, battery_monitor_destroy gets failed or return null value
+* @precondition                        N/A
+* @postcondition               N/A
+*/
+int ITc_battery_monitor_create_destroy_p(void)
+{
+       START_TEST_NO_CHECK;
+
+       int nRet = -1;
+       battery_monitor_h hBatteryMonitor = NULL;
+
+       //Targer API
+       nRet = battery_monitor_create(&hBatteryMonitor);
+       if ( g_bBatteryFeatureNotSupported )
+       {
+               PRINT_RESULT(BATTERY_MONITOR_ERROR_NOT_SUPPORTED, nRet, "battery_monitor_create", BatteryMonitorGetError(nRet));
+               return 0;
+       }
+       PRINT_RESULT(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_create", BatteryMonitorGetError(nRet));
+       CHECK_HANDLE(hBatteryMonitor, "battery_monitor_create");
+
+       //Targer API
+       nRet = battery_monitor_destroy(hBatteryMonitor);
+       PRINT_RESULT(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_destroy", BatteryMonitorGetError(nRet));
+
+       return 0;
+}
+
+//& type : auto
+//& purpose: Gets the battery-percent for specific resource from available data.
+/**
+* @testcase                    ITc_battery_monitor_get_usage_for_resource_id_p
+* @since_tizen                 5.5
+* @author                      SRID(j.abhishek)
+* @reviewer                    SRID(shobhit.v)
+* @type                                auto
+* @description                 Gets the battery-percent for specific resource from available data.
+* @scenario                    Create battery monitor handle\n
+*                              get battery percent using this handle and check for Pass/Fail.
+* @apicovered                  battery_monitor_create, battery_monitor_get_usage_for_resource_id, battery_monitor_destroy
+* @passcase                    battery_monitor_create, battery_monitor_get_usage_for_resource_id are successful and return correct value
+* @failcase                    battery_monitor_create, battery_monitor_get_usage_for_resource_id gets failed or return null value
+* @precondition                        N/A
+* @postcondition               Destroy battery monitor handle.
+*/
+int ITc_battery_monitor_get_usage_for_resource_id_p(void)
+{
+       START_TEST_NO_CHECK;
+
+       int nRet = -1;
+       int nBatteryUsage = 0;
+       battery_monitor_h hBatteryMonitor = NULL;
+
+       battery_monitor_resource_id_e eResourceID[] = {
+               BATTERY_MONITOR_RESOURCE_ID_BLE,
+               BATTERY_MONITOR_RESOURCE_ID_WIFI,
+               BATTERY_MONITOR_RESOURCE_ID_CPU,
+               BATTERY_MONITOR_RESOURCE_ID_DISPLAY,
+               BATTERY_MONITOR_RESOURCE_ID_DEVICE_NETWORK,
+               BATTERY_MONITOR_RESOURCE_ID_GPS_SENSOR,
+               BATTERY_MONITOR_RESOURCE_ID_HRM_SENSOR
+       };
+
+       int nEnumSize = sizeof(eResourceID) / sizeof(eResourceID[0]);
+       int nEnumCounter;
+
+       nRet = battery_monitor_create(&hBatteryMonitor);
+       if ( g_bBatteryFeatureNotSupported )
+       {
+               PRINT_RESULT(BATTERY_MONITOR_ERROR_NOT_SUPPORTED, nRet, "battery_monitor_create", BatteryMonitorGetError(nRet));
+               return 0;
+       }
+       PRINT_RESULT(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_create", BatteryMonitorGetError(nRet));
+       CHECK_HANDLE(hBatteryMonitor, "battery_monitor_create");
+
+       for(nEnumCounter = 0; nEnumCounter < nEnumSize; nEnumCounter++)
+       {
+               //Targer API
+               nRet = battery_monitor_get_usage_for_resource_id(hBatteryMonitor, eResourceID[nEnumCounter], &nBatteryUsage);
+               PRINT_RESULT_CLEANUP(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_get_usage_for_resource_id", BatteryMonitorGetError(nRet), battery_monitor_destroy(hBatteryMonitor));
+               FPRINTF("[Line : %d][%s] battery_monitor_get_usage_for_resource_id returned battary usage[%d] for resource ID [%d] \\n", __LINE__, API_NAMESPACE, nBatteryUsage, eResourceID[nEnumCounter]);
+       }
+
+       nRet = battery_monitor_destroy(hBatteryMonitor);
+       PRINT_RESULT_NORETURN(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_destroy", BatteryMonitorGetError(nRet));
+
+       return 0;
+}
+
+//& type : auto
+//& purpose: Gets the battery_monitor_h with battery consumption by the specified application.
+/**
+* @testcase                    ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p
+* @since_tizen                 5.5
+* @author                      SRID(j.abhishek)
+* @reviewer                    SRID(shobhit.v)
+* @type                                auto
+* @description                 Gets the battery_monitor_h with battery consumption by the specified application.
+* @scenario                    Gets the battery monitor handle and call battery_monitor_get_usage_for_resource_id\n
+*                              battery consumption by the specified application and check for Pass/Fail.
+* @apicovered                  battery_monitor_get_usage_by_app_id_for_all_resource_id, battery_monitor_destroy
+* @passcase                    battery_monitor_get_usage_by_app_id_for_all_resource_id is successful and return correct value
+* @failcase                    battery_monitor_get_usage_by_app_id_for_all_resource_id gets failed or return null value
+* @precondition                        N/A
+* @postcondition               Destroy gathered battery monitor handle.
+*/
+int ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p(void)
+{
+       START_TEST_NO_CHECK;
+
+       int nRet = -1;
+       int nBatteryUsage = 0;
+       battery_monitor_h hBatteryMonitorAPP = NULL;
+
+       battery_monitor_duration_type_e eMonitorDuration[] = {
+               BATTERY_MONITOR_DURATION_TYPE_1DAY,
+               BATTERY_MONITOR_DURATION_TYPE_1WEEK
+       };
+
+       battery_monitor_resource_id_e eResourceID[] = {
+               BATTERY_MONITOR_RESOURCE_ID_BLE,
+               BATTERY_MONITOR_RESOURCE_ID_WIFI,
+               BATTERY_MONITOR_RESOURCE_ID_CPU,
+               BATTERY_MONITOR_RESOURCE_ID_DISPLAY,
+               BATTERY_MONITOR_RESOURCE_ID_DEVICE_NETWORK,
+               BATTERY_MONITOR_RESOURCE_ID_GPS_SENSOR,
+               BATTERY_MONITOR_RESOURCE_ID_HRM_SENSOR
+       };
+
+       int nDurationEnumSize = sizeof(eMonitorDuration) / sizeof(eMonitorDuration[0]);
+       int nDurationEnumCounter;
+
+       int nIDEnumSize = sizeof(eResourceID) / sizeof(eResourceID[0]);
+       int nIDEnumCounter;
+
+       for(nDurationEnumCounter = 0; nDurationEnumCounter < nDurationEnumSize; nDurationEnumCounter++)
+       {
+               //Targer API
+               nRet = battery_monitor_get_usage_by_app_id_for_all_resource_id(TEST_APP_ID, eMonitorDuration[nDurationEnumCounter], &hBatteryMonitorAPP);
+               if ( g_bBatteryFeatureNotSupported )
+               {
+                       PRINT_RESULT(BATTERY_MONITOR_ERROR_NOT_SUPPORTED, nRet, "battery_monitor_get_usage_by_app_id_for_all_resource_id", BatteryMonitorGetError(nRet));
+                       return 0;
+               }
+               PRINT_RESULT(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_get_usage_by_app_id_for_all_resource_id", BatteryMonitorGetError(nRet));
+               CHECK_HANDLE(hBatteryMonitorAPP, "battery_monitor_get_usage_by_app_id_for_all_resource_id");
+
+               for(nIDEnumCounter = 0; nIDEnumCounter < nIDEnumSize; nIDEnumCounter++)
+               {
+                       nRet = battery_monitor_get_usage_for_resource_id(hBatteryMonitorAPP, eResourceID[nIDEnumCounter], &nBatteryUsage);
+                       PRINT_RESULT_CLEANUP(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_get_usage_for_resource_id", BatteryMonitorGetError(nRet), battery_monitor_destroy(hBatteryMonitorAPP));
+                       FPRINTF("[Line : %d][%s] battery_monitor_get_usage_for_resource_id returned battary usage[%d] for Monitor duration[%d] and resource ID [%d] \\n", __LINE__, API_NAMESPACE, nBatteryUsage, eMonitorDuration[nDurationEnumCounter], eResourceID[nIDEnumCounter]);
+               }
+               nRet = battery_monitor_destroy(hBatteryMonitorAPP);
+               PRINT_RESULT_NORETURN(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_destroy", BatteryMonitorGetError(nRet));
+               hBatteryMonitorAPP = NULL;
+       }
+
+       return 0;
+}
+
+//& type : auto
+//& purpose: Gets the battery consumption for the specific resource for the given application.
+/**
+* @testcase                    ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p
+* @since_tizen                 5.5
+* @author                      SRID(j.abhishek)
+* @reviewer                    SRID(shobhit.v)
+* @type                                auto
+* @description                 Gets the battery consumption for the specific resource for the given application.
+* @scenario                    Get battery usage using different recource id for different duration\n
+*                              check for Pass/Fail.
+* @apicovered                  battery_monitor_get_usage_by_app_id_for_resource_id
+* @passcase                    battery_monitor_get_usage_by_app_id_for_resource_id is successful and return correct value
+* @failcase                    battery_monitor_get_usage_by_app_id_for_resource_id gets failed or return null value
+* @precondition                        N/A
+* @postcondition               N/A
+*/
+int ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p(void)
+{
+       START_TEST_NO_CHECK;
+
+       int nRet = -1;
+       int nBatteryUsage = 0;
+
+       battery_monitor_duration_type_e eMonitorDuration[] = {
+               BATTERY_MONITOR_DURATION_TYPE_1DAY,
+               BATTERY_MONITOR_DURATION_TYPE_1WEEK
+       };
+
+       battery_monitor_resource_id_e eResourceID[] = {
+               BATTERY_MONITOR_RESOURCE_ID_BLE,
+               BATTERY_MONITOR_RESOURCE_ID_WIFI,
+               BATTERY_MONITOR_RESOURCE_ID_CPU,
+               BATTERY_MONITOR_RESOURCE_ID_DISPLAY,
+               BATTERY_MONITOR_RESOURCE_ID_DEVICE_NETWORK,
+               BATTERY_MONITOR_RESOURCE_ID_GPS_SENSOR,
+               BATTERY_MONITOR_RESOURCE_ID_HRM_SENSOR
+       };
+
+       int nDurationEnumSize = sizeof(eMonitorDuration) / sizeof(eMonitorDuration[0]);
+       int nDurationEnumCounter;
+
+       int nIDEnumSize = sizeof(eResourceID) / sizeof(eResourceID[0]);
+       int nIDEnumCounter;
+
+       for(nIDEnumCounter = 0; nIDEnumCounter < nIDEnumSize; nIDEnumCounter++)
+       {
+               for(nDurationEnumCounter = 0; nDurationEnumCounter < nDurationEnumSize; nDurationEnumCounter++)
+               {
+                       //Targer API
+                       nRet = battery_monitor_get_usage_by_app_id_for_resource_id(TEST_APP_ID, eResourceID[nIDEnumCounter], eMonitorDuration[nDurationEnumCounter], &nBatteryUsage);
+                       if ( g_bBatteryFeatureNotSupported )
+                       {
+                               PRINT_RESULT(BATTERY_MONITOR_ERROR_NOT_SUPPORTED, nRet, "battery_monitor_get_usage_by_app_id_for_resource_id", BatteryMonitorGetError(nRet));
+                               return 0;
+                       }
+                       PRINT_RESULT(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_get_usage_by_app_id_for_resource_id", BatteryMonitorGetError(nRet));
+                       FPRINTF("[Line : %d][%s] battery_monitor_get_usage_by_app_id_for_resource_id returned battary usage[%d] for Monitor duration[%d] and resource ID [%d] \\n", __LINE__, API_NAMESPACE, nBatteryUsage, eMonitorDuration[nDurationEnumCounter], eResourceID[nIDEnumCounter]);
+               }
+       }
+
+       return 0;
+}
+
+//& type : auto
+//& purpose: Gets the total battery usage in percent by an application for certain time duration
+/**
+* @testcase                    ITc_battery_monitor_get_total_usage_by_app_id_p
+* @since_tizen                 5.5
+* @author                      SRID(j.abhishek)
+* @reviewer                    SRID(shobhit.v)
+* @type                                auto
+* @description                 Gets the total battery usage in percent by an application for certain time duration.
+* @scenario                    Use test app id and different duration to get battery usage\n
+*                              check for Pass/Fail.
+* @apicovered                  battery_monitor_get_total_usage_by_app_id
+* @passcase                    battery_monitor_get_total_usage_by_app_id is successful and return correct value
+* @failcase                    battery_monitor_get_total_usage_by_app_id gets failed or return null value
+* @precondition                        N/A
+* @postcondition               N/A
+*/
+int ITc_battery_monitor_get_total_usage_by_app_id_p(void)
+{
+       START_TEST_NO_CHECK;
+
+       int nRet = -1;
+       int nBatteryUsage = 0;
+
+       battery_monitor_duration_type_e eMonitorDuration[] = {
+               BATTERY_MONITOR_DURATION_TYPE_1DAY,
+               BATTERY_MONITOR_DURATION_TYPE_1WEEK
+       };
+
+       int nEnumSize = sizeof(eMonitorDuration) / sizeof(eMonitorDuration[0]);
+       int nEnumCounter;
+
+       for(nEnumCounter = 0; nEnumCounter < nEnumSize; nEnumCounter++)
+       {
+               //Targer API
+               nRet = battery_monitor_get_total_usage_by_app_id(TEST_APP_ID, eMonitorDuration[nEnumCounter], &nBatteryUsage);
+               if ( g_bBatteryFeatureNotSupported )
+               {
+                       PRINT_RESULT(BATTERY_MONITOR_ERROR_NOT_SUPPORTED, nRet, "battery_monitor_get_total_usage_by_app_id", BatteryMonitorGetError(nRet));
+                       return 0;
+               }
+               PRINT_RESULT(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_get_total_usage_by_app_id", BatteryMonitorGetError(nRet));
+               FPRINTF("[Line : %d][%s] battery_monitor_get_total_usage_by_app_id returned battary usage[%d] for Monitor duration[%d] \\n", __LINE__, API_NAMESPACE, nBatteryUsage, eMonitorDuration[nEnumCounter]);
+       }
+
+       return 0;
+}
+
+//& type : auto
+//& purpose: Gets the battery-percent usage by a resource for certain time duration.
+/**
+* @testcase                    ITc_battery_monitor_get_total_usage_by_resource_id_p
+* @since_tizen                 5.5
+* @author                      SRID(j.abhishek)
+* @reviewer                    SRID(shobhit.v)
+* @type                                auto
+
+* @description                 Gets the battery-percent usage by a resource for certain time duration.
+* @scenario                    Based on different resource ID get battery usage for different duration\n
+*                              check for Pass/Fail.
+* @apicovered                  battery_monitor_get_total_usage_by_resource_id
+* @passcase                    battery_monitor_get_total_usage_by_resource_id is successful and return correct value
+* @failcase                    battery_monitor_get_total_usage_by_resource_id gets failed or return null value
+* @precondition                        N/A
+* @postcondition               N/A
+*/
+int ITc_battery_monitor_get_total_usage_by_resource_id_p(void)
+{
+       START_TEST_NO_CHECK;
+
+       int nRet = -1;
+       int nBatteryUsage = 0;
+
+       battery_monitor_duration_type_e eMonitorDuration[] = {
+               BATTERY_MONITOR_DURATION_TYPE_1DAY,
+               BATTERY_MONITOR_DURATION_TYPE_1WEEK
+       };
+
+       battery_monitor_resource_id_e eResourceID[] = {
+               BATTERY_MONITOR_RESOURCE_ID_BLE,
+               BATTERY_MONITOR_RESOURCE_ID_WIFI,
+               BATTERY_MONITOR_RESOURCE_ID_CPU,
+               BATTERY_MONITOR_RESOURCE_ID_DISPLAY,
+               BATTERY_MONITOR_RESOURCE_ID_DEVICE_NETWORK,
+               BATTERY_MONITOR_RESOURCE_ID_GPS_SENSOR,
+       };
+
+       int nDurationEnumSize = sizeof(eMonitorDuration) / sizeof(eMonitorDuration[0]);
+       int nDurationEnumCounter;
+
+       int nIDEnumSize = sizeof(eResourceID) / sizeof(eResourceID[0]);
+       int nIDEnumCounter;
+
+       for(nIDEnumCounter = 0; nIDEnumCounter < nIDEnumSize; nIDEnumCounter++)
+       {
+               for(nDurationEnumCounter = 0; nDurationEnumCounter < nDurationEnumSize; nDurationEnumCounter++)
+               {
+                       //Targer API
+                       nRet = battery_monitor_get_total_usage_by_resource_id(eResourceID[nIDEnumCounter], eMonitorDuration[nDurationEnumCounter], &nBatteryUsage);
+                       if ( g_bBatteryFeatureNotSupported )
+                       {
+                               PRINT_RESULT(BATTERY_MONITOR_ERROR_NOT_SUPPORTED, nRet, "battery_monitor_get_total_usage_by_resource_id", BatteryMonitorGetError(nRet));
+                               return 0;
+                       }
+                       PRINT_RESULT(BATTERY_MONITOR_ERROR_NONE, nRet, "battery_monitor_get_total_usage_by_resource_id", BatteryMonitorGetError(nRet));
+                       FPRINTF("[Line : %d][%s] battery_monitor_get_total_usage_by_resource_id returned battary usage[%d] for Monitor duration[%d] and resource ID [%d] \\n", __LINE__, API_NAMESPACE, nBatteryUsage, eMonitorDuration[nDurationEnumCounter], eResourceID[nIDEnumCounter]);
+               }
+       }
+
+       return 0;
+}
+
+/** @} */
+/** @} */
diff --git a/src/itc/battery-monitor/tct-battery-monitor-native.c b/src/itc/battery-monitor/tct-battery-monitor-native.c
new file mode 100755 (executable)
index 0000000..c22afcf
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2019 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 <stdio.h>
+#include <string.h>
+#include "tct_common.h"
+
+#ifdef MOBILE  //Starts MOBILE
+#include "tct-battery-monitor-native_mobile.h"
+#endif //End MOBILE
+
+#ifdef WEARABLE        //Starts WEARABLE
+#include "tct-battery-monitor-native_wearable.h"
+#endif //End WEARABLE
+
+#ifdef TV      //Starts TV
+#include "tct-battery-monitor-native_tv.h"
+#endif //End TV
+
+#ifdef TIZENIOT        //Starts TIZENIOT
+#include "tct-battery-monitor-native_tizeniot.h"
+#endif //End TIZENIOT
+
+
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+
+#include <app.h>
+#include <dlog.h>
+
+static char* key;
+static char* fname;
+static int nNum;
+int run_testcases()
+{
+       int result = -1;
+       int i;
+       gsize byte_size;
+       const gchar* encoded_byte;
+       guchar* byte = NULL;
+
+       static const size_t sz_byte_len = sizeof(size_t);
+       static const size_t sz_type = sizeof(int);
+       static const size_t sz_keysize = sizeof(size_t);
+       static const size_t sz_size = sizeof(size_t);
+
+       char* func_name = fname;//argv[1];
+       if (nNum > 2)
+       {
+               encoded_byte = key;//argv[3];
+               byte = g_base64_decode(encoded_byte,&byte_size);
+               byte += sz_byte_len; byte += sz_type;
+               size_t keysize = *((size_t *)byte); byte += sz_keysize;
+               byte += keysize;
+               size_t size = *((size_t *)byte); byte += sz_size;
+               void *val = (void *)byte; byte += size;
+               func_name = strdup((char *)val);
+       }
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, func_name);
+       for (i = 0; tc_array[i].name; i++)
+       {
+               if (!strncmp(func_name, tc_array[i].name, strlen(func_name)))
+               {
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Startup begin", func_name);
+                       if (tc_array[i].startup)
+                       {
+                               tc_array[i].startup();
+                       }
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Startup end", func_name);
+
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Body begin", func_name);
+                       result = tc_array[i].function();
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Body end", func_name);
+
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Cleanup begin", func_name);
+                       if (tc_array[i].cleanup)
+                       {
+                               tc_array[i].cleanup();
+                       }
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Cleanup end", func_name);
+                       FILE *fres = fopen("/tmp/tcresult","w"); fprintf(fres, "%d", result); fclose(fres); return result;
+               }
+       }
+
+       dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, func_name);
+       printf("Unknown testcase name: \"%s\"\n", func_name);
+       return 2;
+}
+
+
+static bool app_create(void *data)
+{
+       run_testcases();
+       return false; // quit app
+}
+
+int main(int argc, char *argv[])
+{
+       int ret = 0;
+       fname = argv[1];
+       key = argv[3];
+       nNum = argc;
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       event_callback.create = app_create;
+
+       //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, NULL);
+       if (ret != APP_ERROR_NONE)
+       {
+               dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+               FPRINTF("\\n[Line No : %d]Unable to execute test cases: ui_app_main API call gets failed\n", __LINE__);
+       }
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+       return ret;
+}
diff --git a/src/itc/battery-monitor/tct-battery-monitor-native_mobile.h b/src/itc/battery-monitor/tct-battery-monitor-native_mobile.h
new file mode 100755 (executable)
index 0000000..fe2c807
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019 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_BATTERY_MONITOR_NATIVE_H__
+#define __TCT_BATTERY_MONITOR_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_battery_monitor_startup(void);
+extern void ITs_battery_monitor_cleanup(void);
+
+extern int ITc_battery_monitor_create_destroy_p(void);
+extern int ITc_battery_monitor_get_usage_for_resource_id_p(void);
+extern int ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p(void);
+extern int ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p(void);
+extern int ITc_battery_monitor_get_total_usage_by_app_id_p(void);
+extern int ITc_battery_monitor_get_total_usage_by_resource_id_p(void);
+
+testcase tc_array[] = {
+       {"ITc_battery_monitor_create_destroy_p", ITc_battery_monitor_create_destroy_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_for_resource_id_p", ITc_battery_monitor_get_usage_for_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p", ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p", ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_total_usage_by_app_id_p", ITc_battery_monitor_get_total_usage_by_app_id_p, ITs_battery_monitor_startup,ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_total_usage_by_resource_id_p", ITc_battery_monitor_get_total_usage_by_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {NULL, NULL, NULL, NULL}
+};
+
+#endif /* __TCT_BATTERY_MONITOR_NATIVE_H__ */
diff --git a/src/itc/battery-monitor/tct-battery-monitor-native_tizeniot.h b/src/itc/battery-monitor/tct-battery-monitor-native_tizeniot.h
new file mode 100755 (executable)
index 0000000..fe2c807
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019 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_BATTERY_MONITOR_NATIVE_H__
+#define __TCT_BATTERY_MONITOR_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_battery_monitor_startup(void);
+extern void ITs_battery_monitor_cleanup(void);
+
+extern int ITc_battery_monitor_create_destroy_p(void);
+extern int ITc_battery_monitor_get_usage_for_resource_id_p(void);
+extern int ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p(void);
+extern int ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p(void);
+extern int ITc_battery_monitor_get_total_usage_by_app_id_p(void);
+extern int ITc_battery_monitor_get_total_usage_by_resource_id_p(void);
+
+testcase tc_array[] = {
+       {"ITc_battery_monitor_create_destroy_p", ITc_battery_monitor_create_destroy_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_for_resource_id_p", ITc_battery_monitor_get_usage_for_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p", ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p", ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_total_usage_by_app_id_p", ITc_battery_monitor_get_total_usage_by_app_id_p, ITs_battery_monitor_startup,ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_total_usage_by_resource_id_p", ITc_battery_monitor_get_total_usage_by_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {NULL, NULL, NULL, NULL}
+};
+
+#endif /* __TCT_BATTERY_MONITOR_NATIVE_H__ */
diff --git a/src/itc/battery-monitor/tct-battery-monitor-native_wearable.h b/src/itc/battery-monitor/tct-battery-monitor-native_wearable.h
new file mode 100755 (executable)
index 0000000..fe2c807
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019 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_BATTERY_MONITOR_NATIVE_H__
+#define __TCT_BATTERY_MONITOR_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_battery_monitor_startup(void);
+extern void ITs_battery_monitor_cleanup(void);
+
+extern int ITc_battery_monitor_create_destroy_p(void);
+extern int ITc_battery_monitor_get_usage_for_resource_id_p(void);
+extern int ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p(void);
+extern int ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p(void);
+extern int ITc_battery_monitor_get_total_usage_by_app_id_p(void);
+extern int ITc_battery_monitor_get_total_usage_by_resource_id_p(void);
+
+testcase tc_array[] = {
+       {"ITc_battery_monitor_create_destroy_p", ITc_battery_monitor_create_destroy_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_for_resource_id_p", ITc_battery_monitor_get_usage_for_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p", ITc_battery_monitor_get_usage_by_app_id_for_all_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p", ITc_battery_monitor_get_usage_by_app_id_for_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_total_usage_by_app_id_p", ITc_battery_monitor_get_total_usage_by_app_id_p, ITs_battery_monitor_startup,ITs_battery_monitor_cleanup},
+       {"ITc_battery_monitor_get_total_usage_by_resource_id_p", ITc_battery_monitor_get_total_usage_by_resource_id_p, ITs_battery_monitor_startup, ITs_battery_monitor_cleanup},
+       {NULL, NULL, NULL, NULL}
+};
+
+#endif /* __TCT_BATTERY_MONITOR_NATIVE_H__ */
index 4098dcab1e49f6f61a84e4bfced4c6e0015ed8cf..16ad069f22dc0bc94b224edad0986ce65ac42460 100755 (executable)
@@ -58,7 +58,10 @@ mobile:armv7l:itc:watchface;
 mobile:aarch64:itc:watchface;
 mobile:x86:itc:watchface;
 mobile:x86_64:itc:watchface;
-
+mobile:armv7l:itc:battery-monitor;
+mobile:aarch64:itc:battery-monitor;
+mobile:x86:itc:battery-monitor;
+mobile:x86_64:itc:battery-monitor;
 
 ## ctc ##
 
@@ -254,6 +257,10 @@ tizeniot:armv7l:itc:watchface;
 tizeniot:aarch64:itc:watchface;
 tizeniot:x86:itc:watchface;
 tizeniot:x86_64:itc:watchface;
+tizeniot:armv7l:itc:battery-monitor;
+tizeniot:aarch64:itc:battery-monitor;
+tizeniot:x86:itc:battery-monitor;
+tizeniot:x86_64:itc:battery-monitor;
 
 ## ctc ##
 tizeniot:armv7l:ctc:platform-permission;