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>
27 using ::testing::InitGoogleTest;
28 using ::testing::Test;
29 using ::testing::TestCase;
31 char *mesh_id = (char *)"haltestnetwork";
36 @author SRID(abhishek.s94)
37 @reviewer HQ(saerome.kim)
39 @description Positive, Enable wifi-mesh-manager
40 @apicovered "enable" dbus method on net.wmesh.manager interface
41 @passcase when EnableManager() returns ERROR_NONE
42 @failcase when EnableManager() does not return ERROR_NONE
46 TEST(WifiMeshManager, Enable_p)
48 error_e ret = ERROR_NONE;
51 ret = mgr.EnableManager();
52 EXPECT_EQ(ERROR_NONE, ret);
58 @author SRID(abhishek.s94)
59 @reviewer HQ(saerome.kim)
61 @description Positive, Start wifi-mesh-manager
62 @apicovered "enable_mesh" dbus method on net.wmesh.manager interface
63 @passcase when EnableMesh() returns ERROR_NONE
64 @failcase when EnableMesh() does not return ERROR_NONE
68 TEST(WifiMeshManager, EnableMesh_p)
70 error_e ret = ERROR_NONE;
74 EXPECT_EQ(ERROR_NONE, ret);
80 @author SRID(abhishek.s94)
81 @reviewer HQ(saerome.kim)
83 @description Positive, Scan using wifi-mesh-manager
84 @apicovered "scan" dbus method on net.wmesh.manager interface
85 @passcase when Scan() returns ERROR_NONE
86 @failcase when Scan() does not return ERROR_NONE
90 TEST(WifiMeshManager, Scan_p)
92 error_e ret = ERROR_NONE;
96 EXPECT_EQ(ERROR_NONE, ret);
100 @testcase EnableSoftap_p
102 @author SRID(abhishek.s94)
103 @reviewer HQ(saerome.kim)
105 @description Positive, Enable softap using wifi-mesh-manager
106 @apicovered "enable_softap" dbus method on net.wmesh.manager interface
107 @passcase when EnableSoftap() returns ERROR_NONE
108 @failcase when EnableSoftap() does not return ERROR_NONE
112 TEST(WifiMeshManager, SetSoftap_p)
114 static char ssid[] = "haltestnetwork";
115 static char passphrase[] = "00000000";
116 static int channel = 1;
117 static int visibility = 1;
118 static int max_stations = 10;
119 static int security = 2;
121 error_e ret = ERROR_NONE;
124 ret = w.SetSoftap(ssid, passphrase,
125 channel, visibility, max_stations, security);
126 EXPECT_EQ(ERROR_NONE, ret);
129 EXPECT_EQ(ERROR_NONE, ret);
131 ret = w.EnableSoftap();
132 EXPECT_EQ(ERROR_NONE, ret);
136 @testcase DisableSoftap_p
138 @author SRID(abhishek.s94)
139 @reviewer HQ(saerome.kim)
141 @description Positive, Disable softap using wifi-mesh-manager
142 @apicovered "disable_softap" dbus method on net.wmesh.manager interface
143 @passcase when DisableSoftap() returns ERROR_NONE
144 @failcase when DisableSoftap() does not return ERROR_NONE
148 TEST(WifiMeshManager, DisableSoftap_p)
150 error_e ret = ERROR_NONE;
153 ret = w.DisableSoftap();
154 EXPECT_EQ(ERROR_NONE, ret);
158 @testcase CreateMeshNetwork_p
160 @author SRID(abhishek.s94)
161 @reviewer HQ(saerome.kim)
163 @description Positive, Create mesh network using wifi-mesh-manager
164 @apicovered "create_mesh_network" dbus method on net.wmesh.manager interface
165 @passcase when CreateMeshNetwork() returns ERROR_NONE
166 @failcase when CreateMeshNetwork() does not return ERROR_NONE
170 TEST(WifiMeshManager, CreateMeshNetwork_p)
172 error_e ret = ERROR_NONE;
175 ret = w.CreateMeshNetwork(mesh_id, 1, 2, 1);
176 EXPECT_EQ(ERROR_NONE, ret);
180 @testcase ConnectMeshNetwork_p
182 @author SRID(abhishek.s94)
183 @reviewer HQ(saerome.kim)
185 @description Positive, Connect to a mesh network using wifi-mesh-manager
186 @apicovered "connect_mesh_network" dbus method on net.wmesh.manager interface
187 @passcase when ConnectMeshNetwork() returns ERROR_NONE
188 @failcase when ConnectMeshNetwork() does not return ERROR_NONE
192 TEST(WifiMeshManager, ConnectMeshNetwork_p)
194 error_e ret = ERROR_NONE;
196 char *passphrase = (char *)"00000000";
198 ret = w.ConnectMeshNetwork(mesh_id, 1, 2, passphrase);
199 EXPECT_EQ(ERROR_NONE, ret);
206 @author SRID(abhishek.s94)
207 @reviewer HQ(saerome.kim)
209 @description Positive, Stop wifi-mesh-manager
210 @apicovered "disable_mesh" dbus method on net.wmesh.manager interface
211 @passcase when DisableMesh() returns ERROR_NONE
212 @failcase when DisableMesh() does not return ERROR_NONE
216 TEST(WifiMeshManager, DisableMesh_p)
218 error_e ret = ERROR_NONE;
221 ret = w.DisableMesh();
222 EXPECT_EQ(ERROR_NONE, ret);
228 @author SRID(abhishek.s94)
229 @reviewer HQ(saerome.kim)
231 @description Positive, Disable wifi-mesh-manager
232 @apicovered "disable" dbus method on net.wmesh.manager interface
233 @passcase when DisableManager() returns ERROR_NONE
234 @failcase when DisableManager() does not return ERROR_NONE
238 TEST(WifiMeshManager, Disable_p)
240 error_e ret = ERROR_NONE;
243 ret = mgr.DisableManager();
244 EXPECT_EQ(ERROR_NONE, ret);
247 int main(int argc, char **argv)
251 testing::InitGoogleTest(&argc, argv);
252 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
253 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
255 std::cerr << "Caught: unknown exception" << std::endl;
259 ret = RUN_ALL_TESTS();
260 } catch (const ::testing::internal::GoogleTestFailureException& ex) {
261 std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
263 std::cerr << "Caught: unknown exception" << std::endl;