Remove unused product API
[platform/core/api/media-content.git] / test / media-content_test.c
index 4b003b3..13adea4 100755 (executable)
 #include <unistd.h>
 #include <media_content.h>
 #include <media_info_private.h>
-#include <dlog.h>
-#include <pthread.h>
 #include <glib.h>
 #include <tzplatform_config.h>
 #include <media_content_internal.h>
 
 
 static filter_h g_filter = NULL;
-static filter_h g_filter_g = NULL;     /*filter for group like folder, tag, playlist, album, year ... */
 
 static GMainLoop *g_loop = NULL;
-static int g_cnt = 0;
-static int g_media_cnt = 0;
 
 #define test_audio_id "3304285f-1070-41af-8b4e-f0086cc768f3"
 #define test_video_id "53c43e7e-53d2-4194-80a6-55d5dcde0def"
@@ -42,7 +37,6 @@ static void get_audio_meta(media_info_h media)
 {
        audio_meta_h audio = NULL;
        char *c_value = NULL;
-       int i_value = 0;
 
        content_debug("=== audio meta ===");
        if (media_info_get_audio(media, &audio) != MEDIA_CONTENT_ERROR_NONE)
@@ -73,121 +67,19 @@ static void get_audio_meta(media_info_h media)
                SAFE_FREE(c_value);
        }
 
-       if (audio_meta_get_composer(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("composer : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
        if (audio_meta_get_year(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
                content_debug("year : [%s]", c_value);
                SAFE_FREE(c_value);
        }
 
-       if (audio_meta_get_recorded_date(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("recorded date : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (audio_meta_get_copyright(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("copyright : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
        if (audio_meta_get_track_num(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
                content_debug("track number : [%s]", c_value);
                SAFE_FREE(c_value);
        }
 
-       if (audio_meta_get_bit_rate(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("bitrate : [%d]", i_value);
-
-       if (audio_meta_get_sample_rate(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("samplerate : [%d]", i_value);
-
-       if (audio_meta_get_channel(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("channel : [%d]", i_value);
-
-       if (audio_meta_get_duration(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("duration : [%d]", i_value);
-
        audio_meta_destroy(audio);
 }
 
-static void get_video_meta(media_info_h media)
-{
-       video_meta_h video = NULL;
-       char *c_value = NULL;
-       int i_value = 0;
-
-       content_debug("=== video meta ===");
-       if (media_info_get_video(media, &video) != MEDIA_CONTENT_ERROR_NONE)
-               return;
-
-       if (video_meta_get_media_id(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("video_id : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_album(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("album : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_artist(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("artist : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_album_artist(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("album artist : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_genre(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("genre : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_composer(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("composer : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_year(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("year : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_recorded_date(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("recorded date : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_copyright(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("copyright : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_track_num(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("track num : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (video_meta_get_bit_rate(video, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("bitrate : [%d]", i_value);
-
-       if (video_meta_get_duration(video, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("duration : [%d]", i_value);
-
-       if (video_meta_get_width(video, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("width : [%d]", i_value);
-
-       if (video_meta_get_height(video, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("height : [%d]", i_value);
-
-       video_meta_destroy(video);
-}
-
 static void get_image_meta(media_info_h media)
 {
        image_meta_h image = NULL;
@@ -235,16 +127,6 @@ static void get_book_meta(media_info_h media)
                SAFE_FREE(c_value);
        }
 
-       if (book_meta_get_date(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("date : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (book_meta_get_publisher(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("publisher : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
        if (book_meta_get_subject(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
                content_debug("subject : [%s]", c_value);
                SAFE_FREE(c_value);
@@ -297,57 +179,9 @@ static void get_bookmark_meta(media_bookmark_h bookmark)
        }
 }
 
-static void get_tag_meta(media_tag_h tag)
-{
-       char *c_value = NULL;
-       int i_value = 0;
-
-       content_debug("=== tag meta ===");
-       if (media_tag_get_tag_id(tag, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("tag_id : %d", i_value);
-
-       if (media_tag_get_name(tag, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("tag_name : %s", c_value);
-               SAFE_FREE(c_value);
-       }
-}
-
-static void get_face_meta(media_face_h face)
-{
-       char *c_value = NULL;
-       unsigned int rect_x = 0;
-       unsigned int rect_y = 0;
-       unsigned int rect_w = 0;
-       unsigned int rect_h = 0;
-       media_content_orientation_e orientation = 0;
-
-       content_debug("=== face meta ===");
-       if (media_face_get_face_id(face, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("face_id : %s", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (media_face_get_media_id(face, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("media_id : %s", c_value);
-               SAFE_FREE(c_value);
-       }
-
-       if (media_face_get_face_rect(face, &rect_x, &rect_y, &rect_w, &rect_h) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("face_rect x[%d] y[%d] w[%d] h[%d]", rect_x, rect_y, rect_w, rect_h);
-
-       if (media_face_get_orientation(face, &orientation) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("orientation : %d", orientation);
-
-       if (media_face_get_tag(face, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("tag : %s", c_value);
-               SAFE_FREE(c_value);
-       }
-}
-
 static void get_folder_meta(media_folder_h folder, char **folder_id)
 {
        char *c_value = NULL;
-       media_content_storage_e storage_type;
 
        content_debug("=== folder meta ===");
        if (media_folder_get_folder_id(folder, &c_value) != MEDIA_CONTENT_ERROR_NONE) {
@@ -364,24 +198,17 @@ static void get_folder_meta(media_folder_h folder, char **folder_id)
                content_debug("folder_name : %s", c_value);
                SAFE_FREE(c_value);
        }
-
-       if (media_folder_get_storage_type(folder, &storage_type) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("storage_type : [%d]", storage_type);
-
-       if (media_folder_get_storage_id(folder, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("storage_id : %s", c_value);
-               SAFE_FREE(c_value);
-       }
 }
 
 static void get_media_meta(media_info_h media)
 {
        char *c_value = NULL;
-       int i_value = 0;
        time_t t_value = 0;
-       bool b_value = false;
        unsigned long long size = 0;
        media_content_type_e media_type = 0;
+#ifdef _USE_TVPD_MODE
+       int i_value = 0;
+#endif
 
        content_debug("=== media meta ===");
        if (media_info_get_media_type(media, &media_type) == MEDIA_CONTENT_ERROR_NONE)
@@ -412,11 +239,6 @@ static void get_media_meta(media_info_h media)
                SAFE_FREE(c_value);
        }
 
-       if (media_info_get_description(media, &c_value) == MEDIA_CONTENT_ERROR_NONE) {
-               content_debug("description : [%s]", c_value);
-               SAFE_FREE(c_value);
-       }
-
        if (media_info_get_size(media, &size) == MEDIA_CONTENT_ERROR_NONE)
                content_debug("size : [%lld]", size);
 
@@ -426,27 +248,9 @@ static void get_media_meta(media_info_h media)
        if (media_info_get_modified_time(media, &t_value) == MEDIA_CONTENT_ERROR_NONE)
                content_debug("modified_time : [%ld]", t_value);
 
-       if (media_info_get_timeline(media, &t_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("timeline : [%ld]", t_value);
-
-       if (media_info_get_rating(media, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("rating : [%d]", i_value);
-
-       if (media_info_get_favorite(media, &b_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("favorite : [%d]", b_value);
-
-       if (media_info_is_drm(media, &b_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("is_drm : [%d]", b_value);
-
-       if (media_info_is_360_content(media, &b_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("is_360 : [%d]", b_value);
-
 #ifdef _USE_TVPD_MODE
        if (media_info_get_stitched_state(media, &i_value) == MEDIA_CONTENT_ERROR_NONE)
                content_debug("360 stitched : [%d]", i_value);
-
-       if (media_info_get_stitched_engine(media, &i_value) == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("360 engine : [%d]", i_value);
 #endif
 
        if (media_type == MEDIA_CONTENT_TYPE_MUSIC)
@@ -455,9 +259,6 @@ static void get_media_meta(media_info_h media)
        if (media_type == MEDIA_CONTENT_TYPE_IMAGE)
                get_image_meta(media);
 
-       if (media_type == MEDIA_CONTENT_TYPE_VIDEO)
-               get_video_meta(media);
-
        if (media_type == MEDIA_CONTENT_TYPE_BOOK)
                get_book_meta(media);
 
@@ -503,17 +304,6 @@ bool gallery_media_item_cb(media_info_h media, void *user_data)
        return true;
 }
 
-bool gallery_tag_item_cb(media_tag_h tag, void *user_data)
-{
-       media_tag_h new_tag = NULL;
-       media_tag_clone(&new_tag, tag);
-
-       GList **list = (GList**)user_data;
-       *list = g_list_append(*list, new_tag);
-
-       return true;
-}
-
 bool gallery_bookmarks_cb(media_bookmark_h bookmark, void *user_data)
 {
        media_bookmark_h new_bm = NULL;
@@ -615,18 +405,6 @@ bool playlist_list_cb(media_playlist_h playlist, void *user_data)
        return true;
 }
 
-bool tag_list_cb(media_tag_h tag, void *user_data)
-{
-       if (!tag) {
-               content_debug(" tag handle is NULL");
-               return false;
-       }
-
-       get_tag_meta(tag);
-
-       return true;
-}
-
 bool bookmarks_cb(media_bookmark_h bookmark, void *user_data)
 {
        if (bookmark != NULL && user_data != NULL) {
@@ -725,27 +503,6 @@ int test_filter_create(void)
         */
        ret = media_filter_set_condition(g_filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
 
-       /* Collation of ordering
-        * If you want to get list, which is sorted by NOCASE,
-        * call media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_NOCASE);
-        * Or,
-        * call media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_DEFAULT);
-        */
-       /* Able to set multi column to set order */
-#if 0
-       ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, "MEDIA_MODIFIED_TIME, MEDIA_DISPLAY_NAME", MEDIA_CONTENT_COLLATE_DEFAULT);
-       ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_DEFAULT);
-       ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TRACK_NUM_INT, MEDIA_CONTENT_COLLATE_DEFAULT);
-       ret = media_filter_set_storage(g_filter, "cfbf3d2c-71c5-4611-bccc-7cbac890146e");
-
-       /* Filter for group */
-       const char *g_condition = "TAG_NAME like \"\%my\%\"";
-       const char *g_condition = "BOOKMARK_MARKED_TIME > 300";
-#endif
-       ret = media_filter_create(&g_filter_g);
-
-       ret = media_filter_set_order(g_filter_g, MEDIA_CONTENT_ORDER_DESC, TAG_NAME, MEDIA_CONTENT_COLLATE_DEFAULT);
-
        return ret;
 }
 
@@ -887,43 +644,6 @@ int test_gallery_scenario(void)
                }
        }
 
-       /* Get tag list */
-       media_tag_h tag_handle = NULL;
-       GList *tag_list = NULL;
-       GList *media_list_in_tag = NULL;
-       int tag_id = 0;
-
-       ret = media_tag_foreach_tag_from_db(filter, gallery_tag_item_cb, &tag_list);
-
-       if (ret != MEDIA_CONTENT_ERROR_NONE) {
-               content_error("media_tag_foreach_tag_from_db failed: %d", ret);
-               return -1;
-       } else {
-               content_error("media_tag_foreach_tag_from_db success");
-               for (i = 0; i < g_list_length(tag_list); i++) {
-                       tag_handle = (media_tag_h)g_list_nth_data(tag_list, i);
-                       get_tag_meta(tag_handle);
-
-                       ret = media_tag_get_tag_id(tag_handle, &tag_id);
-                       if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                               ret = media_tag_foreach_media_from_db(tag_id, filter, gallery_media_item_cb, &media_list_in_tag);
-                               if (ret != MEDIA_CONTENT_ERROR_NONE) {
-                                       content_error("media_tag_foreach_media_from_db failed: %d", ret);
-                                       return -1;
-                               } else {
-                                       content_error("media_tag_foreach_media_from_db success");
-                                       unsigned int j = 0;
-                                       media_info_h tag_media_handle;
-
-                                       for (j = 0; j < g_list_length(media_list_in_tag); j++) {
-                                               tag_media_handle = (media_info_h)g_list_nth_data(media_list_in_tag, j);
-                                               get_media_meta(tag_media_handle);
-                                       }
-                               }
-                       }
-               }
-       }
-
        /* Remove folder list */
        if (folder_list) {
                for (i = 0; i < g_list_length(folder_list); i++) {
@@ -958,30 +678,6 @@ int test_gallery_scenario(void)
                g_list_free(item_list);
        }
 
-       /* Remove tag list */
-       if (tag_list) {
-               for (i = 0; i < g_list_length(tag_list); i++) {
-                       tag_handle = (media_tag_h)g_list_nth_data(tag_list, i);
-                       ret = media_tag_destroy(tag_handle);
-                       if (ret != MEDIA_CONTENT_ERROR_NONE)
-                               content_error("error media_tag_destroy : [%d]", ret);
-               }
-
-               g_list_free(tag_list);
-       }
-
-       /* Remove media list in a tag */
-       if (media_list_in_tag) {
-               for (i = 0; i < g_list_length(media_list_in_tag); i++) {
-                       media_handle = (media_info_h)g_list_nth_data(media_list_in_tag, i);
-                       ret = media_info_destroy(media_handle);
-                       if (ret != MEDIA_CONTENT_ERROR_NONE)
-                               content_error("media_info_destroy failed: %d", ret);
-               }
-
-               g_list_free(media_list_in_tag);
-       }
-
        return MEDIA_CONTENT_ERROR_NONE;
 }
 
@@ -1061,44 +757,6 @@ int test_media_info_operation(void)
        return ret;
 }
 
-int test_media_info_operation_2(void)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       int bookmark_count = 0;
-
-       content_debug("\n============Media info Test 2============\n\n");
-
-       test_filter_create();
-
-#if 0
-       /* Bookmark */
-       char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_VIDEOS, "teat11.jpg");
-       media_bookmark_insert_to_db(test_video_id, 100, thumbnail_path1);
-       media_bookmark_insert_to_db(test_video_id, 200, thumbnail_path1);
-
-       media_info_get_bookmark_count_from_db(test_video_id, g_filter_g, &bookmark_count);
-
-       content_debug("bookmark_count : [%d]", bookmark_count);
-
-       ret = media_info_foreach_bookmark_from_db(test_video_id, g_filter_g, bookmarks_cb, NULL);
-#endif
-
-       /* Tag */
-       ret = media_info_get_tag_count_from_db(test_audio_id, g_filter_g, &bookmark_count);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_tag_count_from_db failed: %d", ret);
-       else
-               content_debug("tag_count : [%d]", bookmark_count);
-
-       ret = media_info_foreach_tag_from_db(test_audio_id, g_filter_g, tag_list_cb, NULL);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_foreach_tag_from_db failed: %d", ret);
-
-       test_filter_destroy();
-
-       return ret;
-}
-
 int test_folder_operation(void)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -1117,10 +775,9 @@ int test_folder_operation(void)
                return ret;
        }
 
-       media_filter_set_condition(filter, "(MEDIA_TYPE = 0 or MEDIA_TYPE = 1) and MEDIA_STORAGE_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);       /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
+       media_filter_set_condition(filter, "MEDIA_TYPE = 0 or MEDIA_TYPE = 1", MEDIA_CONTENT_COLLATE_DEFAULT);  /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
        media_filter_set_offset(filter, 0, 5);
        media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_PATH, MEDIA_CONTENT_COLLATE_NOCASE);
-       media_filter_set_storage(filter, "cfbf3d2c-71c5-4611-bccc-7cbac890146e");
 
        ret = media_folder_get_folder_count_from_db(filter, &count);
        content_debug("Folder count : [%d]", count);
@@ -1137,7 +794,7 @@ int test_folder_operation(void)
                return ret;
        }
 
-       media_filter_set_condition(m_filter, "MEDIA_TYPE=1 and MEDIA_STORAGE_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);   /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
+       media_filter_set_condition(m_filter, "MEDIA_TYPE=1", MEDIA_CONTENT_COLLATE_DEFAULT);    /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
        media_filter_set_offset(m_filter, 0, 5);
        media_filter_set_order(m_filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_PATH, MEDIA_CONTENT_COLLATE_NOCASE);
 
@@ -1369,147 +1026,77 @@ int test_playlist_operation_v2(void)
        return ret;
 }
 
-int test_tag_operation(void)
+static void __bookmark_handle_free(gpointer data)
+{
+       media_bookmark_h handle = (media_bookmark_h) data;
+       media_bookmark_destroy(handle);
+}
+
+int test_bookmark_operation(void)
 {
+       /* bookmark is only supported for video information. */
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_tag_h tag_1;
-       media_tag_h tag_2;
-       media_tag_h tag_3;
-       int tag_id_1 = 0;
-       int tag_id_2 = 0;
-       int tag_id_3 = 0;
-       const char *tag_name_1 = "myTag_1";
-       const char *tag_name_2 = "myTag_2";
-       const char *tag_name_3 = "myTag_3";
-       int tag_count = 0;
-       int media_count = 0;
+       int bookmark_count = 0;
        filter_h filter;
+       GList *all_item_list = NULL;
+       int idx = 0;
 
-       content_debug("\n============Tag Test============\n\n");
+       content_debug("\n============Bookmark Test============\n\n");
 
-       const char *g_condition = "TAG_NAME like \"%%my%%\"";
+       const char *g_condition = "BOOKMARK_MARKED_TIME > 300";
 
        ret = media_filter_create(&filter);
-
-       ret = media_filter_set_condition(filter, g_condition, MEDIA_CONTENT_COLLATE_DEFAULT);
-
-       ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, TAG_NAME, MEDIA_CONTENT_COLLATE_DEFAULT);
-
-       /* Create Tag */
-       ret = media_tag_insert_to_db(tag_name_1, &tag_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_insert_to_db : [%d]", ret);
-       ret = media_tag_insert_to_db(tag_name_2, &tag_2);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_insert_to_db : [%d]", ret);
-       ret = media_tag_insert_to_db(tag_name_3, &tag_3);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_insert_to_db : [%d]", ret);
-
-       /* Add media to Tag */
-       ret = media_tag_add_media(tag_1, test_audio_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_add_media : [%d]", ret);
-       ret = media_tag_add_media(tag_1, test_video_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_add_media : [%d]", ret);
-       ret = media_tag_update_to_db(tag_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_update_to_db : [%d]", ret);
-
-       ret = media_tag_add_media(tag_2, test_audio_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_add_media : [%d]", ret);
-       ret = media_tag_update_to_db(tag_2);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_update_to_db : [%d]", ret);
-
-       /* Get Tag Count*/
-       ret = media_tag_get_tag_count_from_db(filter, &tag_count);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_get_tag_count_from_db : [%d]", ret);
-       else
-               content_debug("tag_count [%d]", tag_count);
+               content_error("error media_filter_create : [%d]", ret);
 
-       /* Get Tag*/
-       ret = media_tag_foreach_tag_from_db(filter, tag_list_cb, NULL);
+       ret = media_filter_set_condition(filter, g_condition, MEDIA_CONTENT_COLLATE_DEFAULT);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_foreach_tag_from_db : [%d]", ret);
+               content_error("error media_filter_set_condition : [%d]", ret);
 
-       /* Get Tag id*/
-       ret = media_tag_get_tag_id(tag_1, &tag_id_1);
+       ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, BOOKMARK_MARKED_TIME, MEDIA_CONTENT_COLLATE_DEFAULT);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_get_tag_id : [%d]", ret);
-       else
-               content_debug("tag_id_1 [%d]", tag_id_1);
+               content_error("error media_filter_set_order : [%d]", ret);
 
-       ret = media_tag_get_tag_id(tag_2, &tag_id_2);
+       /* insert bookmark to video */
+       const char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_VIDEOS, "teat11.jpg");
+       ret = media_bookmark_insert_to_db(test_video_id, 400, thumbnail_path1);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_get_tag_id : [%d]", ret);
-       else
-               content_debug("tag_id_2 [%d]", tag_id_2);
+               content_error("error media_bookmark_insert_to_db : [%d]", ret);
 
-       ret = media_tag_get_tag_id(tag_3, &tag_id_3);
+       ret = media_bookmark_insert_to_db(test_video_id, 600, thumbnail_path1);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_get_tag_id : [%d]", ret);
-       else
-               content_debug("tag_id_3 [%d]", tag_id_3);
+               content_error("error media_bookmark_insert_to_db : [%d]", ret);
 
-       /* Get media count */
-       ret = media_tag_get_media_count_from_db(tag_id_1, NULL, &media_count);
+       ret = media_bookmark_get_bookmark_count_from_db(filter, &bookmark_count);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_get_media_count_from_db : [%d]", ret);
+               content_error("error media_bookmark_get_bookmark_count_from_db : [%d]", ret);
        else
-               content_debug("tag_1_media_count [%d]", media_count);
+               content_debug("bookmark_count = [%d]", bookmark_count);
 
-       ret = media_tag_get_media_count_from_db(tag_id_2, NULL, &media_count);
+       ret = media_info_foreach_bookmark_from_db(test_video_id, NULL, bookmarks_cb, &all_item_list);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_get_media_count_from_db : [%d]", ret);
-       else
-               content_debug("tag_2_media_count [%d]", media_count);
+               content_error("error media_info_foreach_bookmark_from_db : [%d]", ret);
 
-       /* Get media of Tag */
-       ret = media_tag_foreach_media_from_db(tag_id_1, NULL, media_item_cb, NULL);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_foreach_media_from_db : [%d]", ret);
+       for (idx = 0; idx < g_list_length(all_item_list); idx++) {
+               media_bookmark_h bookmark_handle;
+               bookmark_handle = (media_bookmark_h)g_list_nth_data(all_item_list, idx);
 
-       ret = media_tag_foreach_media_from_db(tag_id_2, NULL, media_item_cb, NULL);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_foreach_media_from_db : [%d]", ret);
+               ret = media_bookmark_set_name(bookmark_handle, "test 1");
+               if (ret != MEDIA_CONTENT_ERROR_NONE)
+                       content_error("error media_bookmark_set_name : [%d]", ret);
 
-       /* Update Tag */
-       ret = media_tag_add_media(tag_2, test_video_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_add_media : [%d]", ret);
-       ret = media_tag_set_name(tag_2, "test_tag");
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_set_name : [%d]", ret);
-       ret = media_tag_update_to_db(tag_2);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_update_to_db : [%d]", ret);
+               ret = media_bookmark_update_to_db(bookmark_handle);
+               if (ret != MEDIA_CONTENT_ERROR_NONE)
+                       content_error("error media_bookmark_update_to_db : [%d]", ret);
+       }
 
-       /* Get Updated Tag*/
-       ret = media_tag_foreach_tag_from_db(filter, tag_list_cb, NULL);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_foreach_tag_from_db : [%d]", ret);
+       if (all_item_list)
+               g_list_free_full(all_item_list, __bookmark_handle_free);
 
-       /* deletes the tag */
-       ret = media_tag_delete_from_db(tag_id_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_delete_from_db : [%d]", ret);
-       ret = media_tag_delete_from_db(tag_id_2);
+       ret = media_info_foreach_bookmark_from_db(test_video_id, NULL, bookmarks_cb, NULL);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_delete_from_db : [%d]", ret);
+               content_error("error media_info_foreach_bookmark_from_db : [%d]", ret);
 
-       ret = media_tag_destroy(tag_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_destroy : [%d]", ret);
-       ret = media_tag_destroy(tag_2);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_destroy : [%d]", ret);
-       ret = media_tag_destroy(tag_3);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_destroy : [%d]", ret);
        ret = media_filter_destroy(filter);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                content_error("error media_filter_destroy : [%d]", ret);
@@ -1517,137 +1104,7 @@ int test_tag_operation(void)
        return ret;
 }
 
-int test_tag_operation_v2(void)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_tag_h tag_1;
-       const char *tag_name_1 = "myTag_1";
-       int tag_id = -1;
-
-       content_debug("\n============Tag Test V2============\n\n");
-
-       /* Create Tag */
-       ret = media_tag_create(&tag_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_create : [%d]", ret);
-
-       ret = media_tag_set_name(tag_1, tag_name_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_set_name : [%d]", ret);
-
-       /* Add media to Tag */
-       ret = media_tag_add_media(tag_1, test_audio_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_add_media : [%d]", ret);
-
-       ret = media_tag_add_media(tag_1, test_video_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_add_media : [%d]", ret);
-
-       ret = media_tag_insert_to_db_v2(tag_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_insert_to_db_v2 : [%d]", ret);
-
-#if 1
-       ret = media_tag_get_tag_id(tag_1, &tag_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_get_tag_id : [%d]", ret);
-
-       ret = media_tag_remove_media(tag_1, test_video_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_add_media : [%d]", ret);
-
-       ret = media_tag_update_to_db_v2(tag_id, tag_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_update_to_db_v2 : [%d]", ret);
-#endif
-
-       ret = media_tag_destroy(tag_1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_tag_destroy : [%d]", ret);
-
-       return ret;
-}
-
-static void __bookmark_handle_free(gpointer data)
-{
-       media_bookmark_h handle = (media_bookmark_h) data;
-       media_bookmark_destroy(handle);
-}
-
-int test_bookmark_operation(void)
-{
-       /* bookmark is only supported for video information. */
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       int bookmark_count = 0;
-       filter_h filter;
-       GList *all_item_list = NULL;
-       int idx = 0;
-
-       content_debug("\n============Bookmark Test============\n\n");
-
-       const char *g_condition = "BOOKMARK_MARKED_TIME > 300";
-
-       ret = media_filter_create(&filter);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_filter_create : [%d]", ret);
-
-       ret = media_filter_set_condition(filter, g_condition, MEDIA_CONTENT_COLLATE_DEFAULT);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_filter_set_condition : [%d]", ret);
-
-       ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, BOOKMARK_MARKED_TIME, MEDIA_CONTENT_COLLATE_DEFAULT);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_filter_set_order : [%d]", ret);
-
-       /* insert bookmark to video */
-       const char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_VIDEOS, "teat11.jpg");
-       ret = media_bookmark_insert_to_db(test_video_id, 400, thumbnail_path1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_bookmark_insert_to_db : [%d]", ret);
-
-       ret = media_bookmark_insert_to_db(test_video_id, 600, thumbnail_path1);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_bookmark_insert_to_db : [%d]", ret);
-
-       ret = media_bookmark_get_bookmark_count_from_db(filter, &bookmark_count);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_bookmark_get_bookmark_count_from_db : [%d]", ret);
-       else
-               content_debug("bookmark_count = [%d]", bookmark_count);
-
-       ret = media_info_foreach_bookmark_from_db(test_video_id, NULL, bookmarks_cb, &all_item_list);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_info_foreach_bookmark_from_db : [%d]", ret);
-
-       for (idx = 0; idx < g_list_length(all_item_list); idx++) {
-               media_bookmark_h bookmark_handle;
-               bookmark_handle = (media_bookmark_h)g_list_nth_data(all_item_list, idx);
-
-               ret = media_bookmark_set_name(bookmark_handle, "test 1");
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("error media_bookmark_set_name : [%d]", ret);
-
-               ret = media_bookmark_update_to_db(bookmark_handle);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("error media_bookmark_update_to_db : [%d]", ret);
-       }
-
-       if (all_item_list)
-               g_list_free_full(all_item_list, __bookmark_handle_free);
-
-       ret = media_info_foreach_bookmark_from_db(test_video_id, NULL, bookmarks_cb, NULL);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_info_foreach_bookmark_from_db : [%d]", ret);
-
-       ret = media_filter_destroy(filter);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("error media_filter_destroy : [%d]", ret);
-
-       return ret;
-}
-
-int test_bookmark_operation_v2(void)
+int test_bookmark_operation_v2(void)
 {
        content_debug("\n============Bookmark Test V2============\n\n");
 
@@ -1822,12 +1279,6 @@ int test_insert(void)
 
        SAFE_FREE(media_id);
 
-       ret = media_info_update_to_db(media_item);
-       if (ret == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("media_info_update_to_db is success");
-       else
-               content_error("media_info_update_to_db is failed");
-
        ret = media_info_destroy(media_item);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                content_error("media_info_destroy failed: %d", ret);
@@ -1866,360 +1317,33 @@ int test_move(void)
        return ret;
 }
 
-void thumbnail_completed_cb(media_content_error_e error, const char *path, void *user_data)
-{
-       char *thumbnail_path = NULL;
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       g_cnt++;
-
-       content_debug("=================[%d][%d]", g_media_cnt, g_cnt);
-       content_debug("error_code [%d]", error);
-       content_debug("thumbnail_path [%s]", path);
-       if (user_data != NULL) {
-               media_info_h media = (media_info_h)user_data;
-               ret = media_info_get_thumbnail_path(media, &thumbnail_path);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_get_thumbnail_path failed: %d", ret);
-               else
-                       content_debug("thumbnail_path get from media[%s]", thumbnail_path);
-               SAFE_FREE(thumbnail_path);
-               ret = media_info_destroy(media);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_destroy failed: %d", ret);
-       }
-
-       if (g_cnt == g_media_cnt)
-               g_main_loop_quit(g_loop);
-
-       return;
-}
-
-bool thumbnail_create_cb(media_info_h media, void *user_data)
-{
-       char *media_id = NULL;
-       media_info_h dst = NULL;
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       if (media == NULL) {
-               content_debug("NO Item");
-               return true;
-       }
-
-       ret = media_info_get_media_id(media, &media_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_id failed: %d", ret);
-       else
-               content_debug("media_id : [%s]", media_id);
-
-       ret = media_info_clone(&dst, media);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_clone failed: %d", ret);
-       else {
-               ret = media_info_create_thumbnail(dst, thumbnail_completed_cb, dst);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_create_thumbnail failed: %d", ret);
-       }
-
-       /* fix prevent: Resource leak */
-       SAFE_FREE(media_id);
-
-       return true;
-}
-
-bool thumbnail_cancel_cb(media_info_h media, void *user_data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       char *media_id = NULL;
-       media_info_h dst = NULL;
-
-       g_cnt++;
-
-       if (media == NULL) {
-               content_debug("NO Item");
-               return true;
-       }
-
-       ret = media_info_get_media_id(media, &media_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_id failed: %d", ret);
-       else
-               content_debug("media_id : [%s]", media_id);
-
-       ret = media_info_clone(&dst, media);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_clone failed: %d", ret);
-
-       ret = media_info_cancel_thumbnail(dst);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_cancel_thumbnail failed: %d", ret);
-
-       ret = media_info_destroy(dst);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_destroy failed: %d", ret);
-
-       if (g_cnt == g_media_cnt)
-               g_main_loop_quit(g_loop);
-
-       /* fix prevent: Resource leak */
-       SAFE_FREE(media_id);
-
-       return true;
-}
-
-gboolean create_thumbnail_start(gpointer data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       ret = media_info_foreach_media_from_db(g_filter, thumbnail_create_cb, NULL);
-
-       if (ret == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("media_info_foreach_media_from_db is success");
-       else
-               content_error("media_info_foreach_media_from_db is failed");
-
-       return false;
-}
-
-gboolean cancel_thumbnail_start(gpointer data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       ret = media_info_foreach_media_from_db(g_filter, thumbnail_cancel_cb, NULL);
-
-       if (ret == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("media_info_foreach_media_from_db is success");
-       else
-               content_error("media_info_foreach_media_from_db is failed");
-
-       return false;
-}
-
-int test_create_thumbnail(int cancel)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       GSource *source = NULL;
-       GMainContext *context = NULL;
-
-       test_filter_create();
-
-       ret = media_info_get_media_count_from_db(g_filter, &g_media_cnt);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_count_from_db failed: %d", ret);
-       else
-               content_debug("media_count : [%d]", g_media_cnt);
-
-       g_loop = g_main_loop_new(NULL, FALSE);
-       context = g_main_loop_get_context(g_loop);
-       source = g_idle_source_new();
-       g_source_set_callback(source, create_thumbnail_start, NULL, NULL);
-       g_source_attach(source, context);
-
-       /* Logic to cancel */
-       if (cancel) {
-               GSource *cancel_src = NULL;
-               cancel_src = g_idle_source_new();
-               g_source_set_callback(cancel_src, cancel_thumbnail_start, NULL, NULL);
-               g_source_attach(cancel_src, context);
-       }
-
-       g_main_loop_run(g_loop);
-       g_main_loop_unref(g_loop);
-
-       test_filter_destroy();
-
-       return ret;
-}
-
-bool face_cb(media_face_h face, void *user_data)
-{
-       get_face_meta(face);
-
-       return false;
-}
-
-void face_detection_complete_cb(media_content_error_e error, int count, void *user_data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       g_cnt++;
-
-       content_debug("=================[%d][%d]", g_media_cnt, g_cnt);
-       content_debug("error_code [%d]", error);
-       content_debug("face_count [%d]", count);
-       if (count == 0) {
-               content_debug("No faces are detected!");
-       } else if (user_data != NULL) {
-               media_info_h media = (media_info_h)user_data;
-               char *media_id = NULL;
-               ret = media_info_get_media_id(media, &media_id);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_get_media_id failed: %d", ret);
-               if (media_id != NULL) {
-                       ret = media_info_foreach_face_from_db(media_id, NULL, face_cb, NULL);
-                       SAFE_FREE(media_id);
-                       if (ret != MEDIA_CONTENT_ERROR_NONE)
-                               content_error("media_info_foreach_face_from_db failed: %d", ret);
-               }
-               ret = media_info_destroy(media);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_destroy failed: %d", ret);
-       }
-
-       if (g_cnt == g_media_cnt)
-               g_main_loop_quit(g_loop);
-
-       return;
-}
-
-bool start_face_detection_cb(media_info_h media, void *user_data)
+int test_create_thumbnail(const char *path)
 {
-       char *media_id = NULL;
-       media_info_h dst = NULL;
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_h media;
+       char *thumb_path = NULL;
 
-       if (media == NULL) {
-               content_debug("NO Item");
-               return true;
-       }
-
-       ret = media_info_get_media_id(media, &media_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_id failed: %d", ret);
-       else
-               content_debug("media_id : [%s]", media_id);
-
-       ret = media_info_clone(&dst, media);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_clone failed: %d", ret);
-
-       GList **list = (GList**)user_data;
-       *list = g_list_append(*list, dst);
-
-       /* fix prevent: Resource leak */
-       SAFE_FREE(media_id);
-
-       return true;
-}
-
-bool cancel_face_detection_cb(media_info_h media, void *user_data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       char *media_id = NULL;
-       media_info_h dst = NULL;
-
-       g_cnt++;
-
-       if (media == NULL) {
-               content_debug("NO Item");
-               return true;
-       }
-
-       ret = media_info_get_media_id(media, &media_id);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_id failed: %d", ret);
-       else
-               content_debug("media_id : [%s]", media_id);
-
-       ret = media_info_clone(&dst, media);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_clone failed: %d", ret);
-
-       ret = media_info_cancel_face_detection(dst);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_cancel_face_detection failed: %d", ret);
-
-       ret = media_info_destroy(dst);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_destroy failed: %d", ret);
-
-       if (g_cnt == g_media_cnt)
-               g_main_loop_quit(g_loop);
-
-       /* fix prevent: Resource leak */
-       SAFE_FREE(media_id);
-
-       return true;
-}
-
-gboolean face_detection_start(gpointer data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       GList *all_item_list = NULL;
-       int idx = 0;
-
-       ret = media_info_foreach_media_from_db(g_filter, start_face_detection_cb, &all_item_list);
-
-       if (ret == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("media_info_foreach_media_from_db is success");
-       else
-               content_error("media_info_foreach_media_from_db is failed");
-
-       for (idx = 0; idx < g_list_length(all_item_list); idx++) {
-               media_info_h media_handle = NULL;
-
-               media_handle = (media_info_h)g_list_nth_data(all_item_list, idx);
-
-               ret = media_info_start_face_detection(media_handle, face_detection_complete_cb, NULL);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_start_face_detection failed: %d", ret);
+       ret = media_info_insert_to_db(path, &media);
+       content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_insert_to_db failed [%d]", ret);
 
+       ret = media_info_generate_thumbnail(media);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               content_error("media_info_generate_thumbnail failed [%d]", ret);
+               goto FINALIZE;
        }
 
-       return false;
-}
-
-gboolean face_detection_cancel(gpointer data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       ret = media_info_foreach_media_from_db(g_filter, cancel_face_detection_cb, NULL);
-
-       if (ret == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("media_info_foreach_media_from_db is success");
-       else
-               content_error("media_info_foreach_media_from_db is failed");
-
-       return false;
-}
-
-int test_start_face_detection(int cancel)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       GSource *source = NULL;
-       GMainContext *context = NULL;
-
-       test_filter_create();
-
-       ret = media_info_get_media_count_from_db(g_filter, &g_media_cnt);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_count_from_db failed: %d", ret);
-       else
-               content_debug("media_count : [%d]", g_media_cnt);
-
-       if (g_media_cnt == 0)
-               goto END;
-
-       g_loop = g_main_loop_new(NULL, FALSE);
-       context = g_main_loop_get_context(g_loop);
-       source = g_idle_source_new();
-       g_source_set_callback(source, face_detection_start, NULL, NULL);
-       g_source_attach(source, context);
-
-       /* Logic to cancel */
-       if (cancel) {
-               GSource *cancel_src = NULL;
-               cancel_src = g_idle_source_new();
-               g_source_set_callback(cancel_src, face_detection_cancel, NULL, NULL);
-               g_source_attach(cancel_src, context);
+       ret = media_info_get_thumbnail_path(media, &thumb_path);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               content_error("media_info_get_thumbnail_path failed [%d]", ret);
+               goto FINALIZE;
        }
 
-       g_main_loop_run(g_loop);
-       g_main_loop_unref(g_loop);
-
-END:
-       test_filter_destroy();
+       content_debug("Thumbnail Path [%s]", thumb_path);
+       if (thumb_path)
+               free(thumb_path);
 
+FINALIZE:
+       media_info_destroy(media);
        return ret;
 }
 
@@ -2313,45 +1437,6 @@ int test_disconnect_database(void)
        return ret;
 }
 
-int test_request_update_db(void)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_info_h media = NULL;
-       bool favorite = FALSE;
-
-       ret = media_info_get_media_from_db("71b19196-5b38-4ab1-ab34-bfe05c369614", &media);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_from_db failed: %d", ret);
-
-       ret = media_info_set_favorite(media, TRUE);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_set_favorite failed: %d", ret);
-
-       ret = media_info_update_to_db(media);
-       if (ret == MEDIA_CONTENT_ERROR_NONE)
-               content_debug("media_info_update_to_db is success");
-       else
-               content_error("media_info_update_to_db is failed");
-
-       if (media != NULL)
-               media_info_destroy(media);
-
-       /*get the updated value*/
-       ret = media_info_get_media_from_db("71b19196-5b38-4ab1-ab34-bfe05c369614", &media);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_media_from_db failed: %d", ret);
-
-       ret = media_info_get_favorite(media, &favorite);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_info_get_favorite failed: %d", ret);
-       else
-               content_debug("favorite [%d]", favorite);
-
-       ret = media_info_destroy(media);
-
-       return ret;
-}
-
 static int g_total_photo_size = 0;
 static int g_total_video_size = 0;
 static int g_total_mp3_size = 0;
@@ -2412,7 +1497,7 @@ int DFT_test(void)
 /*Internal Memory*/
        content_debug("[Internal Memory]\n");
        /*1. Photo ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND MEDIA_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "MEDIA_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Photo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2423,7 +1508,7 @@ int DFT_test(void)
        content_debug("Photo size = [%d]\n", g_total_photo_size);
 
        /*2. Video ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND MEDIA_TYPE=1", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "MEDIA_TYPE=1", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Video Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2434,7 +1519,7 @@ int DFT_test(void)
        content_debug("Video size = [%d]\n", g_total_video_size);
 
        /*3. MP3 ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND MEDIA_TYPE=3 AND MEDIA_MIME_TYPE=\"audio/mpeg\"", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "MEDIA_TYPE=3 AND MEDIA_MIME_TYPE=\"audio/mpeg\"", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get MP3 Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2445,7 +1530,7 @@ int DFT_test(void)
        content_debug("MP3 size = [%d]\n", g_total_mp3_size);
 
        /*4. Voice Memo ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND (MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\")", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "(MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\")", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Voice Memo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2463,7 +1548,7 @@ int DFT_test(void)
 /*External Memory*/
        content_debug("\n[External Memory]\n");
        /*1. Photo ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND MEDIA_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "MEDIA_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Photo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2474,7 +1559,7 @@ int DFT_test(void)
        content_debug("Photo size = [%d]\n", g_total_photo_size);
 
        /*2. Video ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND MEDIA_TYPE=1", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "MEDIA_TYPE=1", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Video Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2485,7 +1570,7 @@ int DFT_test(void)
        content_debug("Video size = [%d]\n", g_total_video_size);
 
        /*3. MP3 ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND MEDIA_TYPE=3 AND MEDIA_MIME_TYPE=\"audio/mpeg\"", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "MEDIA_TYPE=3 AND MEDIA_MIME_TYPE=\"audio/mpeg\"", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get MP3 Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2496,7 +1581,7 @@ int DFT_test(void)
        content_debug("MP3 size = [%d]\n", g_total_mp3_size);
 
        /*4. Voice Memo ============================================================*/
-       ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND (MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\")", MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, "(MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\")", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Voice Memo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
@@ -2713,14 +1798,6 @@ gboolean _send_noti_operations(gpointer data)
 
        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) {
-               content_error("media_info_update_to_db failed : %d\n", ret);
-               media_info_destroy(media_item);
-               return ret;
-       }
-
        media_info_destroy(media_item);
 
        return FALSE;
@@ -2746,154 +1823,6 @@ int test_noti()
 
        return ret;
 }
-
-bool media_face_test_cb(media_face_h face, void *user_data)
-{
-       get_face_meta(face);
-
-       if (user_data != NULL) {
-               media_face_h new_face = NULL;
-               media_face_clone(&new_face, face);
-
-               GList **list = (GList**)user_data;
-               *list = g_list_append(*list, new_face);
-       }
-
-       return true;
-}
-
-int test_face(void)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       filter_h filter = NULL;
-       GList *all_item_list = NULL;
-       int i = 0;
-
-       ret = media_filter_create(&filter);
-       content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "fail media_filter_create");
-
-       ret = media_filter_set_condition(filter, "MEDIA_TYPE = 0", MEDIA_CONTENT_COLLATE_DEFAULT);
-       if (ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_filter_destroy(filter);
-               content_error("Fail to set condition");
-               return ret;
-       }
-
-       ret = media_info_foreach_media_from_db(filter, gallery_media_item_cb, &all_item_list);
-       if (ret != MEDIA_CONTENT_ERROR_NONE) {
-               content_error("media_info_foreach_media_from_db failed: %d", ret);
-               media_filter_destroy(filter);
-               return ret;
-       }
-
-       for (i = 0; i < g_list_length(all_item_list); i++) {
-               media_info_h media_handle = NULL;
-               char *media_id = NULL;
-               int face_count = 0;
-
-               media_handle = (media_info_h)g_list_nth_data(all_item_list, i);
-
-               ret = media_info_get_media_id(media_handle, &media_id);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_get_media_id failed: %d", ret);
-
-               ret = media_info_get_face_count_from_db(media_id, filter, &face_count);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_get_face_count_from_db failed: %d", ret);
-
-               content_error("media_id [%s] face_count [%d]", media_id, face_count);
-
-               ret = media_info_foreach_face_from_db(media_id, filter, media_face_test_cb, NULL);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_info_foreach_face_from_db failed: %d", ret);
-
-               media_info_destroy(media_handle);
-       }
-
-       media_filter_destroy(filter);
-
-       return ret;
-}
-
-int test_face_add_del(void)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       char *media_id = "ecca7366-e085-41d8-a12b-cbdfc2b9c5fc";
-
-       /* Insert Test */
-       media_face_h face = NULL;
-
-       char *face_tag = "test_face_tag";
-
-       ret = media_face_create(media_id, &face);
-       content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "fail media_face_create");
-
-       ret = media_face_set_face_rect(face, 10, 12, 50, 100);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_face_set_face_rect failed: %d", ret);
-
-       ret = media_face_set_orientation(face, 5);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_face_set_orientation failed: %d", ret);
-
-       ret = media_face_set_tag(face, face_tag);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_face_set_tag failed: %d", ret);
-
-       ret = media_face_insert_to_db(face);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_face_insert_to_db failed: %d", ret);
-
-       ret = media_face_destroy(face);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               content_error("media_face_destroy failed: %d", ret);
-
-       /* Update Test */
-       GList *all_item_list = NULL;
-       filter_h filter = NULL;
-       ret = media_filter_create(&filter);
-       content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "fail media_filter_create");
-
-       ret = media_filter_set_condition(filter, "MEDIA_FACE_TAG IS NOT NULL", MEDIA_CONTENT_COLLATE_DEFAULT);
-       if (ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_filter_destroy(filter);
-               content_error("Fail to set condition");
-               return ret;
-       }
-
-       ret = media_info_foreach_face_from_db(media_id, filter, media_face_test_cb, &all_item_list);
-
-       if (g_list_length(all_item_list) > 0) {
-               media_face_h face_handle = NULL;
-               face_handle = (media_face_h)g_list_nth_data(all_item_list, 0);
-
-               ret = media_face_set_face_rect(face_handle, 20, 22, 70, 70);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_face_set_face_rect failed: %d", ret);
-               ret = media_face_set_orientation(face_handle, 3);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_face_set_orientation failed: %d", ret);
-               ret = media_face_set_tag(face_handle, NULL);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_face_set_tag failed: %d", ret);
-               ret = media_face_update_to_db(face_handle);
-               if (ret != MEDIA_CONTENT_ERROR_NONE)
-                       content_error("media_face_update_to_db failed: %d", ret);
-
-               media_face_destroy(face_handle);
-       }
-
-       media_filter_destroy(filter);
-
-       /* Delete Test */
-       char *face_id = "5e58a3a8-f0b2-4c29-b799-b49a70dc2313";
-
-       /* Delete Test*/
-       ret = media_face_delete_from_db(face_id);
-
-       return ret;
-}
-
 #ifdef _USE_TVPD_MODE
 filter_h g_tv_filter = NULL;
 
@@ -3240,10 +2169,6 @@ int main(int argc, char *argv[])
                        return ret;
        }
 
-       ret = test_start_face_detection(FALSE);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return ret;
-
        ret = test_move();
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
@@ -3268,10 +2193,6 @@ int main(int argc, char *argv[])
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
 
-       ret = test_tag_operation();
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return ret;
-
        ret = test_bookmark_operation();
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
@@ -3296,17 +2217,11 @@ int main(int argc, char *argv[])
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
 
-       ret = test_create_thumbnail(TRUE);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return ret;
-
-       ret = test_extrace_face(TRUE);
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return ret;
-
-       ret = test_request_update_db();
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return ret;
+       if (argc == 2) {
+               ret = test_create_thumbnail(argv[1]);
+               if (ret != MEDIA_CONTENT_ERROR_NONE)
+                       return ret;
+       }
 
        ret = DFT_test();
        if (ret != MEDIA_CONTENT_ERROR_NONE)
@@ -3328,14 +2243,6 @@ int main(int argc, char *argv[])
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                return MEDIA_CONTENT_ERROR_NONE;
 
-       ret = test_face();
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return MEDIA_CONTENT_ERROR_NONE;
-
-       ret = test_face_add_del();
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return MEDIA_CONTENT_ERROR_NONE;
-
        ret = test_playlist_operation_v2();
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                return MEDIA_CONTENT_ERROR_NONE;
@@ -3343,10 +2250,6 @@ int main(int argc, char *argv[])
        ret = test_bookmark_operation_v2();
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                return MEDIA_CONTENT_ERROR_NONE;
-
-       ret = test_tag_operation_v2();
-       if (ret != MEDIA_CONTENT_ERROR_NONE)
-               return MEDIA_CONTENT_ERROR_NONE;
 #endif
 
        ret = test_disconnect_database();