From 18ed2dedd67bc2bc3545c5048386bcf2100a6617 Mon Sep 17 00:00:00 2001 From: wangyang2022 Date: Sat, 30 Apr 2022 08:47:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20CheckDPermission=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=20Signed-off-by:=20wangyang2022=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../distributed_sched_permission_test.cpp | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/services/dtbschedmgr/test/unittest/distributed_sched_permission_test.cpp b/services/dtbschedmgr/test/unittest/distributed_sched_permission_test.cpp index 54d8c6c..3dccb2f 100644 --- a/services/dtbschedmgr/test/unittest/distributed_sched_permission_test.cpp +++ b/services/dtbschedmgr/test/unittest/distributed_sched_permission_test.cpp @@ -61,11 +61,10 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_001, TestSize.Level0) CallerInfo callerInfo; IDistributedSched::AccountInfo accountInfo; accountInfo.accountType = IDistributedSched::DIFF_ACCOUNT_TYPE; - AppExecFwk::AbilityInfo abilityInfo; - abilityInfo.visible = true; + bool needQueryExtension = false; std::string localDeviceId = "255.255.255.255"; int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, - callerInfo, accountInfo, abilityInfo, localDeviceId); + callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret != ERR_OK); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_001 end ret:" << ret << std::endl; } @@ -82,7 +81,7 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_002, TestSize.Level0) CallerInfo callerInfo; IDistributedSched::AccountInfo accountInfo; accountInfo.accountType = IDistributedSched::DIFF_ACCOUNT_TYPE; - bool needQueryExtension = false; + bool needQueryExtension = true; std::string localDeviceId = "255.255.255.255"; int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, needQueryExtension, localDeviceId); @@ -102,11 +101,10 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_003, TestSize.Level0) CallerInfo callerInfo; IDistributedSched::AccountInfo accountInfo; accountInfo.accountType = IDistributedSched::DIFF_ACCOUNT_TYPE; - AppExecFwk::AbilityInfo abilityInfo; - abilityInfo.visible = true; + bool needQueryExtension = false; std::string localDeviceId = ""; int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, - callerInfo, accountInfo, abilityInfo, localDeviceId); + callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret == INVALID_PARAMETERS_ERR); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_003 end ret:" << ret << std::endl; } @@ -123,11 +121,10 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_004, TestSize.Level0) CallerInfo callerInfo; IDistributedSched::AccountInfo accountInfo; accountInfo.accountType = IDistributedSched::DIFF_ACCOUNT_TYPE; - AppExecFwk::AbilityInfo abilityInfo; - abilityInfo.visible = false; + bool needQueryExtension = true; std::string localDeviceId = ""; int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, - callerInfo, accountInfo, abilityInfo, localDeviceId); + callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret == INVALID_PARAMETERS_ERR); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_004 end ret:" << ret << std::endl; } @@ -145,9 +142,9 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_005, TestSize.Level0) CallerInfo callerInfo; callerInfo.accessToken = 0; IDistributedSched::AccountInfo accountInfo; - AppExecFwk::AbilityInfo abilityInfo; + bool needQueryExtension = false; std::string localDeviceId = "255.255.255.255"; - int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, abilityInfo, + int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret != ERR_OK); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_005 end result:" << ret << std::endl; @@ -167,9 +164,9 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_006, TestSize.Level1) callerInfo.accessToken = 0; IDistributedSched::AccountInfo accountInfo; accountInfo.accountType = IDistributedSched::DIFF_ACCOUNT_TYPE; - AppExecFwk::AbilityInfo abilityInfo; + bool needQueryExtension = false; string localDeviceId = "255.255.255.255"; - int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, abilityInfo, + int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret != ERR_OK); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_006 end result:" << ret << std::endl; @@ -188,10 +185,9 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_007, TestSize.Level1) CallerInfo callerInfo; callerInfo.accessToken = 0; IDistributedSched::AccountInfo accountInfo; - AppExecFwk::AbilityInfo abilityInfo; - abilityInfo.visible = true; + bool needQueryExtension = false; string localDeviceId = "255.255.255.255"; - int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, abilityInfo, + int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret != ERR_OK); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_007 end result:" << ret << std::endl; @@ -211,9 +207,9 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_008, TestSize.Level0) callerInfo.accessToken = 0; IDistributedSched::AccountInfo accountInfo; accountInfo.accountType = IDistributedSched::SAME_ACCOUNT_TYPE; - AppExecFwk::AbilityInfo abilityInfo; + bool needQueryExtension = false; string localDeviceId = "255.255.255.255"; - int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, abilityInfo, + int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret != ERR_OK); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_008 end result:" << ret << std::endl; @@ -235,10 +231,9 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_009, TestSize.Level1) accountInfo.accountType = IDistributedSched::DIFF_ACCOUNT_TYPE; std::string groupId = GROUP_ID; accountInfo.groupIdList.push_back(groupId); - AppExecFwk::AbilityInfo abilityInfo; - abilityInfo.visible = true; + bool needQueryExtension = false; string localDeviceId = "255.255.255.255"; - int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, abilityInfo, + int32_t ret = DistributedSchedPermission::GetInstance().CheckDPermission(want, callerInfo, accountInfo, needQueryExtension, localDeviceId); EXPECT_TRUE(ret != ERR_OK); DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_009 end result:" << ret << std::endl;