Modify some test code 77/53777/2 accepted/tizen/mobile/20151210.082550 accepted/tizen/tv/20151210.082826 accepted/tizen/wearable/20151210.082838 submit/tizen/20151210.060140
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 9 Dec 2015 08:09:10 +0000 (17:09 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 10 Dec 2015 00:54:40 +0000 (09:54 +0900)
Change-Id: I4928930baa610ac24631453299836dcf6711f9b9
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
test/media-content_test.c

index 25e973e..23ee386 100755 (executable)
@@ -2916,17 +2916,43 @@ void _noti_cb(media_content_error_e error,
 
        if (user_data) media_content_debug("String : %s\n", (char *)user_data);
 
-       //g_main_loop_quit(g_loop);
+//     g_main_loop_quit(g_loop);
        return;
 }
 
+void _noti_cb_2(media_content_error_e error,
+                               int pid,
+                               media_content_db_update_item_type_e update_item,
+                               media_content_db_update_type_e update_type,
+                               media_content_type_e media_type,
+                               char *uuid,
+                               char *path,
+                               char *mime_type,
+                               void *user_data)
+{
+       if (error == 0) {
+               media_content_debug("noti_2 success! : %d\n", error);
+       } else {
+               media_content_debug("error occured! : %d\n", error);
+       }
+
+       media_content_debug("Noti_2 from PID(%d)\n", pid);
+
+       g_main_loop_quit(g_loop);
+       return;
+}
+
+static media_content_noti_h noti_h;
+static media_content_noti_h noti_h_2;
+
 gboolean _send_noti_operations(gpointer data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        /* First of all, noti subscription */
        char *user_str = strdup("hi");
-       media_content_set_db_updated_cb(_noti_cb, (void*)user_str);
+       media_content_add_db_updated_cb(_noti_cb, (void*)user_str, &noti_h);
+       media_content_add_db_updated_cb(_noti_cb_2, (void*)user_str, &noti_h_2);
 
        /* media_info_insert_to_db */
        media_info_h media_item = NULL;
@@ -2943,8 +2969,11 @@ gboolean _send_noti_operations(gpointer data)
 
        /* media_info_delete_batch_from_db */
        filter_h filter;
-       char *condition = "MEDIA_PATH LIKE \'";
-       strncat(condition, tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%jpg\'"), 17);
+       char condition[2048] = {0,};
+       const char *temp=  NULL;
+       temp = tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%\'");
+       snprintf(condition, sizeof(condition), "MEDIA_PATH LIKE \'%s", temp);
+//     strncat(condition, temp, strlen(temp));
 
        ret = media_filter_create(&filter);
        if (ret != MEDIA_CONTENT_ERROR_NONE) {
@@ -2970,6 +2999,8 @@ gboolean _send_noti_operations(gpointer data)
 
        media_filter_destroy(filter);
 
+       media_content_remove_db_updated_cb(noti_h);
+
        /* media_info_update_to_db */
        ret = media_info_update_to_db(media_item);
        if (ret != MEDIA_CONTENT_ERROR_NONE) {
@@ -2999,7 +3030,7 @@ int test_noti()
        g_main_loop_unref(g_loop);
 
        test_filter_destroy();
-       media_content_unset_db_updated_cb();
+       media_content_remove_db_updated_cb(noti_h_2);
 
        return ret;
 }