return true;
}
+static gboolean __alarm_check(gpointer data)
+{
+ app_control_h app_control = (app_control_h)data;
+ int ret;
+ bool is_running = false;
+ const char *app_id = "org.tizen.helloworld";
+
+ ret = app_manager_is_running(app_id, &is_running);
+ assert_eq_with_exit(ret, APP_MANAGER_ERROR_NONE);
+
+ if (is_running) {
+ ret = app_control_add_extra_data(app_control, "ALARM_UTC", "TERM");
+ assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
+
+ ret = app_control_send_launch_request(app_control, NULL, NULL);
+ assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
+
+ normal_exit(0);
+ } else {
+ normal_exit(1);
+ }
+
+ app_control_destroy(app_control);
+ alarm_cancel_all();
+ return true;
+}
+
/**
* @testcase utc_alarm_schedule_after_delay_p
* @since_tizen 2.3
app_control_h app_control;
int tid;
int ret = ALARM_ERROR_NONE;
- int delay = 1;
+ int delay = 5;
const char *app_id = "org.tizen.helloworld";
ret = app_control_create(&app_control);
assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
ret = alarm_schedule_once_after_delay(app_control, delay, &tid);
-
- app_control_destroy(app_control);
- alarm_cancel_all();
-
assert_eq_with_exit(ret, ALARM_ERROR_NONE);
- normal_exit(0);
+
+ g_timeout_add_seconds(10, __alarm_check, app_control);
return 0;
}
int ret2 = ALARM_ERROR_NONE;
int tid;
int delay = 1;
- int period = 1;
+ int period = 5;
+ bool is_running = false;
const char *app_id = "org.tizen.helloworld";
ret = app_control_create(&app_control);
ret1 = alarm_schedule_after_delay(app_control, delay, period, &tid);
ret2 = alarm_cancel(tid);
+ sleep(10);
+
+ ret = app_manager_is_running(app_id, &is_running);
+ assert_eq_with_exit(ret, APP_MANAGER_ERROR_NONE);
+ assert_eq_with_exit(is_running, false);
+
app_control_destroy(app_control);
alarm_cancel_all();
int utc_alarm_get_scheduled_date_p(void)
{
struct tm date;
+ struct tm get_date;
app_control_h app_control;
int ret = ALARM_ERROR_NONE;
int tid;
- int delay = 1;
- int period = 5;
+ time_t now;
const char *app_id = "org.tizen.helloworld";
+ time(&now);
+ now += 20;
+ tzset();
+ localtime_r(&now, &date);
+
ret = app_control_create(&app_control);
assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
- alarm_schedule_after_delay(app_control, delay, period, &tid);
+ ret = alarm_schedule_once_at_date(app_control, &date, &tid);
+ assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
+
+ ret = alarm_get_scheduled_date(tid, &get_date);
+ assert_eq_with_exit(ret, ALARM_ERROR_NONE);
- ret = alarm_get_scheduled_date(tid, &date);
+ assert_eq_with_exit(date.tm_sec, get_date.tm_sec);
app_control_destroy(app_control);
alarm_cancel_all();
- assert_eq_with_exit(ret, ALARM_ERROR_NONE);
normal_exit(0);
return 0;
app_control_h app_control;
int tid;
const char *app_id = "org.tizen.helloworld";
-
int ret = ALARM_ERROR_NONE;
time(&now);
- now += 20;
+ now += 5;
tzset();
localtime_r(&now, &date);
ret = alarm_schedule_once_at_date(app_control, &date, &tid);
- app_control_destroy(app_control);
- alarm_cancel_all();
-
- assert_eq_with_exit(ret, ALARM_ERROR_NONE);
- normal_exit(0);
+ g_timeout_add_seconds(10, __alarm_check, app_control);
return 0;
}
time(&now);
tzset();
localtime_r(&now, &date);
- date.tm_sec += 3;
+ date.tm_sec += 5;
ret = app_control_create(&app_control);
assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
- ret = alarm_schedule_with_recurrence_week_flag(app_control, &date, ALARM_WEEK_FLAG_MONDAY, &tid);
-
- app_control_destroy(app_control);
- alarm_cancel_all();
+ ret = alarm_schedule_with_recurrence_week_flag(app_control, &date,
+ ALARM_WEEK_FLAG_MONDAY | ALARM_WEEK_FLAG_TUESDAY |
+ ALARM_WEEK_FLAG_WEDNESDAY | ALARM_WEEK_FLAG_THURSDAY |
+ ALARM_WEEK_FLAG_FRIDAY | ALARM_WEEK_FLAG_SATURDAY |
+ ALARM_WEEK_FLAG_SUNDAY, &tid);
- assert_eq_with_exit(ret, ALARM_ERROR_NONE);
- normal_exit(0);
+ g_timeout_add_seconds(10, __alarm_check, app_control);
return 0;
}
app_control_h app_control;
int alarm_id;
int ret = ALARM_ERROR_NONE;
- int delay = 1;
- int period = 1;
const char *app_id = "org.tizen.helloworld";
ret = app_control_create(&app_control);