From 00e2ea0ea7eafbaf91a7212fc5aacb00d3fac10a Mon Sep 17 00:00:00 2001 From: Yangys Date: Wed, 18 Jan 2023 19:12:48 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20b97c93d=20from=20https://gitee.com/zhan?= =?UTF-8?q?g-hai-feng/web=5Fwebview/pulls/552=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=A0=81=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yangys --- .../src/net_connect_adapter_impl.cpp | 10 +++++----- .../net_connect_adapter_impl_test.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ohos_adapter/net_connect_adapter/src/net_connect_adapter_impl.cpp b/ohos_adapter/net_connect_adapter/src/net_connect_adapter_impl.cpp index bc6938832..b8248d857 100644 --- a/ohos_adapter/net_connect_adapter/src/net_connect_adapter_impl.cpp +++ b/ohos_adapter/net_connect_adapter/src/net_connect_adapter_impl.cpp @@ -35,7 +35,7 @@ int32_t NetConnectAdapterImpl::RegisterNetConnCallback(std::shared_ptr::GetInstance()->RegisterNetConnCallback(callbackImpl); - if (ret != NetConnResultCode::NET_CONN_SUCCESS) { + if (ret != NETMANAGER_SUCCESS) { WVLOG_E("register NetConnCallback failed, ret = %{public}d.", ret); return -1; } @@ -59,7 +59,7 @@ int32_t NetConnectAdapterImpl::UnregisterNetConnCallback(std::shared_ptr::GetInstance()->UnregisterNetConnCallback(it->second); - if (ret != NetConnResultCode::NET_CONN_SUCCESS) { + if (ret != NETMANAGER_SUCCESS) { WVLOG_E("unregister NetConnCallback failed, ret = %{public}d.", ret); return -1; } @@ -73,7 +73,7 @@ int32_t NetConnectAdapterImpl::GetDefaultNetConnect(NetConnectType &type, NetCon { NetHandle netHandle; int32_t ret = DelayedSingleton::GetInstance()->GetDefaultNet(netHandle); - if (ret != NetConnResultCode::NET_CONN_SUCCESS) { + if (ret != NETMANAGER_SUCCESS) { WVLOG_E("get default net failed, ret = %{public}d.", ret); return -1; } @@ -81,7 +81,7 @@ int32_t NetConnectAdapterImpl::GetDefaultNetConnect(NetConnectType &type, NetCon NetAllCapabilities netAllCap; ret = DelayedSingleton::GetInstance()->GetNetCapabilities(netHandle, netAllCap); - if (ret != NetConnResultCode::NET_CONN_SUCCESS) { + if (ret != NETMANAGER_SUCCESS) { WVLOG_E("get default net capbilities failed, ret = %{public}d.", ret); return -1; } @@ -110,4 +110,4 @@ int32_t NetConnectAdapterImpl::GetDefaultNetConnect(NetConnectType &type, NetCon WVLOG_D("NetAllCapabilities dump, %{public}s.", netAllCap.ToString("").c_str()); return 0; } -} // namespace OHOS::NWeb \ No newline at end of file +} // namespace OHOS::NWeb \ No newline at end of file diff --git a/test/unittest/net_connect_adapter_impl_test/net_connect_adapter_impl_test.cpp b/test/unittest/net_connect_adapter_impl_test/net_connect_adapter_impl_test.cpp index ee02936a4..5df953e4a 100644 --- a/test/unittest/net_connect_adapter_impl_test/net_connect_adapter_impl_test.cpp +++ b/test/unittest/net_connect_adapter_impl_test/net_connect_adapter_impl_test.cpp @@ -130,16 +130,16 @@ HWTEST_F(NetConnectAdapterImplTest, NetConnectAdapterImplTest_001, TestSize.Leve std::shared_ptr cb = std::make_shared(); std::shared_ptr netConnectAdapterImpl = std::make_shared(); EXPECT_NE(netConnectAdapterImpl, nullptr); - g_regNetConnCallback = static_cast(NetConnResultCode::NET_CONN_SUCCESS); + g_regNetConnCallback = static_cast(NETMANAGER_SUCCESS); EXPECT_EQ(netConnectAdapterImpl->RegisterNetConnCallback(cb), 0); g_regNetConnCallback = -1; EXPECT_EQ(netConnectAdapterImpl->RegisterNetConnCallback(cb), -1); EXPECT_EQ(netConnectAdapterImpl->RegisterNetConnCallback(nullptr), -1); - g_unregNetConnCallback = static_cast(NetConnResultCode::NET_CONN_SUCCESS); + g_unregNetConnCallback = static_cast(NETMANAGER_SUCCESS); EXPECT_EQ(netConnectAdapterImpl->UnregisterNetConnCallback(cb), 0); EXPECT_EQ(netConnectAdapterImpl->UnregisterNetConnCallback(cb), -1); - g_regNetConnCallback = static_cast(NetConnResultCode::NET_CONN_SUCCESS); + g_regNetConnCallback = static_cast(NETMANAGER_SUCCESS); EXPECT_EQ(netConnectAdapterImpl->RegisterNetConnCallback(cb), 0); g_unregNetConnCallback = -1; EXPECT_EQ(netConnectAdapterImpl->UnregisterNetConnCallback(cb), -1); @@ -157,15 +157,15 @@ HWTEST_F(NetConnectAdapterImplTest, NetConnectAdapterImplTest_002, TestSize.Leve std::shared_ptr netConnectAdapterImpl = std::make_shared(); NetConnectType type = NetConnectType::CONNECTION_UNKNOWN; NetConnectSubtype subtype = NetConnectSubtype::SUBTYPE_UNKNOWN; - g_getDefaultNet = static_cast(NetConnResultCode::NET_CONN_SUCCESS); - g_getNetCap = static_cast(NetConnResultCode::NET_CONN_SUCCESS); + g_getDefaultNet = static_cast(NETMANAGER_SUCCESS); + g_getNetCap = static_cast(NETMANAGER_SUCCESS); EXPECT_EQ(netConnectAdapterImpl->GetDefaultNetConnect(type, subtype), 0); g_networkState = new NetworkState(); g_slotId = -1; EXPECT_EQ(netConnectAdapterImpl->GetDefaultNetConnect(type, subtype), 0); g_getDefaultNet = -1; EXPECT_EQ(netConnectAdapterImpl->GetDefaultNetConnect(type, subtype), -1); - g_getDefaultNet = static_cast(NetConnResultCode::NET_CONN_SUCCESS); + g_getDefaultNet = static_cast(NETMANAGER_SUCCESS); g_getNetCap = -1; EXPECT_EQ(netConnectAdapterImpl->GetDefaultNetConnect(type, subtype), -1); } -- Gitee