From: saerome.kim Date: Mon, 20 Aug 2018 07:07:37 +0000 (+0900) Subject: Check the feature in order to execute HAL accordance with the feature. X-Git-Tag: accepted/tizen/unified/20180821.091013^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fzigbee-manager.git;a=commitdiff_plain;h=36a8adbcfc117933995e59b8c82c73fd11dc3e14 Check the feature in order to execute HAL accordance with the feature. Change-Id: Ic4cbc0c66a8c70c2dd02a7a9b7811a0984f2f22b Signed-off-by: saerome.kim --- diff --git a/haltest/zigbee-manager-haltests.cpp b/haltest/zigbee-manager-haltests.cpp index 52de0dd..810047d 100644 --- a/haltest/zigbee-manager-haltests.cpp +++ b/haltest/zigbee-manager-haltests.cpp @@ -24,22 +24,26 @@ #include "zbl.h" -#define FEATURE_ZIGBEE "http://tizen.org/feature/network.zigbee" -static bool g_bFeatureZb = false; - using ::testing::InitGoogleTest; using ::testing::Test; using ::testing::TestCase; -static bool __check_feature_supported(char *key) -{ - bool value = false; - int ret = system_info_get_platform_bool(key, &value); +const char *feature_name = (char *)"http://tizen.org/feature/network.zigbee"; - EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed"; - EXPECT_EQ(true, value) << key << " feature is not supported"; +static bool __check_feature_supported() +{ + bool zigbee_supported = FALSE; + if (!system_info_get_platform_bool(feature_name, &zigbee_supported)) { + if (FALSE == zigbee_supported) { + GLOGD("zigbee feature is disabled"); + return ZIGBEE_ERROR_NOT_SUPPORTED; + } + return ZIGBEE_ERROR_NONE; + } else { + GLOGD("Error - Feature getting from System Info"); + return ZIGBEE_ERROR_INVALID_PARAMETER; + } - return value; } /* @@ -57,13 +61,12 @@ static bool __check_feature_supported(char *key) */ TEST(ZigbeeManager, Enable_p) { - g_bFeatureZb = __check_feature_supported((char*)FEATURE_ZIGBEE); - ASSERT_EQ(true, g_bFeatureZb) << FEATURE_ZIGBEE << " feature is not supported"; - int ret = ZIGBEE_ERROR_NONE; Zigbee zb_mgr; - ret = zb_mgr.zbl_enable(); + if (ZIGBEE_ERROR_NONE == __check_feature_supported()) { + ret = zb_mgr.zbl_enable(); + } EXPECT_EQ(ZIGBEE_ERROR_NONE, ret); } @@ -82,13 +85,12 @@ TEST(ZigbeeManager, Enable_p) */ TEST(ZigbeeManager, Disable_p) { - g_bFeatureZb = __check_feature_supported((char*)FEATURE_ZIGBEE); - ASSERT_EQ(true, g_bFeatureZb) << FEATURE_ZIGBEE << " feature is not supported"; - int ret = ZIGBEE_ERROR_NONE; Zigbee zb_mgr; - ret = zb_mgr.zbl_disable(); + if (ZIGBEE_ERROR_NONE == __check_feature_supported()) { + ret = zb_mgr.zbl_disable(); + } EXPECT_EQ(ZIGBEE_ERROR_NONE, ret); }