• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #include "accesstoken_kit.h"
19 #include "net_all_capabilities.h"
20 #include "net_conn_service.h"
21 #include "net_conn_client.h"
22 #include "net_conn_constants.h"
23 #include "net_conn_types.h"
24 #include "net_manager_constants.h"
25 #include "net_mgr_log_wrapper.h"
26 #include "token_setproc.h"
27 #include "net_supplier_callback_stub.h"
28 #include "net_conn_callback_stub.h"
29 #include "http_proxy.h"
30 
31 namespace OHOS {
32 namespace NetManagerStandard {
33 namespace {
34 using namespace testing::ext;
35 using namespace Security::AccessToken;
36 using Security::AccessToken::AccessTokenID;
37 
38 HapInfoParams testInfoParms = {.bundleName = "net_conn_service_test", .userID = 1, .instIndex = 0, .appIDDesc = "test"};
39 
40 PermissionDef testPermDef = {.permissionName = "ohos.permission.GET_NETWORK_INFO",
41                              .bundleName = "net_conn_service_test",
42                              .grantMode = 1,
43                              .label = "label",
44                              .labelId = 1,
45                              .description = "Test net connect maneger",
46                              .descriptionId = 1,
47                              .availableLevel = APL_SYSTEM_BASIC};
48 
49 PermissionStateFull testState = {.grantFlags = {2},
50                                  .grantStatus = {PermissionState::PERMISSION_GRANTED},
51                                  .isGeneral = true,
52                                  .permissionName = "ohos.permission.GET_NETWORK_INFO",
53                                  .resDeviceID = {"local"}};
54 
55 PermissionDef testPermDef2 = {.permissionName = "ohos.permission.INTERNET",
56                               .bundleName = "net_conn_service_test",
57                               .grantMode = 1,
58                               .label = "label",
59                               .labelId = 1,
60                               .description = "Test net connect maneger",
61                               .descriptionId = 1,
62                               .availableLevel = APL_SYSTEM_BASIC};
63 
64 PermissionStateFull testState2 = {.grantFlags = {2},
65                                   .grantStatus = {PermissionState::PERMISSION_GRANTED},
66                                   .isGeneral = true,
67                                   .permissionName = "ohos.permission.INTERNET",
68                                   .resDeviceID = {"local"}};
69 PermissionDef testPermDef3 = {.permissionName = "ohos.permission.CONNECTIVITY_INTERNAL",
70                               .bundleName = "net_conn_service_test",
71                               .grantMode = 1,
72                               .label = "label",
73                               .labelId = 1,
74                               .description = "Test net connect maneger",
75                               .descriptionId = 1,
76                               .availableLevel = APL_SYSTEM_BASIC};
77 
78 PermissionStateFull testState3 = {.grantFlags = {2},
79                                   .grantStatus = {PermissionState::PERMISSION_GRANTED},
80                                   .isGeneral = true,
81                                   .permissionName = "ohos.permission.CONNECTIVITY_INTERNAL",
82                                   .resDeviceID = {"local"}};
83 
84 HapPolicyParams testPolicyPrams = {.apl = APL_SYSTEM_BASIC,
85                                    .domain = "test.domain",
86                                    .permList = {testPermDef, testPermDef2, testPermDef3},
87                                    .permStateList = {testState, testState2, testState3}};
88 
89 constexpr const char *TEST_IDENT = "testIdent";
90 constexpr uint32_t TEST_TIMEOUTMS = 1000;
91 constexpr const char *TEST_HOST = "testHost";
92 constexpr int32_t TEST_NETID = 3;
93 constexpr int32_t TEST_SOCKETFD = 2;
94 const int32_t NET_ID = 2;
95 const int32_t SOCKET_FD = 2;
96 
97 class NetSupplierTestCallback : public NetSupplierCallbackStub {
98 public:
RequestNetwork(const std::string & ident,const std::set<NetCap> & netCaps)99     inline int32_t RequestNetwork(const std::string &ident, const std::set<NetCap> &netCaps) override
100     {
101         return NETMANAGER_SUCCESS;
102     }
ReleaseNetwork(const std::string & ident,const std::set<NetCap> & netCaps)103     inline int32_t ReleaseNetwork(const std::string &ident, const std::set<NetCap> &netCaps) override
104     {
105         return NETMANAGER_SUCCESS;
106     }
107 };
108 
109 class NetConnTestCallback : public NetConnCallbackStub {
110 public:
NetAvailable(sptr<NetHandle> & netHandle)111     inline int32_t NetAvailable(sptr<NetHandle> &netHandle) override
112     {
113         return 0;
114     }
NetCapabilitiesChange(sptr<NetHandle> & netHandle,const sptr<NetAllCapabilities> & netAllCap)115     inline int32_t NetCapabilitiesChange(sptr<NetHandle> &netHandle, const sptr<NetAllCapabilities> &netAllCap) override
116     {
117         return 0;
118     }
NetConnectionPropertiesChange(sptr<NetHandle> & netHandle,const sptr<NetLinkInfo> & info)119     inline int32_t NetConnectionPropertiesChange(sptr<NetHandle> &netHandle, const sptr<NetLinkInfo> &info) override
120     {
121         return 0;
122     }
NetLost(sptr<NetHandle> & netHandle)123     inline int32_t NetLost(sptr<NetHandle> &netHandle) override
124     {
125         return 0;
126     }
NetUnavailable()127     inline int32_t NetUnavailable() override
128     {
129         return 0;
130     }
NetBlockStatusChange(sptr<NetHandle> & netHandle,bool blocked)131     inline int32_t NetBlockStatusChange(sptr<NetHandle> &netHandle, bool blocked) override
132     {
133         return 0;
134     }
135 };
136 sptr<INetConnCallback> g_callback = new (std::nothrow) NetConnTestCallback();
137 uint32_t g_supplierId = 0;
138 } // namespace
139 
140 class AccessToken {
141 public:
AccessToken()142     AccessToken()
143     {
144         currentID_ = GetSelfTokenID();
145         AccessTokenIDEx tokenIdEx = AccessTokenKit::AllocHapToken(testInfoParms, testPolicyPrams);
146         accessID_ = tokenIdEx.tokenIdExStruct.tokenID;
147         SetSelfTokenID(accessID_);
148     }
~AccessToken()149     ~AccessToken()
150     {
151         AccessTokenKit::DeleteToken(accessID_);
152         SetSelfTokenID(currentID_);
153     }
154 
155 private:
156     AccessTokenID currentID_ = 0;
157     AccessTokenID accessID_ = 0;
158 };
159 
160 class NetConnServiceTest : public testing::Test {
161 public:
162     static void SetUpTestCase();
163     static void TearDownTestCase();
164     void SetUp();
165     void TearDown();
166 };
167 
SetUpTestCase()168 void NetConnServiceTest::SetUpTestCase()
169 {
170     std::set<NetCap> netCaps;
171     DelayedSingleton<NetConnClient>::GetInstance()->RegisterNetSupplier(NetBearType::BEARER_ETHERNET, TEST_IDENT,
172                                                                         netCaps, g_supplierId);
173 }
174 
TearDownTestCase()175 void NetConnServiceTest::TearDownTestCase() {}
176 
SetUp()177 void NetConnServiceTest::SetUp() {}
178 
TearDown()179 void NetConnServiceTest::TearDown() {}
180 
181 HWTEST_F(NetConnServiceTest, OnStopTest001, TestSize.Level1)
182 {
183     DelayedSingleton<NetConnService>::GetInstance()->OnStop();
184 }
185 
186 HWTEST_F(NetConnServiceTest, OnStartTest001, TestSize.Level1)
187 {
188     DelayedSingleton<NetConnService>::GetInstance()->OnStart();
189 }
190 
191 HWTEST_F(NetConnServiceTest, SystemReadyTest001, TestSize.Level1)
192 {
193     int32_t ret = DelayedSingleton<NetConnService>::GetInstance()->SystemReady();
194     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
195 }
196 
197 HWTEST_F(NetConnServiceTest, RegisterNetSupplierCallbackTest001, TestSize.Level1)
198 {
199     sptr<INetSupplierCallback> callback = new (std::nothrow) NetSupplierTestCallback();
200     ASSERT_NE(callback, nullptr);
201     std::set<NetCap> netCaps;
202     auto ret = DelayedSingleton<NetConnService>::GetInstance()->RegisterNetSupplierCallback(g_supplierId, callback);
203     EXPECT_EQ(ret, NET_CONN_ERR_NO_SUPPLIER);
204 }
205 
206 HWTEST_F(NetConnServiceTest, UpdateNetSupplierInfoTest001, TestSize.Level1)
207 {
208     sptr<NetSupplierInfo> netSupplierInfo = new (std::nothrow) NetSupplierInfo();
209     ASSERT_NE(netSupplierInfo, nullptr);
210     auto ret = DelayedSingleton<NetConnService>::GetInstance()->UpdateNetSupplierInfo(g_supplierId, netSupplierInfo);
211     EXPECT_EQ(ret, NET_CONN_ERR_NO_SUPPLIER);
212 }
213 
214 HWTEST_F(NetConnServiceTest, UpdateNetLinkInfoTest001, TestSize.Level1)
215 {
216     sptr<NetLinkInfo> netLinkInfo = new (std::nothrow) NetLinkInfo();
217     ASSERT_NE(netLinkInfo, nullptr);
218     auto ret = DelayedSingleton<NetConnService>::GetInstance()->UpdateNetLinkInfo(g_supplierId, netLinkInfo);
219     EXPECT_EQ(ret, NET_CONN_ERR_NO_SUPPLIER);
220 }
221 
222 HWTEST_F(NetConnServiceTest, RegisterNetConnCallbackTest001, TestSize.Level1)
223 {
224     sptr<INetConnCallback> callback = new (std::nothrow) NetConnTestCallback();
225     ASSERT_NE(callback, nullptr);
226     auto ret = DelayedSingleton<NetConnService>::GetInstance()->RegisterNetConnCallback(callback);
227     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
228 }
229 
230 HWTEST_F(NetConnServiceTest, RegisterNetConnCallbackTest002, TestSize.Level1)
231 {
232     AccessToken token;
233     auto ret = DelayedSingleton<NetConnService>::GetInstance()->RegisterNetConnCallback(g_callback);
234     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
235 }
236 
237 HWTEST_F(NetConnServiceTest, RegisterNetConnCallbackTest003, TestSize.Level1)
238 {
239     sptr<NetSpecifier> netSpecifier = new (std::nothrow) NetSpecifier();
240     ASSERT_NE(netSpecifier, nullptr);
241     sptr<INetConnCallback> callback = new (std::nothrow) NetConnTestCallback();
242     ASSERT_NE(callback, nullptr);
243     auto ret = DelayedSingleton<NetConnService>::GetInstance()->RegisterNetConnCallback(netSpecifier, callback,
244                                                                                         TEST_TIMEOUTMS);
245     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
246 }
247 
248 HWTEST_F(NetConnServiceTest, RegisterNetConnCallbackTest004, TestSize.Level1)
249 {
250     AccessToken token;
251     sptr<NetSpecifier> netSpecifier = new (std::nothrow) NetSpecifier();
252     ASSERT_NE(netSpecifier, nullptr);
253     sptr<INetConnCallback> callback = new (std::nothrow) NetConnTestCallback();
254     ASSERT_NE(callback, nullptr);
255     auto ret = DelayedSingleton<NetConnService>::GetInstance()->RegisterNetConnCallback(netSpecifier, callback,
256                                                                                         TEST_TIMEOUTMS);
257     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
258 }
259 
260 HWTEST_F(NetConnServiceTest, UnregisterNetConnCallbackTest001, TestSize.Level1)
261 {
262     auto ret = DelayedSingleton<NetConnService>::GetInstance()->UnregisterNetConnCallback(g_callback);
263     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
264 }
265 
266 HWTEST_F(NetConnServiceTest, UnregisterNetConnCallbackTest002, TestSize.Level1)
267 {
268     AccessToken token;
269     auto ret = DelayedSingleton<NetConnService>::GetInstance()->UnregisterNetConnCallback(g_callback);
270     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
271 }
272 
273 HWTEST_F(NetConnServiceTest, GetAllNetsTest001, TestSize.Level1)
274 {
275     std::list<int32_t> netIdList;
276     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetAllNets(netIdList);
277     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
278 }
279 
280 HWTEST_F(NetConnServiceTest, GetAllNetsTest002, TestSize.Level1)
281 {
282     AccessToken token;
283     std::list<int32_t> netIdList;
284     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetAllNets(netIdList);
285     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
286 }
287 
288 HWTEST_F(NetConnServiceTest, GetConnectionPropertiesTest001, TestSize.Level1)
289 {
290     NetLinkInfo info;
291     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetConnectionProperties(TEST_NETID, info);
292     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
293 }
294 
295 HWTEST_F(NetConnServiceTest, GetConnectionPropertiesTest002, TestSize.Level1)
296 {
297     AccessToken token;
298     NetLinkInfo info;
299     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetConnectionProperties(TEST_NETID, info);
300     EXPECT_EQ(ret, NET_CONN_ERR_INVALID_NETWORK);
301 }
302 
303 HWTEST_F(NetConnServiceTest, GetAddressesByNameTest001, TestSize.Level1)
304 {
305     std::vector<INetAddr> addrList;
306     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetAddressesByName(TEST_HOST, TEST_NETID, addrList);
307     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
308 }
309 
310 HWTEST_F(NetConnServiceTest, GetAddressesByNameTest002, TestSize.Level1)
311 {
312     AccessToken token;
313     std::vector<INetAddr> addrList;
314     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetAddressesByName(TEST_HOST, TEST_NETID, addrList);
315     EXPECT_EQ(ret, NETMANAGER_ERROR);
316 }
317 
318 HWTEST_F(NetConnServiceTest, GetAddressByNameTest001, TestSize.Level1)
319 {
320     INetAddr addr;
321     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetAddressByName(TEST_HOST, TEST_NETID, addr);
322     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
323 }
324 
325 HWTEST_F(NetConnServiceTest, GetAddressByNameTest002, TestSize.Level1)
326 {
327     AccessToken token;
328     INetAddr addr;
329     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetAddressByName(TEST_HOST, TEST_NETID, addr);
330     EXPECT_EQ(ret, NETMANAGER_ERROR);
331 }
332 
333 HWTEST_F(NetConnServiceTest, BindSocketTest001, TestSize.Level1)
334 {
335     auto ret = DelayedSingleton<NetConnService>::GetInstance()->BindSocket(TEST_SOCKETFD, TEST_NETID);
336     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
337 }
338 
339 HWTEST_F(NetConnServiceTest, NetDetectionTest001, TestSize.Level1)
340 {
341     auto ret = DelayedSingleton<NetConnService>::GetInstance()->NetDetection(TEST_NETID);
342     EXPECT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
343 }
344 
345 HWTEST_F(NetConnServiceTest, NetDetectionTest002, TestSize.Level1)
346 {
347     AccessToken token;
348     auto ret = DelayedSingleton<NetConnService>::GetInstance()->NetDetection(TEST_NETID);
349     EXPECT_EQ(ret, NET_CONN_ERR_NETID_NOT_FOUND);
350 }
351 
352 HWTEST_F(NetConnServiceTest, GetNetIdByIdentifierTest001, TestSize.Level1)
353 {
354     int32_t netId = 0;
355     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetNetIdByIdentifier(TEST_IDENT, netId);
356     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
357 }
358 
359 HWTEST_F(NetConnServiceTest, GetDefaultNetTest001, TestSize.Level1)
360 {
361     int32_t netId = 0;
362     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetDefaultNet(netId);
363     ASSERT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
364 }
365 
366 HWTEST_F(NetConnServiceTest, GetDefaultNetTest002, TestSize.Level1)
367 {
368     AccessToken token;
369     int32_t netId = 0;
370     auto ret = DelayedSingleton<NetConnService>::GetInstance()->GetDefaultNet(netId);
371     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
372 }
373 
374 HWTEST_F(NetConnServiceTest, HasDefaultNetTest001, TestSize.Level1)
375 {
376     bool bFlag = false;
377     auto ret = DelayedSingleton<NetConnService>::GetInstance()->HasDefaultNet(bFlag);
378     ASSERT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
379 }
380 
381 HWTEST_F(NetConnServiceTest, HasDefaultNetTest002, TestSize.Level1)
382 {
383     AccessToken token;
384     bool bFlag = false;
385     auto ret = DelayedSingleton<NetConnService>::GetInstance()->HasDefaultNet(bFlag);
386     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
387 }
388 
389 HWTEST_F(NetConnServiceTest, GetNetCapabilitiesTest001, TestSize.Level1)
390 {
391     NETMGR_LOG_D("GetNetCapabilitiesTest001 In");
392     int32_t netId = 0;
393     int32_t ret = DelayedSingleton<NetConnService>::GetInstance()->GetDefaultNet(netId);
394     ASSERT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
395 
396     NetAllCapabilities netAllCap;
397     ret = DelayedSingleton<NetConnService>::GetInstance()->GetNetCapabilities(netId, netAllCap);
398     ASSERT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
399 }
400 
401 HWTEST_F(NetConnServiceTest, GetNetCapabilitiesTest002, TestSize.Level1)
402 {
403     NETMGR_LOG_D("GetNetCapabilitiesTest002 In");
404     int32_t netId = 0;
405     int32_t ret = DelayedSingleton<NetConnService>::GetInstance()->GetDefaultNet(netId);
406     ASSERT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
407 
408     AccessToken token;
409     NetAllCapabilities netAllCap;
410     ret = DelayedSingleton<NetConnService>::GetInstance()->GetNetCapabilities(netId, netAllCap);
411     ASSERT_EQ(ret, NET_CONN_ERR_INVALID_NETWORK);
412 }
413 
414 HWTEST_F(NetConnServiceTest, GetNetCapabilitiesTest003, TestSize.Level1)
415 {
416     NETMGR_LOG_D("GetNetCapabilitiesTest003 In");
417     AccessToken token;
418     int32_t netId = 0;
419     int32_t ret = DelayedSingleton<NetConnService>::GetInstance()->GetDefaultNet(netId);
420     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
421 
422     NetAllCapabilities netAllCap;
423     ret = DelayedSingleton<NetConnService>::GetInstance()->GetNetCapabilities(netId, netAllCap);
424     ASSERT_EQ(ret, NET_CONN_ERR_INVALID_NETWORK);
425 }
426 
427 HWTEST_F(NetConnServiceTest, SetAirplaneModeTest001, TestSize.Level1)
428 {
429     AccessToken token;
430     auto ret = DelayedSingleton<NetConnService>::GetInstance()->SetAirplaneMode(true);
431     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
432 }
433 
434 HWTEST_F(NetConnServiceTest, SetAirplaneModeTest002, TestSize.Level1)
435 {
436     AccessToken token;
437     auto ret = DelayedSingleton<NetConnService>::GetInstance()->SetAirplaneMode(false);
438     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
439 }
440 
441 HWTEST_F(NetConnServiceTest, IsDefaultNetMeteredTest001, TestSize.Level1)
442 {
443     bool bRes = false;
444     auto ret = DelayedSingleton<NetConnService>::GetInstance()->IsDefaultNetMetered(bRes);
445     ASSERT_EQ(ret, NETMANAGER_ERR_PERMISSION_DENIED);
446     ASSERT_EQ(bRes, false);
447 }
448 
449 HWTEST_F(NetConnServiceTest, IsDefaultNetMeteredTest002, TestSize.Level1)
450 {
451     AccessToken token;
452     bool bRes = false;
453     auto ret = DelayedSingleton<NetConnService>::GetInstance()->IsDefaultNetMetered(bRes);
454     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
455     ASSERT_TRUE(bRes);
456 }
457 
458 HWTEST_F(NetConnServiceTest, SetGlobalHttpProxyTest001, TestSize.Level1)
459 {
460     AccessToken token;
461     HttpProxy httpProxy = {"testHttpProxy", 0, {}};
462     auto ret = DelayedSingleton<NetConnService>::GetInstance()->SetGlobalHttpProxy(httpProxy);
463     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
464 }
465 
466 HWTEST_F(NetConnServiceTest, SetGlobalHttpProxyTest002, TestSize.Level1)
467 {
468     HttpProxy httpProxy;
469     auto ret = DelayedSingleton<NetConnService>::GetInstance()->SetGlobalHttpProxy(httpProxy);
470     ASSERT_NE(ret, NETMANAGER_SUCCESS);
471 }
472 
473 HWTEST_F(NetConnServiceTest, GetGlobalHttpProxyTest001, TestSize.Level1)
474 {
475     AccessToken token;
476     HttpProxy httpProxy = {"testHttpProxy", 0, {}};
477     int32_t ret = DelayedSingleton<NetConnService>::GetInstance()->SetGlobalHttpProxy(httpProxy);
478     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
479 
480     HttpProxy getGlobalHttpProxy;
481     ret = DelayedSingleton<NetConnService>::GetInstance()->GetGlobalHttpProxy(getGlobalHttpProxy);
482     ASSERT_EQ(ret, NETMANAGER_SUCCESS);
483 }
484 
485 HWTEST_F(NetConnServiceTest, GetTest001, TestSize.Level1)
486 {
487     std::list<int32_t> netIdList;
488     netIdList.push_back(NET_ID);
489     int32_t ret = DelayedSingleton<NetConnService>::GetInstance()->GetSpecificNet(BEARER_CELLULAR, netIdList);
490     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
491 
492     ret = DelayedSingleton<NetConnService>::GetInstance()->RestrictBackgroundChanged(true);
493     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
494 
495     std::vector<std::u16string> args;
496     args.emplace_back(u"dummy data");
497     ret = DelayedSingleton<NetConnService>::GetInstance()->Dump(SOCKET_FD, args);
498     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
499     DelayedSingleton<NetConnService>::GetInstance()->OnNetActivateTimeOut(NET_ID);
500 }
501 } // namespace NetManagerStandard
502 } // namespace OHOS
503