Fix static analysis issues 38/276938/2
authorChanggyu Choi <changyu.choi@samsung.com>
Tue, 28 Jun 2022 05:08:50 +0000 (14:08 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Tue, 28 Jun 2022 05:20:38 +0000 (14:20 +0900)
Changes:
 - Add to check return of app_control_create()

Change-Id: Ie1e19a0e9578a57f96edba1f20aff9f2ef7babde
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
test/unit_tests/base/test_component_based_application_base.cc
test/unit_tests/efl_base/test_component_based_app.cc

index 3e1c643e8dc50d8131f6825007927e4627e2da5d..9b1acc3623ecc066abf69dbd701e233bc91388ee 100644 (file)
@@ -134,7 +134,8 @@ ACTION_P2(SendAction, mock, id) {
   auto* com = dynamic_cast<Component*>(cxt.get());
   ASSERT_NE(com, nullptr);
   app_control_h ctrl;
-  app_control_create(&ctrl);
+  int ret = app_control_create(&ctrl);
+  ASSERT_EQ(ret, APP_CONTROL_ERROR_NONE);
   tizen_base::Bundle b;
   com->OnAction("test_action", AppControl(ctrl));
 }
@@ -510,7 +511,10 @@ TEST_F(ComponentBasedAppBaseTest, component_send_launch_request_sync) {
             bool restarted, void* user_data) {
           app_control_h reply = nullptr;
           app_control_h ctrl;
-          app_control_create(&ctrl);
+          int ret = app_control_create(&ctrl);
+          if (ret != APP_CONTROL_ERROR_NONE)
+            return;
+
           app_control_set_app_id(ctrl, "tizen.test.org");
           launch_ret = component_send_launch_request_sync(context, ctrl,
               &reply, &result);
@@ -561,7 +565,10 @@ TEST_F(ComponentBasedAppBaseTest, component_send_launch_request_sync2) {
             bool restarted, void* user_data) {
           app_control_h reply = nullptr;
           app_control_h ctrl;
-          app_control_create(&ctrl);
+          int ret = app_control_create(&ctrl);
+          if (ret != APP_CONTROL_ERROR_NONE)
+            return;
+
           app_control_set_app_id(ctrl, "tizen.test.org");
           launch_ret = component_send_launch_request_sync(context, ctrl,
               &reply, &result);
@@ -618,7 +625,10 @@ TEST_F(ComponentBasedAppBaseTest, component_send_launch_request_async) {
       .WillOnce(Invoke([&](component_h context, app_control_h app_control,
             bool restarted, void* user_data) {
           app_control_h ctrl;
-          app_control_create(&ctrl);
+          int ret = app_control_create(&ctrl);
+          if (ret != APP_CONTROL_ERROR_NONE)
+            return;
+
           app_control_set_app_id(ctrl, "tizen.test.org");
           launch_ret = component_send_launch_request_async(context, ctrl,
               result_cb, reply_cb, nullptr);
index af0ae1f0c37906bda68de52362b38221d8d5cf6a..e4ee6ab1141ce148d26c5f8d1dfdfb86733654dd 100644 (file)
@@ -148,7 +148,9 @@ ACTION_P2(SendEvents, mock, id) {
   auto* com = dynamic_cast<Component*>(cxt.get());
   ASSERT_NE(com, nullptr);
   app_control_h ctrl;
-  app_control_create(&ctrl);
+  int ret = app_control_create(&ctrl);
+  ASSERT_EQ(ret, APP_CONTROL_ERROR_NONE);
+
   com->OnAction("test_action", AppControl(ctrl));
   com->OnDeviceOrientationChanged(
       DeviceOrientation::Orientation::Orientation_90);