Fix notify event sequence 59/241159/2
authorhyunho <hhstark.kang@samsung.com>
Tue, 18 Aug 2020 07:30:46 +0000 (16:30 +0900)
committerhyunho <hhstark.kang@samsung.com>
Tue, 18 Aug 2020 08:10:32 +0000 (17:10 +0900)
widget created event should be notified after widget instance
is added to the AMD

Change-Id: I0b6469c2bc396fedbbdf378c68dca561a16a66f5
Signed-off-by: hyunho <hhstark.kang@samsung.com>
src/base/widget_base.c
test/unit_tests/test_widget_app.cc

index 17edb5d..16928b9 100644 (file)
@@ -1392,13 +1392,12 @@ static void __multiwindow_instance_create(
                __instance_drop(instance_h);
        } else {
                LOGD("%s is created", id);
+               aul_widget_instance_add(class_id, id);
                ret = __send_update_status(class_id, id,
                        WIDGET_INSTANCE_EVENT_CREATE, 0, NULL);
                if (ret < 0)
                        LOGE("Fail to send create status (%d) ", ret);
 
-               aul_widget_instance_add(class_id, id);
-
                ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period,
                                &size);
                if (ret == BUNDLE_ERROR_NONE && *period > 0) {
index f6c73f5..e6a2264 100644 (file)
@@ -295,6 +295,11 @@ void __app_event_cb(app_event_info_h event_info, void *user_data) {
 
 TEST_F(WidgetAppTest, widget_app_add_event_handler) {
   app_event_handler_h handle;
+  EXPECT_CALL(GetMock<SystemInfoMock>(),
+      system_info_get_platform_bool(_, _)).
+          WillOnce(DoAll(
+                  SetArgPointee<1>(true),
+                  Return(0)));
   int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY,
       __app_event_cb, nullptr);
   EXPECT_EQ(WIDGET_ERROR_NONE, ret);
@@ -302,6 +307,11 @@ TEST_F(WidgetAppTest, widget_app_add_event_handler) {
 
 TEST_F(WidgetAppTest, widget_app_remove_event_handler) {
   app_event_handler_h handle;
+  EXPECT_CALL(GetMock<SystemInfoMock>(),
+      system_info_get_platform_bool(_, _)).
+          WillRepeatedly(DoAll(
+                  SetArgPointee<1>(true),
+                  Return(0)));
   int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY,
       __app_event_cb, nullptr);
   ret = widget_app_remove_event_handler(handle);