Fix a bug of refactoring complication 87/279987/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 22 Aug 2022 05:11:25 +0000 (05:11 +0000)
committerHwanKyu Jhun <h.jhun@samsung.com>
Mon, 22 Aug 2022 05:12:32 +0000 (05:12 +0000)
The function returns AUL_R_OK when the function call is successful.
The daemon sends the process ID if the request is successful.

Change-Id: If3f167bb9150e03af6fe7c967988e8a6c3b6f561
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul_complication.cc
test/unit_tests/test_complication.cc

index cfbd26a..1129a1d 100644 (file)
@@ -47,10 +47,14 @@ extern "C" API int aul_complication_update_request(const char* appid,
     { AUL_K_COMPLICATION_MODE, kUpdateRequest}
   };
 
-  return AppRequest(COMPLICATION_UPDATE_REQUEST, uid)
+  int ret = AppRequest(COMPLICATION_UPDATE_REQUEST, uid)
       .With(std::move(b))
       .SetAppId(provider_appid)
       .Send();
+  if (ret < 0)
+    return ret;
+
+  return AUL_R_OK;
 }
 
 extern "C" API int aul_complication_launch_with_extra_data(const char* appid,
@@ -69,8 +73,12 @@ extern "C" API int aul_complication_launch_with_extra_data(const char* appid,
     { key, value }
   };
 
-  return AppRequest(COMPLICATION_UPDATE_REQUEST, uid)
+  int ret = AppRequest(COMPLICATION_UPDATE_REQUEST, uid)
       .With(std::move(b))
       .SetAppId(provider_appid)
       .Send();
+  if (ret < 0)
+    return ret;
+
+  return AUL_R_OK;
 }
index 43491c9..648dcc6 100644 (file)
@@ -80,7 +80,7 @@ TEST_F(ComplicationTest, aul_complication_update_request_P) {
   EXPECT_CALL(GetMock<SocketMock>(), recv(_, _, _, _))
       .Times(1)
       .WillOnce(Invoke([](int fd, void* buf, size_t n, int flags) -> ssize_t {
-        int ret = AUL_R_OK;
+        int ret = getpid();
         memcpy(buf, &ret, sizeof(int));
         return sizeof(int);
       }));
@@ -123,7 +123,7 @@ TEST_F(ComplicationTest, aul_complication_launch_with_extra_data_P) {
   EXPECT_CALL(GetMock<SocketMock>(), recv(_, _, _, _))
       .Times(1)
       .WillOnce(Invoke([](int fd, void* buf, size_t n, int flags) -> ssize_t {
-        int ret = AUL_R_OK;
+        int ret = getpid();
         memcpy(buf, &ret, sizeof(int));
         return sizeof(int);
       }));