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 using ::testing::InitGoogleTest;
28 using ::testing::Test;
29 using ::testing::TestCase;
31 const char *feature_name = (char *)"http://tizen.org/feature/network.zigbee";
33 static bool __check_feature_supported()
35 bool zigbee_supported = FALSE;
36 if (!system_info_get_platform_bool(feature_name, &zigbee_supported)) {
37 if (FALSE == zigbee_supported) {
38 GLOGD("zigbee feature is disabled");
39 return ZIGBEE_ERROR_NOT_SUPPORTED;
41 return ZIGBEE_ERROR_NONE;
43 GLOGD("Error - Feature getting from System Info");
44 return ZIGBEE_ERROR_INVALID_PARAMETER;
52 @author SRID(abhishek.s94)
53 @reviewer HQ(saerome.kim)
55 @description Positive, Enable zigbee manager
56 @apicovered "enable" method on "org.tizen.zigbee.manager" interface
57 @passcase when zbl_enable returns ZIGBEE_ERROR_NONE
58 @failcase when zbl_enable does not return ZIGBEE_ERROR_NONE
59 @precondition __check_feature_supported must return true for zigbee feature
62 TEST(ZigbeeManager, Enable_p)
64 int ret = ZIGBEE_ERROR_NONE;
67 if (ZIGBEE_ERROR_NONE == __check_feature_supported()) {
68 ret = zb_mgr.zbl_enable();
70 EXPECT_EQ(ZIGBEE_ERROR_NONE, ret);
76 @author SRID(abhishek.s94)
77 @reviewer HQ(saerome.kim)
79 @description Positive, Disable zigbee manager
80 @apicovered "disable" method on "org.tizen.zigbee.manager" interface
81 @passcase when zbl_disable returns ZIGBEE_ERROR_NONE
82 @failcase when zbl_disable does not return ZIGBEE_ERROR_NONE
83 @precondition __check_feature_supported must return true for zigbee feature
86 TEST(ZigbeeManager, Disable_p)
88 int ret = ZIGBEE_ERROR_NONE;
91 if (ZIGBEE_ERROR_NONE == __check_feature_supported()) {
92 ret = zb_mgr.zbl_disable();
94 EXPECT_EQ(ZIGBEE_ERROR_NONE, ret);
97 int main(int argc, char **argv)
101 testing::InitGoogleTest(&argc, argv);
102 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
103 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
105 std::cerr << "Caught: unknown exception" << std::endl;
109 ret = RUN_ALL_TESTS();
110 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
111 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
113 std::cerr << "Caught: unknown exception" << std::endl;