From e41f38d27990a636d8c4b473a2c9f5bfa46f8126 Mon Sep 17 00:00:00 2001 From: liwuli Date: Thu, 11 May 2023 21:56:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3DevicePolicy=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=A5=97=E5=8D=95=E7=8B=AC=E8=BF=90=E8=A1=8C=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liwuli --- .../enterprise_device_mgr_ability_test.cpp | 4 ++++ test/unittest/enterprise_device_mgr_proxy/BUILD.gn | 1 + .../enterprise_device_mgr_proxy_test.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/test/unittest/enterprise_device_mgr_ability/enterprise_device_mgr_ability_test/enterprise_device_mgr_ability_test.cpp b/test/unittest/enterprise_device_mgr_ability/enterprise_device_mgr_ability_test/enterprise_device_mgr_ability_test.cpp index 0893256ab..e9b61f74f 100644 --- a/test/unittest/enterprise_device_mgr_ability/enterprise_device_mgr_ability_test/enterprise_device_mgr_ability_test.cpp +++ b/test/unittest/enterprise_device_mgr_ability/enterprise_device_mgr_ability_test/enterprise_device_mgr_ability_test.cpp @@ -455,6 +455,7 @@ HWTEST_F(EnterpriseDeviceMgrAbilityTest, TestDisableSuperAdminIpcFail, TestSize. // the same edmMgr_->adminMgr_ two super admin res = edmMgr_->adminMgr_->DeleteAdmin(bundleName, DEFAULT_USER_ID); + Utils::SetEdmServiceDisable(); EXPECT_TRUE(res == ERR_OK); } @@ -570,6 +571,7 @@ HWTEST_F(EnterpriseDeviceMgrAbilityTest, TestSetEnterpriseInfoNoSame, TestSize.L // the same edmMgr_->adminMgr_ two super admin res = edmMgr_->adminMgr_->DeleteAdmin(bundleName, DEFAULT_USER_ID); + Utils::SetEdmServiceDisable(); EXPECT_TRUE(res == ERR_OK); } @@ -837,6 +839,8 @@ HWTEST_F(EnterpriseDeviceMgrAbilityTest, TestSubscribeManagedEventIpcFail, TestS EXPECT_TRUE(res == ERR_OK); res = edmMgr_->SubscribeManagedEvent(admin, event); EXPECT_TRUE(res == EdmReturnErrCode::PERMISSION_DENIED); + res = edmMgr_->DisableAdmin(admin, DEFAULT_USER_ID); + EXPECT_TRUE(res == ERR_OK); Utils::ResetTokenTypeAndUid(); } diff --git a/test/unittest/enterprise_device_mgr_proxy/BUILD.gn b/test/unittest/enterprise_device_mgr_proxy/BUILD.gn index 1a7d911cc..e783e5caa 100644 --- a/test/unittest/enterprise_device_mgr_proxy/BUILD.gn +++ b/test/unittest/enterprise_device_mgr_proxy/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("EdmDeviceMgrProxyUnitTest") { "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", + "init:libbegetutil", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/test/unittest/enterprise_device_mgr_proxy/enterprise_device_mgr_proxy_test/enterprise_device_mgr_proxy_test.cpp b/test/unittest/enterprise_device_mgr_proxy/enterprise_device_mgr_proxy_test/enterprise_device_mgr_proxy_test.cpp index 0eb8f87f3..7cef4be3d 100644 --- a/test/unittest/enterprise_device_mgr_proxy/enterprise_device_mgr_proxy_test/enterprise_device_mgr_proxy_test.cpp +++ b/test/unittest/enterprise_device_mgr_proxy/enterprise_device_mgr_proxy_test/enterprise_device_mgr_proxy_test.cpp @@ -54,6 +54,7 @@ void EnterpriseDeviceMgrProxyTest::SetUp() edmSysManager_ = std::make_shared(); object_ = new (std::nothrow) EnterpriseDeviceMgrStubMock(); edmSysManager_->RegisterSystemAbilityOfRemoteObject(ENTERPRISE_DEVICE_MANAGER_SA_ID, object_); + Utils::SetEdmServiceEnable(); } void EnterpriseDeviceMgrProxyTest::TearDown() @@ -61,6 +62,7 @@ void EnterpriseDeviceMgrProxyTest::TearDown() EnterpriseDeviceMgrProxy::DestroyInstance(); edmSysManager_->UnregisterSystemAbilityOfRemoteObject(ENTERPRISE_DEVICE_MANAGER_SA_ID); object_ = nullptr; + Utils::SetEdmServiceDisable(); } /** -- Gitee