From: Changgyu Choi Date: Tue, 28 Jun 2022 05:08:50 +0000 (+0900) Subject: Fix static analysis issues X-Git-Tag: submit/tizen/20220628.063238~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5e7b81b37b8f4006f13edee8a6d17ba89142bc9;p=platform%2Fcore%2Fappfw%2Fcomponent-based-application.git Fix static analysis issues Changes: - Add to check return of app_control_create() Change-Id: Ie1e19a0e9578a57f96edba1f20aff9f2ef7babde Signed-off-by: Changgyu Choi --- diff --git a/test/unit_tests/base/test_component_based_application_base.cc b/test/unit_tests/base/test_component_based_application_base.cc index 3e1c643..9b1acc3 100644 --- a/test/unit_tests/base/test_component_based_application_base.cc +++ b/test/unit_tests/base/test_component_based_application_base.cc @@ -134,7 +134,8 @@ ACTION_P2(SendAction, mock, id) { auto* com = dynamic_cast(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); diff --git a/test/unit_tests/efl_base/test_component_based_app.cc b/test/unit_tests/efl_base/test_component_based_app.cc index af0ae1f..e4ee6ab 100644 --- a/test/unit_tests/efl_base/test_component_based_app.cc +++ b/test/unit_tests/efl_base/test_component_based_app.cc @@ -148,7 +148,9 @@ ACTION_P2(SendEvents, mock, id) { auto* com = dynamic_cast(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);