From d2392169de5978fa7dbc4eb30c8973f05b5243bf Mon Sep 17 00:00:00 2001 From: jds Date: Mon, 16 Jan 2023 18:53:22 +0800 Subject: [PATCH] match net_conn errcode Signed-off-by: jds --- .../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 b2488a720..4f913feef 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; } @@ -111,4 +111,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 a0277ed21..50d8a6c67 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 @@ -124,16 +124,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); @@ -151,14 +151,14 @@ 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_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