//& set: Device
-bool g_ReturnValueState;
-bool g_bDeviceChangedCallback;
-bool bIsBATTERYFeatureSupported;
-bool bIsDisplayStateFeatureSupported;
-bool bIsDisplayFeatureSupported;
-int nDeviceTimeoutId;
+static bool g_ReturnValueState;
+static bool g_bDeviceChangedCallback;
+static bool bIsBATTERYFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
+static bool bIsDisplayFeatureSupported;
+static int nDeviceTimeoutId;
//Add related feature here
#define BATTERY_FEATURE "http://tizen.org/feature/battery"
*/
//& set: Device
-bool bIsDisplayStateFeatureSupported;
-bool bIsDisplayFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
+static bool bIsDisplayFeatureSupported;
/**
* @function ITs_device_display_startup
*/
//& set: Device
-bool bIsDisplayStateFeatureSupported;
+static bool bIsDisplayFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
/**
* @function ITs_device_power_startup
#if DEBUG
FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Device_p\\n", __LINE__, API_NAMESPACE);
#endif
+ bIsDisplayFeatureSupported = false;
+ IS_FEATURE_SUPPORTED(DISPLAY_FEATURE_MAIN, bIsDisplayFeatureSupported, API_NAMESPACE);
+
bIsDisplayStateFeatureSupported = false;
IS_FEATURE_SUPPORTED(DISPLAY_STATE_FEATURE, bIsDisplayStateFeatureSupported, API_NAMESPACE);
return;
{
// Target API
int nRet = device_power_request_lock(power_locks[enum_counter], 10);
+ if ((bIsDisplayFeatureSupported == false) ||
+ (bIsDisplayStateFeatureSupported == false))
+ {
+ if ((power_locks[enum_counter] == POWER_LOCK_DISPLAY) ||
+ (power_locks[enum_counter] == POWER_LOCK_DISPLAY_DIM))
+ {
+ assert_eq(nRet, DEVICE_ERROR_NOT_SUPPORTED);
+ return 0;
+ }
+ else if (power_locks[enum_counter] == POWER_LOCK_CPU)
+ {
+ assert_eq(nRet, DEVICE_ERROR_NONE);
+ return 0;
+ }
+ }
+
if ( nRet != DEVICE_ERROR_NONE )
{
FPRINTF("[Line : %d][%s] device_power_request_lock failed for enum = %s, error returned = %s\\n",
// Target API
nRet = device_power_release_lock(power_locks[enum_counter]);
+ if ((bIsDisplayFeatureSupported == false) ||
+ (bIsDisplayStateFeatureSupported == false))
+ {
+ if ((power_locks[enum_counter] == POWER_LOCK_DISPLAY) ||
+ (power_locks[enum_counter] == POWER_LOCK_DISPLAY_DIM))
+ {
+ assert_eq(nRet, DEVICE_ERROR_NOT_SUPPORTED);
+ return 0;
+ }
+ else if (power_locks[enum_counter] == POWER_LOCK_CPU)
+ {
+ assert_eq(nRet, DEVICE_ERROR_NONE);
+ return 0;
+ }
+ }
+
if ( nRet != DEVICE_ERROR_NONE )
{
FPRINTF("[Line : %d][%s] device_power_release_lock failed for enum = %s, error returned = %s\\n",
extern void utc_system_device_display_startup(void);
extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
extern void utc_system_haptic_startup(void);
extern void utc_system_haptic_cleanup(void);
extern void utc_system_device_ir_startup(void);
{"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
- {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
- {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
- {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
- {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
- {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
- {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
- {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+ {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
{"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
extern void utc_system_device_display_startup(void);
extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
extern void utc_system_haptic_startup(void);
extern void utc_system_haptic_cleanup(void);
extern void utc_system_device_ir_startup(void);
{"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
- {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
- {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
- {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
- {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
- {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
- {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
- {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+ {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
{"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
extern void utc_system_device_display_startup(void);
extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
extern void utc_system_haptic_startup(void);
extern void utc_system_haptic_cleanup(void);
extern void utc_system_device_ir_startup(void);
{"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
- {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
- {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
- {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
- {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
- {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
- {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
- {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+ {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
{"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
extern void utc_system_device_display_startup(void);
extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
extern void utc_system_haptic_startup(void);
extern void utc_system_haptic_cleanup(void);
extern void utc_system_device_ir_startup(void);
{"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
{"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
- {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
- {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
- {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
- {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
- {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
- {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
- {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+ {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+ {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
{"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
{"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
//& set: DevicePower
-#define DISPLAY_STATE_FEATURE "http://tizen.org/feature/display.state"
+#define DISPLAY_FEATURE "http://tizen.org/feature/display"
+#define DISPLAY_STATE_FEATURE "http://tizen.org/feature/display.state"
#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
power_lock_e locks[] = {
POWER_LOCK_CPU,
};
+static bool bIsDisplayFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
+
+/**
+ * @function utc_system_device_power_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void utc_system_device_power_startup(void)
+{
+ int ret;
+
+ ret = system_info_get_platform_bool(DISPLAY_FEATURE, &bIsDisplayFeatureSupported);
+ ret = system_info_get_platform_bool(DISPLAY_STATE_FEATURE, &bIsDisplayStateFeatureSupported);
+}
+
+/**
+ * @function utc_system_device_power_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void utc_system_device_power_cleanup(void)
+{
+
+}
+
/**
* @testcase utc_system_device_power_request_lock_p_1
* @since_tizen 2.3
for (i = 0; i < ARRAY_SIZE(locks); i++) {
error = device_power_request_lock(locks[i], 0);
+ if ((bIsDisplayFeatureSupported == false) ||
+ (bIsDisplayStateFeatureSupported == false)) {
+ if ((locks[i] == POWER_LOCK_DISPLAY) ||
+ (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+ assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+ return 0;
+ } else if (locks[i] == POWER_LOCK_CPU) {
+ assert_eq(error, DEVICE_ERROR_NONE);
+ return 0;
+ }
+ }
assert_eq(error, DEVICE_ERROR_NONE);
device_power_release_lock(locks[i]);
}
for (i = 0; i < ARRAY_SIZE(locks); i++) {
error = device_power_request_lock(locks[i], 10);
+ if ((bIsDisplayFeatureSupported == false) ||
+ (bIsDisplayStateFeatureSupported == false)) {
+ if ((locks[i] == POWER_LOCK_DISPLAY) ||
+ (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+ assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+ return 0;
+ } else if (locks[i] == POWER_LOCK_CPU) {
+ assert_eq(error, DEVICE_ERROR_NONE);
+ return 0;
+ }
+ }
assert_eq(error, DEVICE_ERROR_NONE);
device_power_release_lock(locks[i]);
}
for (i = 0; i < ARRAY_SIZE(locks); i++) {
error = device_power_request_lock(locks[i], -1);
+ if ((bIsDisplayFeatureSupported == false) ||
+ (bIsDisplayStateFeatureSupported == false)) {
+ if ((locks[i] == POWER_LOCK_DISPLAY) ||
+ (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+ assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+ return 0;
+ } else if (locks[i] == POWER_LOCK_CPU) {
+ assert_eq(error, DEVICE_ERROR_NONE);
+ return 0;
+ }
+ }
assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER);
}
for (i = 0; i < ARRAY_SIZE(locks); i++) {
device_power_request_lock(locks[i], 0);
error = device_power_release_lock(locks[i]);
+ if ((bIsDisplayFeatureSupported == false) ||
+ (bIsDisplayStateFeatureSupported == false)) {
+ if ((locks[i] == POWER_LOCK_DISPLAY) ||
+ (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+ assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+ return 0;
+ } else if (locks[i] == POWER_LOCK_CPU) {
+ assert_eq(error, DEVICE_ERROR_NONE);
+ return 0;
+ }
+ }
assert_eq(error, DEVICE_ERROR_NONE);
}
for (i = 0; i < ARRAY_SIZE(locks); i++) {
device_power_request_lock(locks[i], 0);
error = device_power_release_lock(-1);
+
assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER);
device_power_release_lock(locks[i]);
}