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 b2488a720642aa25e6dd7d44ecd3dde14798cfee..4f913feef2a563be1581bee5643cdd4030b11188 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 a0277ed217fd231f74fda76d0b37391b4d7ca849..50d8a6c679ab604d85d95d0cb32ddc4f29b198d1 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); }