[UTC][notification][Non-ACR][Clean up posted notification]
authorseungha.son <seungha.son@samsung.com>
Fri, 3 Jun 2016 02:40:47 +0000 (11:40 +0900)
committerseungha.son <seungha.son@samsung.com>
Fri, 3 Jun 2016 02:56:09 +0000 (11:56 +0900)
Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: I6408a4767c45f324779dd775e7c49272e5dd1ea5

src/utc/notification/utc-notification.c

index 872b7d2..5e766a1 100755 (executable)
@@ -59,11 +59,9 @@ static void _deferred_job_cb(void *data)
 void utc_notification_startup(void)
 {
        notification_h notification = NULL;
-       bundle *b = NULL;
 
        /* NOTIFICATION_TYPE_NOTI */
        notification = notification_create(NOTIFICATION_TYPE_NOTI);
-       b = bundle_create();
        notification_set_time(notification, TEST_TIME);
        notification_set_image(notification, NOTIFICATION_IMAGE_TYPE_ICON, TEST_IMAGE);
        notification_set_tag(notification, TEST_TAG_FOR_NOTI);
@@ -83,7 +81,6 @@ void utc_notification_startup(void)
 
        /* NOTIFICATION_TYPE_ONGOING */
        notification = notification_create(NOTIFICATION_TYPE_ONGOING);
-       b = bundle_create();
        notification_set_time(notification, TEST_TIME);
        notification_set_image(notification, NOTIFICATION_IMAGE_TYPE_ICON, TEST_IMAGE);
        notification_set_tag(notification, TEST_TAG_FOR_ONGOING);
@@ -110,6 +107,11 @@ void utc_notification_startup(void)
  */
 void utc_notification_cleanup(void)
 {
+       notification_h notification = NULL;
+       notification = notification_load_by_tag(TEST_TAG_FOR_NOTI);
+
+       notification_delete(notification);
+       notification_free(notification);
 }
 
 /**
@@ -142,7 +144,6 @@ int utc_notification_create_2_n(void)
 
        assert(!notification);
 
-       notification_free(notification);
        return 0;
 }
 
@@ -624,6 +625,7 @@ int utc_notification_get_image_1_p(void)
 
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
        assert_eq(strcmp(image, TEST_IMAGE), 0);
+       image = NULL;
 
        notification_free(notification);
 
@@ -1729,6 +1731,7 @@ int utc_notification_get_text_1_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1754,6 +1757,7 @@ int utc_notification_get_text_2_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1779,6 +1783,7 @@ int utc_notification_get_text_3_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1805,6 +1810,7 @@ int utc_notification_get_text_4_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1830,6 +1836,7 @@ int utc_notification_get_text_5_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1855,6 +1862,7 @@ int utc_notification_get_text_6_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_INFO_2, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1880,6 +1888,7 @@ int utc_notification_get_text_7_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_INFO_SUB_2, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1905,6 +1914,7 @@ int utc_notification_get_text_8_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_INFO_3, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1930,6 +1940,7 @@ int utc_notification_get_text_9_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_INFO_SUB_3, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1955,6 +1966,7 @@ int utc_notification_get_text_10_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_GROUP_TITLE, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -1980,6 +1992,7 @@ int utc_notification_get_text_11_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_GROUP_CONTENT, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -2005,6 +2018,7 @@ int utc_notification_get_text_12_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_GROUP_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -2030,6 +2044,7 @@ int utc_notification_get_text_13_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_BUTTON_1, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -2055,6 +2070,7 @@ int utc_notification_get_text_14_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_BUTTON_2, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -2080,6 +2096,7 @@ int utc_notification_get_text_15_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_BUTTON_3, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -2105,6 +2122,7 @@ int utc_notification_get_text_16_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_BUTTON_4, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -2130,6 +2148,7 @@ int utc_notification_get_text_17_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_BUTTON_5, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -2155,6 +2174,7 @@ int utc_notification_get_text_18_p(void)
        ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_BUTTON_6, &value);
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -3152,6 +3172,7 @@ int utc_notification_get_sound_1_p(void)
 
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -3179,6 +3200,7 @@ int utc_notification_get_sound_2_p(void)
        assert_eq(type, NOTIFICATION_SOUND_TYPE_USER_DATA);
        assert_eq(strcmp(value, TEST_PATH), 0);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -3261,6 +3283,7 @@ int utc_notification_get_vibration_1_p(void)
 
        assert_neq(value, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -3288,6 +3311,7 @@ int utc_notification_get_vibration_2_p(void)
        assert_eq(type, NOTIFICATION_VIBRATION_TYPE_USER_DATA);
        assert_eq(strcmp(value, TEST_PATH), 0);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       value = NULL;
 
        notification_free(notification);
 
@@ -4429,7 +4453,7 @@ int utc_notification_clone_p(void)
        assert(notification_cloned);
 
        notification_free(notification_cloned);
-
+       notification_free(notification);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
 
        return 0;
@@ -4598,6 +4622,7 @@ int utc_notification_get_tag_1_p(void)
 
        assert_neq(tag, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       tag = NULL;
 
        notification_free(notification);
 
@@ -4623,6 +4648,7 @@ int utc_notification_get_tag_2_p(void)
 
        assert_eq(strcmp(tag, TEST_TAG_FOR_NOTI), 0);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       tag = NULL;
 
        notification_free(notification);
 
@@ -4754,6 +4780,7 @@ int utc_notification_post_p(void)
 
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
 
+       notification_delete(notification);
        notification_free(notification);
 
        return 0;
@@ -4888,6 +4915,7 @@ int utc_notification_get_pkgname_p(void)
 
        assert_neq(tag, NULL);
        assert_eq(ret, NOTIFICATION_ERROR_NONE);
+       tag = NULL;
 
        notification_free(notification);
 
@@ -5011,8 +5039,6 @@ int utc_notification_add_button_p(void)
 {
        int ret = 0;
        notification_h notification = NULL;
-       app_control_h app_control = NULL;
-       char *pkgname = NULL;
 
        notification = notification_create(NOTIFICATION_TYPE_NOTI);
 
@@ -5052,8 +5078,6 @@ int utc_notification_remove_button_p(void)
 {
        int ret = 0;
        notification_h notification = NULL;
-       app_control_h app_control = NULL;
-       char *pkgname = NULL;
 
        notification = notification_create(NOTIFICATION_TYPE_NOTI);
 
@@ -5095,8 +5119,6 @@ int utc_notification_set_auto_remove_p(void)
 {
        int ret = 0;
        notification_h notification = NULL;
-       app_control_h app_control = NULL;
-       char *pkgname = NULL;
 
        notification = notification_create(NOTIFICATION_TYPE_NOTI);
 
@@ -5138,8 +5160,6 @@ int utc_notification_get_auto_remove_p(void)
        int ret = 0;
        notification_h notification = NULL;
        bool auto_remove = true;
-       app_control_h app_control = NULL;
-       char *pkgname = NULL;
 
        notification = notification_create(NOTIFICATION_TYPE_NOTI);