/* * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "UTTest_dm_distributed_hardware_load.h" #include #include "dm_log.h" #include "dm_constants.h" namespace OHOS { namespace DistributedHardware { void DmDistributedHardwareLoadTest::SetUp() { } void DmDistributedHardwareLoadTest::TearDown() { } void DmDistributedHardwareLoadTest::SetUpTestCase() { } void DmDistributedHardwareLoadTest::TearDownTestCase() { } HWTEST_F(DmDistributedHardwareLoadTest, LoadDistributedHardwareFwk_001, testing::ext::TestSize.Level0) { DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk(); uint32_t ret = DmDistributedHardwareLoad::GetInstance().distributedHardwareLoadCount_; EXPECT_NE(ret, DM_OK); } HWTEST_F(DmDistributedHardwareLoadTest, InitDistributedHardwareLoadCount_001, testing::ext::TestSize.Level0) { DmDistributedHardwareLoad::GetInstance().InitDistributedHardwareLoadCount(); uint32_t ret = DmDistributedHardwareLoad::GetInstance().distributedHardwareLoadCount_; EXPECT_EQ(ret, DM_OK); } HWTEST_F(DmDistributedHardwareLoadTest, GetDistributedHardwareLoadCount_001, testing::ext::TestSize.Level0) { DmDistributedHardwareLoad::GetInstance().GetDistributedHardwareLoadCount(); uint32_t ret = DmDistributedHardwareLoad::GetInstance().distributedHardwareLoadCount_; EXPECT_EQ(ret, DM_OK); } HWTEST_F(DmDistributedHardwareLoadTest, OnLoadSystemAbilitySuccess_001, testing::ext::TestSize.Level0) { int32_t systemAbilityId = 4800; sptr remoteObject = nullptr; sptr distributedHardwareLoadCallback_(new DistributedHardwareLoadCallback()); distributedHardwareLoadCallback_->OnLoadSystemAbilitySuccess(systemAbilityId, remoteObject); uint32_t ret = DmDistributedHardwareLoad::GetInstance().distributedHardwareLoadCount_; EXPECT_EQ(ret, DM_OK); } HWTEST_F(DmDistributedHardwareLoadTest, Sha256_001, testing::ext::TestSize.Level0) { std::shared_ptr crypto = std::make_shared(); std::string text; bool isUpper = false; std::string ret = crypto->Sha256(text, isUpper); EXPECT_NE(ret.empty(), true); } HWTEST_F(DmDistributedHardwareLoadTest, GetCryptoAdapter_001, testing::ext::TestSize.Level0) { std::string soName = "soName"; auto ret = DmAdapterManager::GetInstance().GetCryptoAdapter(soName); EXPECT_EQ(ret, nullptr); } } // namespace DistributedHardware } // namespace OHOS