2 * Copyright (c) 2018 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>
28 using ::testing::InitGoogleTest;
29 using ::testing::Test;
30 using ::testing::TestCase;
32 char *mesh_id = (char *)"haltestnetwork";
33 char *feature_name = (char *)"http://tizen.org/feature/network.wifi.mesh";
37 bool mesh_supported = FALSE;
38 if (!system_info_get_platform_bool(feature_name, &mesh_supported)) {
39 if (FALSE == mesh_supported) {
40 GLOGD("wifi-mesh feature is disabled");
41 return ERROR_NOT_SUPPORTED;
45 GLOGD("Error - Feature getting from System Info");
46 return ERROR_INVALID_PARAMETER;
53 @author SRID(abhishek.s94)
54 @reviewer HQ(saerome.kim)
56 @description Positive, Enable wifi-mesh-manager
57 @apicovered "enable" dbus method on net.wmesh.manager interface
58 @passcase when EnableManager() returns ERROR_NONE
59 @failcase when EnableManager() does not return ERROR_NONE
63 TEST(WifiMeshManager, Enable_p)
65 error_e ret = ERROR_NONE;
68 if (ERROR_NONE == CheckFeature()) {
69 ret = mgr.EnableManager();
71 EXPECT_EQ(ERROR_NONE, ret);
77 @author SRID(abhishek.s94)
78 @reviewer HQ(saerome.kim)
80 @description Positive, Start wifi-mesh-manager
81 @apicovered "enable_mesh" dbus method on net.wmesh.manager interface
82 @passcase when EnableMesh() returns ERROR_NONE
83 @failcase when EnableMesh() does not return ERROR_NONE
87 TEST(WifiMeshManager, EnableMesh_p)
89 error_e ret = ERROR_NONE;
92 if (ERROR_NONE == CheckFeature()) {
95 EXPECT_EQ(ERROR_NONE, ret);
101 @author SRID(abhishek.s94)
102 @reviewer HQ(saerome.kim)
104 @description Positive, Scan using wifi-mesh-manager
105 @apicovered "scan" dbus method on net.wmesh.manager interface
106 @passcase when Scan() returns ERROR_NONE
107 @failcase when Scan() does not return ERROR_NONE
111 TEST(WifiMeshManager, Scan_p)
113 error_e ret = ERROR_NONE;
116 if (ERROR_NONE == CheckFeature()) {
119 EXPECT_EQ(ERROR_NONE, ret);
123 @testcase EnableSoftap_p
125 @author SRID(abhishek.s94)
126 @reviewer HQ(saerome.kim)
128 @description Positive, Enable softap using wifi-mesh-manager
129 @apicovered "enable_softap" dbus method on net.wmesh.manager interface
130 @passcase when EnableSoftap() returns ERROR_NONE
131 @failcase when EnableSoftap() does not return ERROR_NONE
135 TEST(WifiMeshManager, SetSoftap_p)
137 static char ssid[] = "haltestnetwork";
138 static char passphrase[] = "00000000";
139 static int channel = 1;
140 static int visibility = 1;
141 static int max_stations = 10;
142 static int security = 2;
144 error_e ret = ERROR_NONE;
147 if (ERROR_NONE == CheckFeature()) {
148 ret = w.SetSoftap(ssid, passphrase,
149 channel, visibility, max_stations, security);
150 EXPECT_EQ(ERROR_NONE, ret);
154 EXPECT_EQ(ERROR_NONE, ret);
156 ret = w.EnableSoftap();
158 EXPECT_EQ(ERROR_NONE, ret);
162 @testcase DisableSoftap_p
164 @author SRID(abhishek.s94)
165 @reviewer HQ(saerome.kim)
167 @description Positive, Disable softap using wifi-mesh-manager
168 @apicovered "disable_softap" dbus method on net.wmesh.manager interface
169 @passcase when DisableSoftap() returns ERROR_NONE
170 @failcase when DisableSoftap() does not return ERROR_NONE
174 TEST(WifiMeshManager, DisableSoftap_p)
176 error_e ret = ERROR_NONE;
179 if (ERROR_NONE == CheckFeature()) {
180 ret = w.DisableSoftap();
182 EXPECT_EQ(ERROR_NONE, ret);
186 @testcase CreateMeshNetwork_p
188 @author SRID(abhishek.s94)
189 @reviewer HQ(saerome.kim)
191 @description Positive, Create mesh network using wifi-mesh-manager
192 @apicovered "create_mesh_network" dbus method on net.wmesh.manager interface
193 @passcase when CreateMeshNetwork() returns ERROR_NONE
194 @failcase when CreateMeshNetwork() does not return ERROR_NONE
198 TEST(WifiMeshManager, CreateMeshNetwork_p)
200 error_e ret = ERROR_NONE;
203 if (ERROR_NONE == CheckFeature()) {
204 ret = w.CreateMeshNetwork(mesh_id, 1, 2, 1);
206 EXPECT_EQ(ERROR_NONE, ret);
210 @testcase ConnectMeshNetwork_p
212 @author SRID(abhishek.s94)
213 @reviewer HQ(saerome.kim)
215 @description Positive, Connect to a mesh network using wifi-mesh-manager
216 @apicovered "connect_mesh_network" dbus method on net.wmesh.manager interface
217 @passcase when ConnectMeshNetwork() returns ERROR_NONE
218 @failcase when ConnectMeshNetwork() does not return ERROR_NONE
222 TEST(WifiMeshManager, ConnectMeshNetwork_p)
224 error_e ret = ERROR_NONE;
226 char *passphrase = (char *)"00000000";
228 if (ERROR_NONE == CheckFeature()) {
229 ret = w.ConnectMeshNetwork(mesh_id, 1, 2, passphrase);
231 EXPECT_EQ(ERROR_NONE, ret);
238 @author SRID(abhishek.s94)
239 @reviewer HQ(saerome.kim)
241 @description Positive, Stop wifi-mesh-manager
242 @apicovered "disable_mesh" dbus method on net.wmesh.manager interface
243 @passcase when DisableMesh() returns ERROR_NONE
244 @failcase when DisableMesh() does not return ERROR_NONE
248 TEST(WifiMeshManager, DisableMesh_p)
250 error_e ret = ERROR_NONE;
253 if (ERROR_NONE == CheckFeature()) {
254 ret = w.DisableMesh();
256 EXPECT_EQ(ERROR_NONE, ret);
262 @author SRID(abhishek.s94)
263 @reviewer HQ(saerome.kim)
265 @description Positive, Disable wifi-mesh-manager
266 @apicovered "disable" dbus method on net.wmesh.manager interface
267 @passcase when DisableManager() returns ERROR_NONE
268 @failcase when DisableManager() does not return ERROR_NONE
272 TEST(WifiMeshManager, Disable_p)
274 error_e ret = ERROR_NONE;
277 if (ERROR_NONE == CheckFeature()) {
278 ret = mgr.DisableManager();
280 EXPECT_EQ(ERROR_NONE, ret);
283 int main(int argc, char **argv)
287 testing::InitGoogleTest(&argc, argv);
288 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
289 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
291 std::cerr << "Caught: unknown exception" << std::endl;
295 ret = RUN_ALL_TESTS();
296 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
297 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
299 std::cerr << "Caught: unknown exception" << std::endl;