* @description Creates a context history handle and Releases the resources occupied by a handle
* @scenario Create a context history handle\n
* Release the resources occupied by a handle
-* @apicovered context_history_create, context_history_destroy
+* @apicovered context_history_create, context_history_destroy
* @passcase When context_history_create and context_history_destroy are successful and return 0
* @failcase If target API context_history_create or context_history_destroy fails or not return 0
* @precondition context_history_create() for context_history_destroy
int ITc_context_history_create_destroy_p(void)
{
START_TEST;
-
+
//Target API
int nRet = context_history_create(&g_Handle);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_create", ContextHistoryGetError(nRet));
//Target API
nRet = context_history_destroy(g_Handle);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_destroy", ContextHistoryGetError(nRet));
-
+
return 0;
}
* @description Creates a history filter and Releases the resources occupied by a filter
* @scenario Create a history filter
* Release the memory allocated for the for the filter
-* @apicovered context_history_filter_create, context_history_filter_destroy
+* @apicovered context_history_filter_create, context_history_filter_destroy
* @passcase When context_history_filter_create and context_history_filter_destroy are successful and return 0
* @failcase If target API context_history_filter_create or context_history_filter_destroy fails or return negative value
* @precondition context_history_filter_create for context_history_filter_destroy.
int ITc_context_history_filter_create_destroy_p(void)
{
START_TEST;
-
+
//Target API
int nRet = context_history_filter_create(&g_filter);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet));
//Target API
nRet = context_history_filter_destroy(g_filter);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_destroy", ContextHistoryGetError(nRet));
-
+
return 0;
}
-//& purpose: Sets an integer value to a filter
+//& purpose: Sets an integer value to a filter
//& type: auto
/**
* @testcase ITc_context_history_filter_set_int_p
* @type auto
* @description This sets the integer value to a filter
* @scenario Set an integer value to a filter
-* @apicovered context_history_filter_set_int
+* @apicovered context_history_filter_set_int
* @passcase When context_history_filter_set_int are execute successful and return 0
* @failcase If target API context_history_filter_set_int are return negative number
* @precondition context_history_filter_create must be create.
int ITc_context_history_filter_set_int_p(void)
{
START_TEST;
-
+
int nRet = context_history_filter_create(&g_filter);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet));
-
+
//Target API
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_RESULT_SIZE,10);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter));
-
+
nRet = context_history_filter_destroy(g_filter);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_destroy", ContextHistoryGetError(nRet));
-
+
return 0;
}
int ITc_context_history_filter_set_string_p(void)
{
START_TEST;
-
+
int nRet = context_history_filter_create(&g_filter);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet));
-
+
//Target API
nRet = context_history_filter_set_string(g_filter, CONTEXT_HISTORY_FILTER_APP_ID, TEST_TESTAPPLICATION_APPID);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_string", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter));
nRet = context_history_filter_destroy(g_filter);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_destroy", ContextHistoryGetError(nRet));
-
+
return 0;
}
int ITc_context_history_get_list_destroy_p(void)
{
START_TEST;
-
+
int nRet = context_history_create(&g_Handle);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_create", ContextHistoryGetError(nRet));
nRet = context_history_filter_create(&g_filter);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet), context_history_destroy(g_Handle));
-
+
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_TIME_SPAN,INT_VAL1);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_RESULT_SIZE,INT_VAL2);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
//Target API
nRet = context_history_get_list(g_Handle, CONTEXT_HISTORY_RARELY_USED_APP, g_filter, &g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_get_list", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
//Target API
nRet = context_history_list_destroy(g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_list_destroy", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
nRet = context_history_destroy(g_Handle);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_destroy", ContextHistoryGetError(nRet));
-
+
return 0;
}
int ITc_context_history_list_get_count_p(void)
{
START_TEST;
-
+
int nListCount;
int nRet = context_history_create(&g_Handle);
nRet = context_history_filter_create(&g_filter);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet), context_history_destroy(g_Handle));
-
+
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_TIME_SPAN,INT_VAL1);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_RESULT_SIZE, INT_VAL2);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_get_list(g_Handle, CONTEXT_HISTORY_RARELY_USED_APP, g_filter, &g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_get_list", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
//Target API
nRet = context_history_list_get_count(g_history_list, &nListCount);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_list_get_count", ContextHistoryGetError(nRet), context_history_list_destroy(g_history_list);context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_list_destroy(g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_list_destroy", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
nRet = context_history_destroy(g_Handle);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_destroy", ContextHistoryGetError(nRet));
-
+
return 0;
}
nRet = context_history_filter_create(&g_filter);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet), context_history_destroy(g_Handle));
-
+
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_TIME_SPAN, INT_VAL1);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_RESULT_SIZE, INT_VAL2);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_get_list(g_Handle, CONTEXT_HISTORY_RARELY_USED_APP, g_filter, &g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_get_list", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
//Target API
nRet = context_history_list_get_current(g_history_list, &g_history_record);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_list_get_current", ContextHistoryGetError(nRet), context_history_list_destroy(g_history_list);context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_record_destroy(g_history_record);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_record_destroy", ContextHistoryGetError(nRet), context_history_list_destroy(g_history_list);context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_list_destroy(g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_list_destroy", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
int ITc_context_history_list_move_next_p(void)
{
START_TEST;
-
+
int nRet = context_history_create(&g_Handle);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_create", ContextHistoryGetError(nRet));
nRet = context_history_filter_create(&g_filter);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet), context_history_destroy(g_Handle));
-
+
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_TIME_SPAN, INT_VAL1);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_RESULT_SIZE, INT_VAL2);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_get_list(g_Handle, CONTEXT_HISTORY_RARELY_USED_APP, g_filter, &g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_get_list", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
//Target API
nRet = context_history_list_move_next(g_history_list);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_list_move_next", ContextHistoryGetError(nRet), context_history_list_destroy(g_history_list);context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
nRet = context_history_destroy(g_Handle);
PRINT_RESULT(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_destroy", ContextHistoryGetError(nRet));
-
+
return 0;
}
nRet = context_history_filter_create(&g_filter);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet), context_history_destroy(g_Handle));
CHECK_HANDLE_CLEANUP(g_filter,"context_history_filter_create",context_history_destroy(g_Handle));
-
+
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_TIME_SPAN, INT_VAL1);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_get_list(g_Handle, CONTEXT_HISTORY_BATTERY_USAGE, g_filter, &g_history_list);
- if (nRet == CONTEXT_HISTORY_ERROR_NO_DATA)
+ if (nRet == CONTEXT_HISTORY_ERROR_NO_DATA)
{
FPRINTF("[Line : %d][%s] Skip context_history_get_list() for CONTEXT_HISTORY_BATTERY_USAGE. Data not exist.\\n", __LINE__, API_NAMESPACE);
- }
+ }
else
{
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_get_list", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
CHECK_HANDLE_CLEANUP(g_history_list,"context_history_get_list",context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
nRet = context_history_list_get_current(g_history_list, &g_history_record);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_list_get_current", ContextHistoryGetError(nRet), context_history_list_destroy(g_history_list);context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
CHECK_HANDLE_CLEANUP(g_history_record,"context_history_list_get_current",context_history_list_destroy(g_history_list);context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
-
+
//Target API
nRet = context_history_record_get_double(g_history_record, CONTEXT_HISTORY_TOTAL_AMOUNT, &nValue);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_record_get_double", ContextHistoryGetError(nRet), context_history_record_destroy(g_history_record);context_history_list_destroy(g_history_list);context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
START_TEST;
context_history_data_e eContextHistory[]={
- CONTEXT_HISTORY_RECENTLY_USED_APP,
+ CONTEXT_HISTORY_RECENTLY_USED_APP,
CONTEXT_HISTORY_FREQUENTLY_USED_APP,
CONTEXT_HISTORY_BATTERY_USAGE,
CONTEXT_HISTORY_RECENT_BATTERY_USAGE
nRet = context_history_filter_create(&g_filter);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_create", ContextHistoryGetError(nRet), context_history_destroy(g_Handle));
CHECK_HANDLE_CLEANUP(g_filter,"context_history_filter_create",context_history_destroy(g_Handle));
-
+
nRet = context_history_filter_set_int(g_filter, CONTEXT_HISTORY_FILTER_RESULT_SIZE, INT_VAL1);
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_filter_set_int", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
for(int nLoopEnumCount = 0; nLoopEnumCount < nEnumLength; nLoopEnumCount++)
{
-
nRet = context_history_get_list(g_Handle, eContextHistory[nLoopEnumCount], g_filter, &g_history_list);
- if(eContextHistory[nLoopEnumCount] == CONTEXT_HISTORY_BATTERY_USAGE || eContextHistory[nLoopEnumCount] == CONTEXT_HISTORY_RECENT_BATTERY_USAGE)
+ if (nRet == CONTEXT_HISTORY_ERROR_NO_DATA)
{
- if(!bFeatureIsSupported)
+ FPRINTF("[Line : %d][%s] Skip context_history_get_list() for %s. Data not exist.\\n", __LINE__, API_NAMESPACE,ContextHistoryGetHistoryData(eContextHistory[nLoopEnumCount]));
+ continue;
+ }
+ else if (nRet == CONTEXT_HISTORY_ERROR_NOT_SUPPORTED)
+ {
+ if(eContextHistory[nLoopEnumCount] == CONTEXT_HISTORY_BATTERY_USAGE || eContextHistory[nLoopEnumCount] == CONTEXT_HISTORY_RECENT_BATTERY_USAGE)
{
- if(nRet == CONTEXT_HISTORY_ERROR_NOT_SUPPORTED)
+ if(!bFeatureIsSupported)
{
FPRINTF("[Line : %d][%s] Feature Not Supported for api context_history_get_list\\n", __LINE__, API_NAMESPACE);
- return 0;
- }
- else
- {
- FPRINTF("[Line : %d][%s] Feature Mismatch for api context_history_get_list\\n", __LINE__, API_NAMESPACE);
- return 1;
+ continue;
}
}
}
+
PRINT_RESULT_CLEANUP(CONTEXT_HISTORY_ERROR_NONE, nRet, "context_history_get_list", ContextHistoryGetError(nRet), context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
CHECK_HANDLE_CLEANUP(g_history_list,"context_history_get_list",context_history_filter_destroy(g_filter);context_history_destroy(g_Handle));
context_history_list_destroy(g_history_list);
START_TEST;
context_history_data_e eContextHistory[]={
- CONTEXT_HISTORY_RECENTLY_USED_APP,
+ CONTEXT_HISTORY_RECENTLY_USED_APP,
CONTEXT_HISTORY_FREQUENTLY_USED_APP,
CONTEXT_HISTORY_BATTERY_USAGE,
CONTEXT_HISTORY_RECENT_BATTERY_USAGE