2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <gmock/gmock.h>
21 #include <gtest/gtest.h>
23 #include <system_info.h>
27 #define FEATURE_ZIGBEE "http://tizen.org/feature/network.zigbee"
28 static bool g_bFeatureZb = false;
30 using ::testing::InitGoogleTest;
31 using ::testing::Test;
32 using ::testing::TestCase;
34 static bool __check_feature_supported(char *key)
37 int ret = system_info_get_platform_bool(key, &value);
39 EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
40 EXPECT_EQ(true, value) << key << " feature is not supported";
48 @author SRID(abhishek.s94)
49 @reviewer HQ(saerome.kim)
51 @description Positive, Enable zigbee manager
52 @apicovered "enable" method on "org.tizen.zigbee.manager" interface
53 @passcase when zbl_enable returns ZIGBEE_ERROR_NONE
54 @failcase when zbl_enable does not return ZIGBEE_ERROR_NONE
55 @precondition __check_feature_supported must return true for zigbee feature
58 TEST(ZigbeeManager, Enable_p)
60 g_bFeatureZb = __check_feature_supported((char*)FEATURE_ZIGBEE);
61 ASSERT_EQ(true, g_bFeatureZb) << FEATURE_ZIGBEE << " feature is not supported";
63 int ret = ZIGBEE_ERROR_NONE;
66 ret = zb_mgr.zbl_enable();
67 EXPECT_EQ(ZIGBEE_ERROR_NONE, ret);
73 @author SRID(abhishek.s94)
74 @reviewer HQ(saerome.kim)
76 @description Positive, Disable zigbee manager
77 @apicovered "disable" method on "org.tizen.zigbee.manager" interface
78 @passcase when zbl_disable returns ZIGBEE_ERROR_NONE
79 @failcase when zbl_disable does not return ZIGBEE_ERROR_NONE
80 @precondition __check_feature_supported must return true for zigbee feature
83 TEST(ZigbeeManager, Disable_p)
85 g_bFeatureZb = __check_feature_supported((char*)FEATURE_ZIGBEE);
86 ASSERT_EQ(true, g_bFeatureZb) << FEATURE_ZIGBEE << " feature is not supported";
88 int ret = ZIGBEE_ERROR_NONE;
91 ret = zb_mgr.zbl_disable();
92 EXPECT_EQ(ZIGBEE_ERROR_NONE, ret);
95 int main(int argc, char **argv)
99 testing::InitGoogleTest(&argc, argv);
100 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
101 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
103 std::cerr << "Caught: unknown exception" << std::endl;
107 ret = RUN_ALL_TESTS();
108 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
109 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
111 std::cerr << "Caught: unknown exception" << std::endl;