diff --git a/test/unittest/device_control_proxy/device_control_proxy_test.cpp b/test/unittest/device_control_proxy/device_control_proxy_test.cpp index 023c31fe6165f317cb72b30649034ae549db17d7..cb9e633248b8a5a030e3b5da8b7acd2db2f3b9e7 100644 --- a/test/unittest/device_control_proxy/device_control_proxy_test.cpp +++ b/test/unittest/device_control_proxy/device_control_proxy_test.cpp @@ -136,9 +136,6 @@ HWTEST_F(DeviceControlProxyTest, TestLockScreenFail, TestSize.Level1) */ HWTEST_F(DeviceControlProxyTest, TestShutdownSuc, TestSize.Level1) { - GTEST_LOG_(WARNING) << "warning: to avoid affectd others case, TestShutdownSuc case will not run."; - ASSERT_TRUE(true); - return; OHOS::AppExecFwk::ElementName admin; admin.SetBundleName(ADMIN_PACKAGENAME); EXPECT_CALL(*object_, SendRequest(_, _, _, _)) @@ -169,9 +166,6 @@ HWTEST_F(DeviceControlProxyTest, TestShutdownFail, TestSize.Level1) */ HWTEST_F(DeviceControlProxyTest, TestRebootSuc, TestSize.Level1) { - GTEST_LOG_(WARNING) << "warning: to avoid affectd others case, TestRebootSuc case will not run."; - ASSERT_TRUE(true); - return; OHOS::AppExecFwk::ElementName admin; admin.SetBundleName(ADMIN_PACKAGENAME); EXPECT_CALL(*object_, SendRequest(_, _, _, _)) diff --git a/test/unittest/edm_plugin/src/reboot_plugin_test.cpp b/test/unittest/edm_plugin/src/reboot_plugin_test.cpp index f3d7fba9d9a36968b25bba2689e76c28ea753bc2..68d941762c7178174eb471dbad95c7420c035aee 100644 --- a/test/unittest/edm_plugin/src/reboot_plugin_test.cpp +++ b/test/unittest/edm_plugin/src/reboot_plugin_test.cpp @@ -26,7 +26,6 @@ namespace EDM { namespace TEST { void RebootPluginTest::SetUpTestSuite(void) { - Utils::SetEdmInitialEnv(); } void RebootPluginTest::TearDownTestSuite(void) @@ -38,17 +37,20 @@ void RebootPluginTest::TearDownTestSuite(void) /** * @tc.name: TestShutdown - * @tc.desc: Test ShutdownPlugin::OnSetPolicy function success. + * @tc.desc: Test ShutdownPlugin::OnSetPolicy function fail. * @tc.type: FUNC */ HWTEST_F(RebootPluginTest, TestReboot, TestSize.Level1) { - GTEST_LOG_(WARNING) << "warning: to avoid affectd others case, TestReboot case will not run."; - ASSERT_TRUE(true); - return; - RebootPlugin plugin; - ErrCode ret = plugin.OnSetPolicy(); - ASSERT_TRUE(ret == ERR_OK); + Utils::ResetTokenTypeAndUid(); + std::shared_ptr plugin = ShutdownPlugin::GetPlugin(); + bool isChanged = false; + uint32_t code = POLICY_FUNC_CODE((std::uint32_t)FuncOperateType::SET, EdmInterfaceCode::REBOOT); + std::string policyData{""}; + MessageParcel data; + MessageParcel reply; + ErrCode ret = plugin->OnHandlePolicy(code, data, reply, policyData, isChanged, DEFAULT_USER_ID); + ASSERT_TRUE(ret == EdmReturnErrCode::SYSTEM_ABNORMALLY); } } // namespace TEST } // namespace EDM diff --git a/test/unittest/edm_plugin/src/shutdown_plugin_test.cpp b/test/unittest/edm_plugin/src/shutdown_plugin_test.cpp index 3ade530fa79ca869491c919785d6703aee962a5a..7e00d2d66dbc2fb8ab918bca568e4489d220791a 100644 --- a/test/unittest/edm_plugin/src/shutdown_plugin_test.cpp +++ b/test/unittest/edm_plugin/src/shutdown_plugin_test.cpp @@ -26,7 +26,6 @@ namespace EDM { namespace TEST { void ShutdownPluginTest::SetUpTestSuite(void) { - Utils::SetEdmInitialEnv(); } void ShutdownPluginTest::TearDownTestSuite(void) @@ -38,17 +37,20 @@ void ShutdownPluginTest::TearDownTestSuite(void) /** * @tc.name: TestShutdown - * @tc.desc: Test ShutdownPlugin::OnSetPolicy function success. + * @tc.desc: Test ShutdownPlugin::OnSetPolicy function fail. * @tc.type: FUNC */ HWTEST_F(ShutdownPluginTest, TestShutdown, TestSize.Level1) { - GTEST_LOG_(WARNING) << "warning: to avoid affectd others case, TestShutdown case will not run."; - ASSERT_TRUE(true); - return; - ShutdownPlugin plugin; - ErrCode ret = plugin.OnSetPolicy(); - ASSERT_TRUE(ret == ERR_OK); + Utils::ResetTokenTypeAndUid(); + std::shared_ptr plugin = ShutdownPlugin::GetPlugin(); + bool isChanged = false; + uint32_t code = POLICY_FUNC_CODE((std::uint32_t)FuncOperateType::SET, EdmInterfaceCode::SHUTDOWN); + std::string policyData{""}; + MessageParcel data; + MessageParcel reply; + ErrCode ret = plugin->OnHandlePolicy(code, data, reply, policyData, isChanged, DEFAULT_USER_ID); + ASSERT_TRUE(ret == EdmReturnErrCode::SYSTEM_ABNORMALLY); } } // namespace TEST } // namespace EDM