已合并
fix: 按照不继承权限修改 #2951
fan-jingle创建于 14 天前
fix: 按照不继承权限修改 #2951
已合并
共 3 个文件变更+86-281
| @@ -86,12 +86,6 @@ static const PermissionCapabilityMap g_permissionCapabilityMap[] = { | |||
| 86 | {"ohos.permission.kernel.NET_RAW", CAP_NET_RAW}, | 86 | {"ohos.permission.kernel.NET_RAW", CAP_NET_RAW}, |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | -typedef struct { | ||
| 90 | - uint64_t caps; | ||
| 91 | - int capValues[ARRAY_LENGTH(g_permissionCapabilityMap)]; | ||
| 92 | - int capCount; | ||
| 93 | -} ExtPermResult; | ||
| 94 | - | ||
| 95 | int __attribute__((weak)) SetUserId(char *userIdStr) | 89 | int __attribute__((weak)) SetUserId(char *userIdStr) |
| 96 | { | 90 | { |
| 97 | APPSPAWN_LOGV("SetUserId called (weak implementation)"); | 91 | APPSPAWN_LOGV("SetUserId called (weak implementation)"); |
| @@ -154,67 +148,49 @@ static int SetAmbientCapability(int cap) | |||
| 154 | return 0; | 148 | return 0; |
| 155 | } | 149 | } |
| 156 | 150 | ||
| 157 | -APPSPAWN_STATIC void MatchPermToCap(const char *permName, ExtPermResult *result) | 151 | +APPSPAWN_STATIC void MatchPermToCap(const char *permName, uint64_t *caps) |
| 158 | { | 152 | { |
| 159 | for (size_t j = 0; j < ARRAY_LENGTH(g_permissionCapabilityMap); j++) { | 153 | for (size_t j = 0; j < ARRAY_LENGTH(g_permissionCapabilityMap); j++) { |
| 160 | if (strcmp(permName, g_permissionCapabilityMap[j].permissionName) != 0) { | 154 | if (strcmp(permName, g_permissionCapabilityMap[j].permissionName) != 0) { |
| 161 | continue; | 155 | continue; |
| 162 | } | 156 | } |
| 163 | - result->caps |= CAP_TO_MASK(g_permissionCapabilityMap[j].capability); | 157 | + *caps |= CAP_TO_MASK(g_permissionCapabilityMap[j].capability); |
| 164 | - APPSPAWN_LOGV("SetExtPermAmbient Permission %{public}s maps to cap %{public}d", | 158 | + APPSPAWN_LOGV("MatchPermToCap Permission %{public}s maps to cap %{public}d", |
| 165 | permName, g_permissionCapabilityMap[j].capability); | 159 | permName, g_permissionCapabilityMap[j].capability); |
| 166 | - if (result->capCount < (int)ARRAY_LENGTH(g_permissionCapabilityMap)) { | ||
| 167 | - result->capValues[result->capCount++] = g_permissionCapabilityMap[j].capability; | ||
| 168 | - } | ||
| 169 | break; | 160 | break; |
| 170 | } | 161 | } |
| 171 | } | 162 | } |
| 172 | 163 | ||
| 173 | -APPSPAWN_STATIC void GetExtPermResult(const AppSpawningCtx *property, ExtPermResult *result) | 164 | +APPSPAWN_STATIC uint64_t GetExtPermResult(const AppSpawningCtx *property) |
| 174 | { | 165 | { |
| 175 | - if (property == NULL || result == NULL) { | 166 | + uint64_t caps = 0; |
| 176 | - return; | 167 | + APPSPAWN_CHECK_ONLY_EXPER(property != NULL, return 0); |
| 177 | - } | ||
| 178 | - result->caps = 0; | ||
| 179 | - result->capCount = 0; | ||
| 180 | uint32_t size = 0; | 168 | uint32_t size = 0; |
| 181 | char *extInfo = (char *)(GetAppSpawnMsgExtInfo(property->message, | 169 | char *extInfo = (char *)(GetAppSpawnMsgExtInfo(property->message, |
| 182 | MSG_EXT_NAME_JIT_PERMISSIONS, &size)); | 170 | MSG_EXT_NAME_JIT_PERMISSIONS, &size)); |
| 183 | - APPSPAWN_CHECK_ONLY_EXPER(size != 0 && extInfo != NULL, return); | 171 | + APPSPAWN_CHECK_ONLY_EXPER(size != 0 && extInfo != NULL, return 0); |
| 184 | APPSPAWN_LOGV("GetExtPermResult: %{public}s", extInfo); | 172 | APPSPAWN_LOGV("GetExtPermResult: %{public}s", extInfo); |
| 185 | cJSON *extInfoJson = cJSON_Parse(extInfo); | 173 | cJSON *extInfoJson = cJSON_Parse(extInfo); |
| 186 | - APPSPAWN_CHECK(extInfoJson != NULL, return, | 174 | + APPSPAWN_CHECK(extInfoJson != NULL, return 0, |
| 187 | "GetExtPermResult: Invalid ext info for %{public}s", MSG_EXT_NAME_JIT_PERMISSIONS); | 175 | "GetExtPermResult: Invalid ext info for %{public}s", MSG_EXT_NAME_JIT_PERMISSIONS); |
| 188 | - | 176 | + |
| 189 | cJSON *permissionsArray = cJSON_GetObjectItemCaseSensitive(extInfoJson, "permissions"); | 177 | cJSON *permissionsArray = cJSON_GetObjectItemCaseSensitive(extInfoJson, "permissions"); |
| 190 | if (permissionsArray == NULL || !cJSON_IsArray(permissionsArray)) { | 178 | if (permissionsArray == NULL || !cJSON_IsArray(permissionsArray)) { |
| 191 | cJSON_Delete(extInfoJson); | 179 | cJSON_Delete(extInfoJson); |
| 192 | - return; | 180 | + return 0; |
| 193 | } | 181 | } |
| 194 | int count = cJSON_GetArraySize(permissionsArray); | 182 | int count = cJSON_GetArraySize(permissionsArray); |
| 195 | 183 | ||
| 196 | for (int i = 0; i < count; i++) { | 184 | for (int i = 0; i < count; i++) { |
| 197 | cJSON *permItem = cJSON_GetArrayItem(permissionsArray, i); | 185 | cJSON *permItem = cJSON_GetArrayItem(permissionsArray, i); |
| 198 | APPSPAWN_CHECK_ONLY_EXPER(permItem != NULL && permItem->child != NULL, continue); | 186 | APPSPAWN_CHECK_ONLY_EXPER(permItem != NULL && permItem->child != NULL, continue); |
| 199 | - MatchPermToCap(permItem->child->string, result); | 187 | + MatchPermToCap(permItem->child->string, &caps); |
| 200 | } | 188 | } |
| 201 | cJSON_Delete(extInfoJson); | 189 | cJSON_Delete(extInfoJson); |
| 190 | + return caps; | ||
| 202 | } | 191 | } |
| 203 | 192 | ||
| 204 | -APPSPAWN_STATIC int SetExtPermAmbientFromResult(const ExtPermResult *result) | 193 | +APPSPAWN_STATIC int SetAmbientCapabilities(const AppSpawningCtx *property) |
| 205 | -{ | ||
| 206 | - if (result == NULL) { | ||
| 207 | - return 0; | ||
| 208 | - } | ||
| 209 | - for (int i = 0; i < result->capCount; i++) { | ||
| 210 | - APPSPAWN_CHECK(SetAmbientCapability(result->capValues[i]) == 0, | ||
| 211 | - return -1, "SetExtPermAmbientFromResult set ambient failed:%{public}d", result->capValues[i]); | ||
| 212 | - } | ||
| 213 | - return 0; | ||
| 214 | -} | ||
| 215 | - | ||
| 216 | - | ||
| 217 | -APPSPAWN_STATIC int SetAmbientCapabilities(const AppSpawningCtx *property, const ExtPermResult *result) | ||
| 218 | { | 194 | { |
| 219 | if (!IsNoShareFsEnable()) { | 195 | if (!IsNoShareFsEnable()) { |
| 220 | return 0; | 196 | return 0; |
| @@ -231,9 +207,7 @@ APPSPAWN_STATIC int SetAmbientCapabilities(const AppSpawningCtx *property, const | |||
| 231 | if (CheckAppMsgFlagsSet(property, APP_FLAGS_SET_CAPS_FOWNER)) { | 207 | if (CheckAppMsgFlagsSet(property, APP_FLAGS_SET_CAPS_FOWNER)) { |
| 232 | APPSPAWN_CHECK(SetAmbientCapability(CAP_FOWNER) == 0, return -1, "set ambient failed:%{public}d", CAP_FOWNER); | 208 | APPSPAWN_CHECK(SetAmbientCapability(CAP_FOWNER) == 0, return -1, "set ambient failed:%{public}d", CAP_FOWNER); |
| 233 | } | 209 | } |
| 234 | - | 210 | + return 0; |
| 235 | - int ret = SetExtPermAmbientFromResult(result); | ||
| 236 | - return ret; | ||
| 237 | } | 211 | } |
| 238 | 212 | ||
| 239 | APPSPAWN_STATIC int SetCapabilities(const AppSpawnMgr *content, const AppSpawningCtx *property) | 213 | APPSPAWN_STATIC int SetCapabilities(const AppSpawnMgr *content, const AppSpawningCtx *property) |
| @@ -251,9 +225,9 @@ APPSPAWN_STATIC int SetCapabilities(const AppSpawnMgr *content, const AppSpawnin | |||
| 251 | bool needExtPerm = IsNoShareFsEnable() && | 225 | bool needExtPerm = IsNoShareFsEnable() && |
| 252 | !CheckAppMsgFlagsSet(property, APP_FLAGS_ISOLATED_SANDBOX_TYPE) && | 226 | !CheckAppMsgFlagsSet(property, APP_FLAGS_ISOLATED_SANDBOX_TYPE) && |
| 253 | (IsAppSpawnMode(content) || IsNativeSpawnMode(content)); | 227 | (IsAppSpawnMode(content) || IsNativeSpawnMode(content)); |
| 254 | - ExtPermResult extResult = {0}; | 228 | + uint64_t extPermCaps = 0; |
| 255 | if (needExtPerm) { | 229 | if (needExtPerm) { |
| 256 | - GetExtPermResult(property, &extResult); | 230 | + extPermCaps = GetExtPermResult(property); |
| 257 | } | 231 | } |
| 258 | // init inheritable permitted effective zero | 232 | // init inheritable permitted effective zero |
| 259 | 233 | ||
| @@ -262,7 +236,7 @@ APPSPAWN_STATIC int SetCapabilities(const AppSpawnMgr *content, const AppSpawnin | |||
| 262 | baseCaps = CAP_TO_MASK(CAP_DAC_OVERRIDE); | 236 | baseCaps = CAP_TO_MASK(CAP_DAC_OVERRIDE); |
| 263 | baseCaps |= CheckAppMsgFlagsSet(property, APP_FLAGS_CUSTOM_SANDBOX) ? CAP_TO_MASK(CAP_KILL) : 0; | 237 | baseCaps |= CheckAppMsgFlagsSet(property, APP_FLAGS_CUSTOM_SANDBOX) ? CAP_TO_MASK(CAP_KILL) : 0; |
| 264 | baseCaps |= CheckAppMsgFlagsSet(property, APP_FLAGS_SET_CAPS_FOWNER) ? CAP_TO_MASK(CAP_FOWNER) : 0; | 238 | baseCaps |= CheckAppMsgFlagsSet(property, APP_FLAGS_SET_CAPS_FOWNER) ? CAP_TO_MASK(CAP_FOWNER) : 0; |
| 265 | - baseCaps |= extResult.caps; | 239 | + baseCaps |= extPermCaps; |
| 266 | } | 240 | } |
| 267 | const uint64_t inheriTable = baseCaps; | 241 | const uint64_t inheriTable = baseCaps; |
| 268 | const uint64_t permitted = baseCaps; | 242 | const uint64_t permitted = baseCaps; |
| @@ -282,7 +256,7 @@ APPSPAWN_STATIC int SetCapabilities(const AppSpawnMgr *content, const AppSpawnin | |||
| 282 | APPSPAWN_CHECK(!isRet, return -errno, "Failed to capset errno: %{public}d", errno); | 256 | APPSPAWN_CHECK(!isRet, return -errno, "Failed to capset errno: %{public}d", errno); |
| 283 | 257 | ||
| 284 | if (needExtPerm) { | 258 | if (needExtPerm) { |
| 285 | - isRet = SetAmbientCapabilities(property, &extResult); | 259 | + isRet = SetAmbientCapabilities(property); |
| 286 | APPSPAWN_CHECK(!isRet, return -1, "Failed to set ambient"); | 260 | APPSPAWN_CHECK(!isRet, return -1, "Failed to set ambient"); |
| 287 | } | 261 | } |
| 288 | return 0; | 262 | return 0; |
| @@ -68,12 +68,6 @@ typedef struct TagAppSpawnNamespace { | |||
| 68 | int nsInitPidFd; | 68 | int nsInitPidFd; |
| 69 | } AppSpawnNamespace; | 69 | } AppSpawnNamespace; |
| 70 | 70 | ||
| 71 | -// Extended permission result structure for JIT permissions | ||
| 72 | -typedef struct { | ||
| 73 | - uint64_t caps; | ||
| 74 | - int capValues[1]; // Support multiple permissions including duplicates for testing | ||
| 75 | - int capCount; | ||
| 76 | -} ExtPermResult; | ||
| 77 | typedef struct TagAppSpawnedProcess AppSpawnedProcessInfo; | 71 | typedef struct TagAppSpawnedProcess AppSpawnedProcessInfo; |
| 78 | 72 | ||
| 79 | void SetMockDlprelinkReserveMemFailed(bool v); | 73 | void SetMockDlprelinkReserveMemFailed(bool v); |
| @@ -165,9 +159,8 @@ int AddPermissionStrArrayToValue(cJSON *arrayItem, UserEncap *encap); | |||
| 165 | int AddPermissionArrayToValue(cJSON *permissionItemArr, UserEncap *encap); | 159 | int AddPermissionArrayToValue(cJSON *permissionItemArr, UserEncap *encap); |
| 166 | int SetSchedPriority(const AppSpawnMgr *content, const AppSpawningCtx *property); | 160 | int SetSchedPriority(const AppSpawnMgr *content, const AppSpawningCtx *property); |
| 167 | int SetUidGid(const AppSpawnMgr *content, const AppSpawningCtx *property); | 161 | int SetUidGid(const AppSpawnMgr *content, const AppSpawningCtx *property); |
| 168 | -int SetAmbientCapabilities(const AppSpawningCtx *property, const ExtPermResult *result); | 162 | +int SetAmbientCapabilities(const AppSpawningCtx *property); |
| 169 | -void GetExtPermResult(const AppSpawningCtx *property, ExtPermResult *result); | 163 | +uint64_t GetExtPermResult(const AppSpawningCtx *property); |
| 170 | -int SetExtPermAmbientFromResult(const ExtPermResult *result); | ||
| 171 | void SetPrctlResult(int result); | 164 | void SetPrctlResult(int result); |
| 172 | int PrctlStub(int option, ...); | 165 | int PrctlStub(int option, ...); |
| 173 | int KillStub(pid_t pid, int sig); | 166 | int KillStub(pid_t pid, int sig); |
| @@ -2385,7 +2385,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_01, TestSize.Level | |||
| 2385 | AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_ISOLATED_SANDBOX_TYPE); | 2385 | AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_ISOLATED_SANDBOX_TYPE); |
| 2386 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2386 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2387 | APPSPAWN_CHECK_ONLY_EXPER(property != nullptr, break); | 2387 | APPSPAWN_CHECK_ONLY_EXPER(property != nullptr, break); |
| 2388 | - ret = SetAmbientCapabilities(property, nullptr); | 2388 | + ret = SetAmbientCapabilities(property); |
| 2389 | } while (0); | 2389 | } while (0); |
| 2390 | DeleteAppSpawningCtx(property); | 2390 | DeleteAppSpawningCtx(property); |
| 2391 | AppSpawnClientDestroy(clientHandle); | 2391 | AppSpawnClientDestroy(clientHandle); |
| @@ -2416,7 +2416,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_02, TestSize.Level | |||
| 2416 | AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_SET_CAPS_FOWNER); | 2416 | AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_SET_CAPS_FOWNER); |
| 2417 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2417 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2418 | APPSPAWN_CHECK_ONLY_EXPER(property != nullptr, break); | 2418 | APPSPAWN_CHECK_ONLY_EXPER(property != nullptr, break); |
| 2419 | - ret = SetAmbientCapabilities(property, nullptr); | 2419 | + ret = SetAmbientCapabilities(property); |
| 2420 | } while (0); | 2420 | } while (0); |
| 2421 | DeleteAppSpawningCtx(property); | 2421 | DeleteAppSpawningCtx(property); |
| 2422 | AppSpawnClientDestroy(clientHandle); | 2422 | AppSpawnClientDestroy(clientHandle); |
| @@ -2447,7 +2447,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_03, TestSize.Level | |||
| 2447 | AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_CUSTOM_SANDBOX); | 2447 | AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_CUSTOM_SANDBOX); |
| 2448 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2448 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2449 | APPSPAWN_CHECK_ONLY_EXPER(property != nullptr, break); | 2449 | APPSPAWN_CHECK_ONLY_EXPER(property != nullptr, break); |
| 2450 | - ret = SetAmbientCapabilities(property, nullptr); | 2450 | + ret = SetAmbientCapabilities(property); |
| 2451 | } while (0); | 2451 | } while (0); |
| 2452 | DeleteAppSpawningCtx(property); | 2452 | DeleteAppSpawningCtx(property); |
| 2453 | AppSpawnClientDestroy(clientHandle); | 2453 | AppSpawnClientDestroy(clientHandle); |
| @@ -2732,61 +2732,25 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetUidGid_008, TestSize.Level0) | |||
| 2732 | // ============================================================================ | 2732 | // ============================================================================ |
| 2733 | // UT Test Cases for Extended Permission Capability Feature | 2733 | // UT Test Cases for Extended Permission Capability Feature |
| 2734 | // Feature: Add JIT permission support for kernel capabilities (NET_RAW) | 2734 | // Feature: Add JIT permission support for kernel capabilities (NET_RAW) |
| 2735 | -// Added functions: GetExtPermResult, SetExtPermAmbientFromResult | 2735 | +// Added functions: GetExtPermResult |
| 2736 | // Modified functions: SetAmbientCapabilities, SetCapabilities | 2736 | // Modified functions: SetAmbientCapabilities, SetCapabilities |
| 2737 | // ============================================================================ | 2737 | // ============================================================================ |
| 2738 | 2738 | ||
| 2739 | -/** | ||
| 2740 | - * @brief Test GetExtPermResult with NULL result parameter | ||
| 2741 | - * Expected: Function returns immediately without crash | ||
| 2742 | - * Branch: result == NULL (line 159) | ||
| 2743 | - */ | ||
| 2744 | -HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_001, TestSize.Level0) | ||
| 2745 | -{ | ||
| 2746 | - AppSpawnClientHandle clientHandle = nullptr; | ||
| 2747 | - AppSpawningCtx *property = nullptr; | ||
| 2748 | - int ret = -1; | ||
| 2749 | - do { | ||
| 2750 | - ret = AppSpawnClientInit(APPSPAWN_SERVER_NAME, &clientHandle); | ||
| 2751 | - APPSPAWN_CHECK(ret == 0, break, "Failed to create client"); | ||
| 2752 | - | ||
| 2753 | - AppSpawnReqMsgHandle reqHandle = g_testHelper.CreateMsg(clientHandle, MSG_APP_SPAWN, 0); | ||
| 2754 | - APPSPAWN_CHECK(reqHandle != INVALID_REQ_HANDLE, break, "Failed to create msg"); | ||
| 2755 | - | ||
| 2756 | - property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | ||
| 2757 | - APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | ||
| 2758 | - | ||
| 2759 | - // Call with NULL result - should not crash | ||
| 2760 | - GetExtPermResult(property, nullptr); | ||
| 2761 | - ret = 0; | ||
| 2762 | - } while (0); | ||
| 2763 | - DeleteAppSpawningCtx(property); | ||
| 2764 | - AppSpawnClientDestroy(clientHandle); | ||
| 2765 | - ASSERT_EQ(ret, 0); | ||
| 2766 | -} | ||
| 2767 | - | ||
| 2768 | /** | 2739 | /** |
| 2769 | * @brief Test GetExtPermResult with NULL property | 2740 | * @brief Test GetExtPermResult with NULL property |
| 2770 | - * Expected: Result is initialized to zero | 2741 | + * Expected: Returns 0 |
| 2771 | - * Branch: property->message check fails (line 165-167) | 2742 | + * Branch: property == NULL |
| 2772 | */ | 2743 | */ |
| 2773 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_002, TestSize.Level0) | 2744 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_002, TestSize.Level0) |
| 2774 | { | 2745 | { |
| 2775 | - ExtPermResult result; | 2746 | + uint64_t caps = GetExtPermResult(nullptr); |
| 2776 | - result.caps = 0xFFFFFFFFFFFFFFFFULL; | 2747 | + EXPECT_EQ(caps, 0ULL); |
| 2777 | - result.capCount = 999; | ||
| 2778 | - result.capValues[0] = 12345; | ||
| 2779 | - | ||
| 2780 | - GetExtPermResult(nullptr, &result); | ||
| 2781 | - | ||
| 2782 | - EXPECT_EQ(result.caps, 0xFFFFFFFFFFFFFFFFULL); | ||
| 2783 | - EXPECT_EQ(result.capCount, 999); | ||
| 2784 | } | 2748 | } |
| 2785 | 2749 | ||
| 2786 | /** | 2750 | /** |
| 2787 | * @brief Test GetExtPermResult with no JIT permissions in message | 2751 | * @brief Test GetExtPermResult with no JIT permissions in message |
| 2788 | * Expected: Result remains empty | 2752 | * Expected: Result remains empty |
| 2789 | - * Branch: extInfo == NULL or size == 0 (line 167) | 2753 | + * Branch: extInfo == NULL or size == 0 |
| 2790 | */ | 2754 | */ |
| 2791 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_003, TestSize.Level0) | 2755 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_003, TestSize.Level0) |
| 2792 | { | 2756 | { |
| @@ -2803,14 +2767,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_003, TestSize.Level0) | |||
| 2803 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2767 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2804 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 2768 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 2805 | 2769 | ||
| 2806 | - ExtPermResult result = {0}; | 2770 | + uint64_t caps = GetExtPermResult(property); |
| 2807 | - result.caps = 0xDEADBEEF; | ||
| 2808 | - result.capCount = 777; | ||
| 2809 | 2771 | ||
| 2810 | - GetExtPermResult(property, &result); | 2772 | + EXPECT_EQ(caps, 0ULL); |
| 2811 | - | ||
| 2812 | - EXPECT_EQ(result.caps, 0ULL); | ||
| 2813 | - EXPECT_EQ(result.capCount, 0); | ||
| 2814 | ret = 0; | 2773 | ret = 0; |
| 2815 | } while (0); | 2774 | } while (0); |
| 2816 | DeleteAppSpawningCtx(property); | 2775 | DeleteAppSpawningCtx(property); |
| @@ -2821,7 +2780,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_003, TestSize.Level0) | |||
| 2821 | /** | 2780 | /** |
| 2822 | * @brief Test GetExtPermResult with invalid JSON | 2781 | * @brief Test GetExtPermResult with invalid JSON |
| 2823 | * Expected: Result is reset to zero | 2782 | * Expected: Result is reset to zero |
| 2824 | - * Branch: cJSON_Parse returns NULL (line 170-171) | 2783 | + * Branch: cJSON_Parse returns NULL |
| 2825 | */ | 2784 | */ |
| 2826 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_004, TestSize.Level0) | 2785 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_004, TestSize.Level0) |
| 2827 | { | 2786 | { |
| @@ -2843,13 +2802,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_004, TestSize.Level0) | |||
| 2843 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2802 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2844 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 2803 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 2845 | 2804 | ||
| 2846 | - ExtPermResult result = {0}; | 2805 | + uint64_t caps = GetExtPermResult(property); |
| 2847 | - result.caps = 0xCAFEBABE; | ||
| 2848 | - result.capCount = 555; | ||
| 2849 | 2806 | ||
| 2850 | - GetExtPermResult(property, &result); | 2807 | + EXPECT_EQ(caps, 0ULL); |
| 2851 | - | ||
| 2852 | - EXPECT_EQ(result.capCount, 0); | ||
| 2853 | ret = 0; | 2808 | ret = 0; |
| 2854 | } while (0); | 2809 | } while (0); |
| 2855 | DeleteAppSpawningCtx(property); | 2810 | DeleteAppSpawningCtx(property); |
| @@ -2860,7 +2815,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_004, TestSize.Level0) | |||
| 2860 | /** | 2815 | /** |
| 2861 | * @brief Test GetExtPermResult with JSON but no permissions field | 2816 | * @brief Test GetExtPermResult with JSON but no permissions field |
| 2862 | * Expected: Result is reset to zero | 2817 | * Expected: Result is reset to zero |
| 2863 | - * Branch: permissionsArray == NULL (line 174-176) | 2818 | + * Branch: permissionsArray == NULL |
| 2864 | */ | 2819 | */ |
| 2865 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_005, TestSize.Level0) | 2820 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_005, TestSize.Level0) |
| 2866 | { | 2821 | { |
| @@ -2882,11 +2837,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_005, TestSize.Level0) | |||
| 2882 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2837 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2883 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 2838 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 2884 | 2839 | ||
| 2885 | - ExtPermResult result = {0}; | 2840 | + uint64_t caps = GetExtPermResult(property); |
| 2886 | - GetExtPermResult(property, &result); | ||
| 2887 | 2841 | ||
| 2888 | - EXPECT_EQ(result.caps, 0ULL); | 2842 | + EXPECT_EQ(caps, 0ULL); |
| 2889 | - EXPECT_EQ(result.capCount, 0); | ||
| 2890 | ret = 0; | 2843 | ret = 0; |
| 2891 | } while (0); | 2844 | } while (0); |
| 2892 | DeleteAppSpawningCtx(property); | 2845 | DeleteAppSpawningCtx(property); |
| @@ -2897,7 +2850,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_005, TestSize.Level0) | |||
| 2897 | /** | 2850 | /** |
| 2898 | * @brief Test GetExtPermResult with permissions field as object instead of array | 2851 | * @brief Test GetExtPermResult with permissions field as object instead of array |
| 2899 | * Expected: Result is reset to zero | 2852 | * Expected: Result is reset to zero |
| 2900 | - * Branch: !cJSON_IsArray (line 174-176) | 2853 | + * Branch: !cJSON_IsArray |
| 2901 | */ | 2854 | */ |
| 2902 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_006, TestSize.Level0) | 2855 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_006, TestSize.Level0) |
| 2903 | { | 2856 | { |
| @@ -2919,11 +2872,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_006, TestSize.Level0) | |||
| 2919 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2872 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2920 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 2873 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 2921 | 2874 | ||
| 2922 | - ExtPermResult result = {0}; | 2875 | + uint64_t caps = GetExtPermResult(property); |
| 2923 | - GetExtPermResult(property, &result); | ||
| 2924 | 2876 | ||
| 2925 | - EXPECT_EQ(result.caps, 0ULL); | 2877 | + EXPECT_EQ(caps, 0ULL); |
| 2926 | - EXPECT_EQ(result.capCount, 0); | ||
| 2927 | ret = 0; | 2878 | ret = 0; |
| 2928 | } while (0); | 2879 | } while (0); |
| 2929 | DeleteAppSpawningCtx(property); | 2880 | DeleteAppSpawningCtx(property); |
| @@ -2934,7 +2885,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_006, TestSize.Level0) | |||
| 2934 | /** | 2885 | /** |
| 2935 | * @brief Test GetExtPermResult with empty permissions array | 2886 | * @brief Test GetExtPermResult with empty permissions array |
| 2936 | * Expected: Result is empty | 2887 | * Expected: Result is empty |
| 2937 | - * Branch: count == 0, loop doesn't execute (line 178-193) | 2888 | + * Branch: count == 0, loop doesn't execute |
| 2938 | */ | 2889 | */ |
| 2939 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_007, TestSize.Level0) | 2890 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_007, TestSize.Level0) |
| 2940 | { | 2891 | { |
| @@ -2956,11 +2907,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_007, TestSize.Level0) | |||
| 2956 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2907 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2957 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 2908 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 2958 | 2909 | ||
| 2959 | - ExtPermResult result = {0}; | 2910 | + uint64_t caps = GetExtPermResult(property); |
| 2960 | - GetExtPermResult(property, &result); | ||
| 2961 | 2911 | ||
| 2962 | - EXPECT_EQ(result.caps, 0ULL); | 2912 | + EXPECT_EQ(caps, 0ULL); |
| 2963 | - EXPECT_EQ(result.capCount, 0); | ||
| 2964 | ret = 0; | 2913 | ret = 0; |
| 2965 | } while (0); | 2914 | } while (0); |
| 2966 | DeleteAppSpawningCtx(property); | 2915 | DeleteAppSpawningCtx(property); |
| @@ -2971,7 +2920,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_007, TestSize.Level0) | |||
| 2971 | /** | 2920 | /** |
| 2972 | * @brief Test GetExtPermResult with valid NET_RAW permission | 2921 | * @brief Test GetExtPermResult with valid NET_RAW permission |
| 2973 | * Expected: Result contains CAP_NET_RAW | 2922 | * Expected: Result contains CAP_NET_RAW |
| 2974 | - * Branch: Successful parsing and mapping (line 185-190) | 2923 | + * Branch: Successful parsing and mapping |
| 2975 | */ | 2924 | */ |
| 2976 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_008, TestSize.Level0) | 2925 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_008, TestSize.Level0) |
| 2977 | { | 2926 | { |
| @@ -2993,12 +2942,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_008, TestSize.Level0) | |||
| 2993 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2942 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 2994 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 2943 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 2995 | 2944 | ||
| 2996 | - ExtPermResult result = {0}; | 2945 | + uint64_t caps = GetExtPermResult(property); |
| 2997 | - GetExtPermResult(property, &result); | ||
| 2998 | 2946 | ||
| 2999 | - EXPECT_NE(result.caps & CAP_TO_MASK(CAP_NET_RAW), 0ULL); | 2947 | + EXPECT_EQ(caps, (uint64_t)CAP_TO_MASK(CAP_NET_RAW)); |
| 3000 | - EXPECT_EQ(result.capCount, 1); | ||
| 3001 | - EXPECT_EQ(result.capValues[0], CAP_NET_RAW); | ||
| 3002 | ret = 0; | 2948 | ret = 0; |
| 3003 | } while (0); | 2949 | } while (0); |
| 3004 | DeleteAppSpawningCtx(property); | 2950 | DeleteAppSpawningCtx(property); |
| @@ -3009,7 +2955,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_008, TestSize.Level0) | |||
| 3009 | /** | 2955 | /** |
| 3010 | * @brief Test GetExtPermResult with unknown permission | 2956 | * @brief Test GetExtPermResult with unknown permission |
| 3011 | * Expected: Result remains empty | 2957 | * Expected: Result remains empty |
| 3012 | - * Branch: No match in g_permissionCapabilityMap (line 184-192) | 2958 | + * Branch: No match in g_permissionCapabilityMap |
| 3013 | */ | 2959 | */ |
| 3014 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_009, TestSize.Level0) | 2960 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_009, TestSize.Level0) |
| 3015 | { | 2961 | { |
| @@ -3031,11 +2977,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_009, TestSize.Level0) | |||
| 3031 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 2977 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3032 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 2978 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3033 | 2979 | ||
| 3034 | - ExtPermResult result = {0}; | 2980 | + uint64_t caps = GetExtPermResult(property); |
| 3035 | - GetExtPermResult(property, &result); | ||
| 3036 | 2981 | ||
| 3037 | - EXPECT_EQ(result.caps, 0ULL); | 2982 | + EXPECT_EQ(caps, 0ULL); |
| 3038 | - EXPECT_EQ(result.capCount, 0); | ||
| 3039 | ret = 0; | 2983 | ret = 0; |
| 3040 | } while (0); | 2984 | } while (0); |
| 3041 | DeleteAppSpawningCtx(property); | 2985 | DeleteAppSpawningCtx(property); |
| @@ -3046,7 +2990,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_009, TestSize.Level0) | |||
| 3046 | /** | 2990 | /** |
| 3047 | * @brief Test GetExtPermResult with permission item without name | 2991 | * @brief Test GetExtPermResult with permission item without name |
| 3048 | * Expected: Continues to next item | 2992 | * Expected: Continues to next item |
| 3049 | - * Branch: permItem->child == NULL (line 182) | 2993 | + * Branch: permItem->child == NULL |
| 3050 | */ | 2994 | */ |
| 3051 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_010, TestSize.Level0) | 2995 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_010, TestSize.Level0) |
| 3052 | { | 2996 | { |
| @@ -3068,11 +3012,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_010, TestSize.Level0) | |||
| 3068 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3012 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3069 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3013 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3070 | 3014 | ||
| 3071 | - ExtPermResult result = {0}; | 3015 | + uint64_t caps = GetExtPermResult(property); |
| 3072 | - GetExtPermResult(property, &result); | ||
| 3073 | 3016 | ||
| 3074 | - EXPECT_EQ(result.caps, 0ULL); | 3017 | + EXPECT_EQ(caps, 0ULL); |
| 3075 | - EXPECT_EQ(result.capCount, 0); | ||
| 3076 | ret = 0; | 3018 | ret = 0; |
| 3077 | } while (0); | 3019 | } while (0); |
| 3078 | DeleteAppSpawningCtx(property); | 3020 | DeleteAppSpawningCtx(property); |
| @@ -3083,7 +3025,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_010, TestSize.Level0) | |||
| 3083 | /** | 3025 | /** |
| 3084 | * @brief Test GetExtPermResult with mixed valid and invalid permissions | 3026 | * @brief Test GetExtPermResult with mixed valid and invalid permissions |
| 3085 | * Expected: Only valid permissions are parsed | 3027 | * Expected: Only valid permissions are parsed |
| 3086 | - * Branch: Mix of matching and non-matching (line 184-192) | 3028 | + * Branch: Mix of matching and non-matching |
| 3087 | */ | 3029 | */ |
| 3088 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_011, TestSize.Level0) | 3030 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_011, TestSize.Level0) |
| 3089 | { | 3031 | { |
| @@ -3109,11 +3051,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_011, TestSize.Level0) | |||
| 3109 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3051 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3110 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3052 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3111 | 3053 | ||
| 3112 | - ExtPermResult result = {0}; | 3054 | + uint64_t caps = GetExtPermResult(property); |
| 3113 | - GetExtPermResult(property, &result); | ||
| 3114 | 3055 | ||
| 3115 | - EXPECT_NE(result.caps & CAP_TO_MASK(CAP_NET_RAW), 0ULL); | 3056 | + EXPECT_NE(caps & CAP_TO_MASK(CAP_NET_RAW), 0ULL); |
| 3116 | - EXPECT_EQ(result.capCount, 1); | ||
| 3117 | ret = 0; | 3057 | ret = 0; |
| 3118 | } while (0); | 3058 | } while (0); |
| 3119 | DeleteAppSpawningCtx(property); | 3059 | DeleteAppSpawningCtx(property); |
| @@ -3124,7 +3064,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_011, TestSize.Level0) | |||
| 3124 | /** | 3064 | /** |
| 3125 | * @brief Test GetExtPermResult with duplicate NET_RAW permission | 3065 | * @brief Test GetExtPermResult with duplicate NET_RAW permission |
| 3126 | * Expected: CAP_NET_RAW is set once (OR operation) | 3066 | * Expected: CAP_NET_RAW is set once (OR operation) |
| 3127 | - * Branch: Duplicate permission names (line 186) | 3067 | + * Branch: Duplicate permission names |
| 3128 | */ | 3068 | */ |
| 3129 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_012, TestSize.Level0) | 3069 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_012, TestSize.Level0) |
| 3130 | { | 3070 | { |
| @@ -3149,12 +3089,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_012, TestSize.Level0) | |||
| 3149 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3089 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3150 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3090 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3151 | 3091 | ||
| 3152 | - ExtPermResult result = {0}; | 3092 | + uint64_t caps = GetExtPermResult(property); |
| 3153 | - GetExtPermResult(property, &result); | ||
| 3154 | 3093 | ||
| 3155 | - EXPECT_NE(result.caps & CAP_TO_MASK(CAP_NET_RAW), 0ULL); | 3094 | + EXPECT_EQ(caps, (uint64_t)CAP_TO_MASK(CAP_NET_RAW)); |
| 3156 | - EXPECT_EQ(result.capCount, 1); | ||
| 3157 | - EXPECT_EQ(result.capValues[0], CAP_NET_RAW); | ||
| 3158 | ret = 0; | 3095 | ret = 0; |
| 3159 | } while (0); | 3096 | } while (0); |
| 3160 | DeleteAppSpawningCtx(property); | 3097 | DeleteAppSpawningCtx(property); |
| @@ -3165,7 +3102,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_012, TestSize.Level0) | |||
| 3165 | /** | 3102 | /** |
| 3166 | * @brief Test GetExtPermResult with malformed permission object | 3103 | * @brief Test GetExtPermResult with malformed permission object |
| 3167 | * Expected: Continues without error | 3104 | * Expected: Continues without error |
| 3168 | - * Branch: permItem == NULL (line 181-182) | 3105 | + * Branch: permItem == NULL |
| 3169 | */ | 3106 | */ |
| 3170 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_013, TestSize.Level0) | 3107 | HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_013, TestSize.Level0) |
| 3171 | { | 3108 | { |
| @@ -3187,11 +3124,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_013, TestSize.Level0) | |||
| 3187 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3124 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3188 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3125 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3189 | 3126 | ||
| 3190 | - ExtPermResult result = {0}; | 3127 | + uint64_t caps = GetExtPermResult(property); |
| 3191 | - GetExtPermResult(property, &result); | ||
| 3192 | 3128 | ||
| 3193 | - EXPECT_EQ(result.caps, 0ULL); | 3129 | + EXPECT_EQ(caps, 0ULL); |
| 3194 | - EXPECT_EQ(result.capCount, 0); | ||
| 3195 | ret = 0; | 3130 | ret = 0; |
| 3196 | } while (0); | 3131 | } while (0); |
| 3197 | DeleteAppSpawningCtx(property); | 3132 | DeleteAppSpawningCtx(property); |
| @@ -3199,39 +3134,10 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_GetExtPermResult_013, TestSize.Level0) | |||
| 3199 | ASSERT_EQ(ret, 0); | 3134 | ASSERT_EQ(ret, 0); |
| 3200 | } | 3135 | } |
| 3201 | 3136 | ||
| 3202 | -HWTEST_F(AppSpawnCommonTest, App_Spawn_SetExtPermAmbientFromResult_001, TestSize.Level0) | ||
| 3203 | -{ | ||
| 3204 | - int ret = SetExtPermAmbientFromResult(nullptr); | ||
| 3205 | - EXPECT_EQ(ret, 0); | ||
| 3206 | - ExtPermResult result = {0}; | ||
| 3207 | - result.caps = 0; | ||
| 3208 | - result.capCount = 0; | ||
| 3209 | - | ||
| 3210 | - ret = SetExtPermAmbientFromResult(&result); | ||
| 3211 | - EXPECT_EQ(ret, 0); | ||
| 3212 | -} | ||
| 3213 | - | ||
| 3214 | /** | 3137 | /** |
| 3215 | - * @brief Test SetExtPermAmbientFromResult with NET_RAW capability | 3138 | + * @brief Test SetAmbientCapabilities with no flags |
| 3216 | - * Expected: Attempts to set CAP_NET_RAW ambient capability | 3139 | + * Expected: Sets base capabilities (DAC_OVERRIDE) only |
| 3217 | - * Branch: Successful SetAmbientCapability (line 203-204) | 3140 | + * Branch: No additional flags |
| 3218 | - */ | ||
| 3219 | -HWTEST_F(AppSpawnCommonTest, App_Spawn_SetExtPermAmbientFromResult_002, TestSize.Level0) | ||
| 3220 | -{ | ||
| 3221 | - ExtPermResult result = {0}; | ||
| 3222 | - result.caps = CAP_TO_MASK(CAP_NET_RAW); | ||
| 3223 | - result.capValues[0] = CAP_NET_RAW; | ||
| 3224 | - result.capCount = 1; | ||
| 3225 | - | ||
| 3226 | - int ret = SetExtPermAmbientFromResult(&result); | ||
| 3227 | - // In test environment, prctl may be stubbed | ||
| 3228 | - EXPECT_TRUE(ret == 0 || ret == -1); | ||
| 3229 | -} | ||
| 3230 | - | ||
| 3231 | -/** | ||
| 3232 | - * @brief Test SetAmbientCapabilities with NULL result | ||
| 3233 | - * Expected: Sets base capabilities (DAC_OVERRIDE) and flag-based caps | ||
| 3234 | - * Branch: result == NULL, SetExtPermAmbientFromResult skipped (line 228) | ||
| 3235 | */ | 3141 | */ |
| 3236 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_001, TestSize.Level0) | 3142 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_001, TestSize.Level0) |
| 3237 | { | 3143 | { |
| @@ -3249,7 +3155,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_001, TestSize.Leve | |||
| 3249 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3155 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3250 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3156 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3251 | 3157 | ||
| 3252 | - ret = SetAmbientCapabilities(property, nullptr); | 3158 | + ret = SetAmbientCapabilities(property); |
| 3253 | } while (0); | 3159 | } while (0); |
| 3254 | DeleteAppSpawningCtx(property); | 3160 | DeleteAppSpawningCtx(property); |
| 3255 | AppSpawnClientDestroy(clientHandle); | 3161 | AppSpawnClientDestroy(clientHandle); |
| @@ -3259,7 +3165,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_001, TestSize.Leve | |||
| 3259 | /** | 3165 | /** |
| 3260 | * @brief Test SetAmbientCapabilities with CUSTOM_SANDBOX flag | 3166 | * @brief Test SetAmbientCapabilities with CUSTOM_SANDBOX flag |
| 3261 | * Expected: Sets CAP_DAC_OVERRIDE and CAP_KILL | 3167 | * Expected: Sets CAP_DAC_OVERRIDE and CAP_KILL |
| 3262 | - * Branch: CheckAppMsgFlagsSet(CUSTOM_SANDBOX) == true (line 219-221) | 3168 | + * Branch: CheckAppMsgFlagsSet(CUSTOM_SANDBOX) == true |
| 3263 | */ | 3169 | */ |
| 3264 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_002, TestSize.Level0) | 3170 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_002, TestSize.Level0) |
| 3265 | { | 3171 | { |
| @@ -3279,7 +3185,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_002, TestSize.Leve | |||
| 3279 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3185 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3280 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3186 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3281 | 3187 | ||
| 3282 | - ret = SetAmbientCapabilities(property, nullptr); | 3188 | + ret = SetAmbientCapabilities(property); |
| 3283 | } while (0); | 3189 | } while (0); |
| 3284 | DeleteAppSpawningCtx(property); | 3190 | DeleteAppSpawningCtx(property); |
| 3285 | AppSpawnClientDestroy(clientHandle); | 3191 | AppSpawnClientDestroy(clientHandle); |
| @@ -3289,7 +3195,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_002, TestSize.Leve | |||
| 3289 | /** | 3195 | /** |
| 3290 | * @brief Test SetAmbientCapabilities with SET_CAPS_FOWNER flag | 3196 | * @brief Test SetAmbientCapabilities with SET_CAPS_FOWNER flag |
| 3291 | * Expected: Sets CAP_DAC_OVERRIDE and CAP_FOWNER | 3197 | * Expected: Sets CAP_DAC_OVERRIDE and CAP_FOWNER |
| 3292 | - * Branch: CheckAppMsgFlagsSet(SET_CAPS_FOWNER) == true (line 224-226) | 3198 | + * Branch: CheckAppMsgFlagsSet(SET_CAPS_FOWNER) == true |
| 3293 | */ | 3199 | */ |
| 3294 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_003, TestSize.Level0) | 3200 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_003, TestSize.Level0) |
| 3295 | { | 3201 | { |
| @@ -3309,7 +3215,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_003, TestSize.Leve | |||
| 3309 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3215 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3310 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3216 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3311 | 3217 | ||
| 3312 | - ret = SetAmbientCapabilities(property, nullptr); | 3218 | + ret = SetAmbientCapabilities(property); |
| 3313 | } while (0); | 3219 | } while (0); |
| 3314 | DeleteAppSpawningCtx(property); | 3220 | DeleteAppSpawningCtx(property); |
| 3315 | AppSpawnClientDestroy(clientHandle); | 3221 | AppSpawnClientDestroy(clientHandle); |
| @@ -3319,7 +3225,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_003, TestSize.Leve | |||
| 3319 | /** | 3225 | /** |
| 3320 | * @brief Test SetAmbientCapabilities with both sandbox flags | 3226 | * @brief Test SetAmbientCapabilities with both sandbox flags |
| 3321 | * Expected: Sets CAP_DAC_OVERRIDE, CAP_KILL, and CAP_FOWNER | 3227 | * Expected: Sets CAP_DAC_OVERRIDE, CAP_KILL, and CAP_FOWNER |
| 3322 | - * Branch: Both flags set (line 219-226) | 3228 | + * Branch: Both flags set |
| 3323 | */ | 3229 | */ |
| 3324 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_004, TestSize.Level0) | 3230 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_004, TestSize.Level0) |
| 3325 | { | 3231 | { |
| @@ -3340,69 +3246,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_004, TestSize.Leve | |||
| 3340 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | 3246 | property = g_testHelper.GetAppProperty(clientHandle, reqHandle); |
| 3341 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3247 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3342 | 3248 | ||
| 3343 | - ret = SetAmbientCapabilities(property, nullptr); | 3249 | + ret = SetAmbientCapabilities(property); |
| 3344 | - } while (0); | ||
| 3345 | - DeleteAppSpawningCtx(property); | ||
| 3346 | - AppSpawnClientDestroy(clientHandle); | ||
| 3347 | - EXPECT_TRUE(ret == 0 || ret == -1); | ||
| 3348 | -} | ||
| 3349 | - | ||
| 3350 | -/** | ||
| 3351 | - * @brief Test SetAmbientCapabilities with NET_RAW in result | ||
| 3352 | - * Expected: Sets base capabilities and calls SetExtPermAmbientFromResult | ||
| 3353 | - * Branch: SetExtPermAmbientFromResult called (line 228) | ||
| 3354 | - */ | ||
| 3355 | -HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_005, TestSize.Level0) | ||
| 3356 | -{ | ||
| 3357 | - AppSpawnClientHandle clientHandle = nullptr; | ||
| 3358 | - AppSpawningCtx *property = nullptr; | ||
| 3359 | - AppSpawnReqMsgHandle reqHandle = 0; | ||
| 3360 | - int ret = -1; | ||
| 3361 | - do { | ||
| 3362 | - ret = AppSpawnClientInit(APPSPAWN_SERVER_NAME, &clientHandle); | ||
| 3363 | - APPSPAWN_CHECK(ret == 0, break, "Failed to create client"); | ||
| 3364 | - | ||
| 3365 | - reqHandle = g_testHelper.CreateMsg(clientHandle, MSG_APP_SPAWN, 0); | ||
| 3366 | - APPSPAWN_CHECK(reqHandle != INVALID_REQ_HANDLE, break, "Failed to create msg"); | ||
| 3367 | - | ||
| 3368 | - property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | ||
| 3369 | - APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | ||
| 3370 | - | ||
| 3371 | - ExtPermResult result = {0}; | ||
| 3372 | - result.caps = CAP_TO_MASK(CAP_NET_RAW); | ||
| 3373 | - result.capValues[0] = CAP_NET_RAW; | ||
| 3374 | - result.capCount = 1; | ||
| 3375 | - | ||
| 3376 | - ret = SetAmbientCapabilities(property, &result); | ||
| 3377 | - } while (0); | ||
| 3378 | - DeleteAppSpawningCtx(property); | ||
| 3379 | - AppSpawnClientDestroy(clientHandle); | ||
| 3380 | - EXPECT_TRUE(ret == 0 || ret == -1); | ||
| 3381 | -} | ||
| 3382 | - | ||
| 3383 | -/** | ||
| 3384 | - * @brief Test SetAmbientCapabilities with empty result and no flags | ||
| 3385 | - * Expected: Only sets CAP_DAC_OVERRIDE | ||
| 3386 | - * Branch: No additional flags or extended perms (line 215-228) | ||
| 3387 | - */ | ||
| 3388 | -HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_006, TestSize.Level0) | ||
| 3389 | -{ | ||
| 3390 | - AppSpawnClientHandle clientHandle = nullptr; | ||
| 3391 | - AppSpawningCtx *property = nullptr; | ||
| 3392 | - AppSpawnReqMsgHandle reqHandle = 0; | ||
| 3393 | - int ret = -1; | ||
| 3394 | - do { | ||
| 3395 | - ret = AppSpawnClientInit(APPSPAWN_SERVER_NAME, &clientHandle); | ||
| 3396 | - APPSPAWN_CHECK(ret == 0, break, "Failed to create client"); | ||
| 3397 | - | ||
| 3398 | - reqHandle = g_testHelper.CreateMsg(clientHandle, MSG_APP_SPAWN, 0); | ||
| 3399 | - APPSPAWN_CHECK(reqHandle != INVALID_REQ_HANDLE, break, "Failed to create msg"); | ||
| 3400 | - | ||
| 3401 | - property = g_testHelper.GetAppProperty(clientHandle, reqHandle); | ||
| 3402 | - APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | ||
| 3403 | - | ||
| 3404 | - ExtPermResult result = {0}; | ||
| 3405 | - ret = SetAmbientCapabilities(property, &result); | ||
| 3406 | } while (0); | 3250 | } while (0); |
| 3407 | DeleteAppSpawningCtx(property); | 3251 | DeleteAppSpawningCtx(property); |
| 3408 | AppSpawnClientDestroy(clientHandle); | 3252 | AppSpawnClientDestroy(clientHandle); |
| @@ -3412,7 +3256,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetAmbientCapabilities_006, TestSize.Leve | |||
| 3412 | /** | 3256 | /** |
| 3413 | * @brief Test SetCapabilities with isolated sandbox flag | 3257 | * @brief Test SetCapabilities with isolated sandbox flag |
| 3414 | * Expected: needExtPerm is false, no extended capabilities set | 3258 | * Expected: needExtPerm is false, no extended capabilities set |
| 3415 | - * Branch: CheckAppMsgFlagsSet(ISOLATED_SANDBOX_TYPE) == true (line 245) | 3259 | + * Branch: CheckAppMsgFlagsSet(ISOLATED_SANDBOX_TYPE) == true |
| 3416 | */ | 3260 | */ |
| 3417 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_001, TestSize.Level0) | 3261 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_001, TestSize.Level0) |
| 3418 | { | 3262 | { |
| @@ -3447,7 +3291,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_001, TestSize.Level0) | |||
| 3447 | /** | 3291 | /** |
| 3448 | * @brief Test SetCapabilities with NET_RAW JIT permission | 3292 | * @brief Test SetCapabilities with NET_RAW JIT permission |
| 3449 | * Expected: needExtPerm is true, NET_RAW capability is added | 3293 | * Expected: needExtPerm is true, NET_RAW capability is added |
| 3450 | - * Branch: needExtPerm == true, GetExtPermResult called (line 248-250) | 3294 | + * Branch: needExtPerm == true, GetExtPermResult called |
| 3451 | */ | 3295 | */ |
| 3452 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_002, TestSize.Level0) | 3296 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_002, TestSize.Level0) |
| 3453 | { | 3297 | { |
| @@ -3485,7 +3329,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_002, TestSize.Level0) | |||
| 3485 | /** | 3329 | /** |
| 3486 | * @brief Test SetCapabilities with CUSTOM_SANDBOX flag | 3330 | * @brief Test SetCapabilities with CUSTOM_SANDBOX flag |
| 3487 | * Expected: CAP_KILL is added to baseCaps | 3331 | * Expected: CAP_KILL is added to baseCaps |
| 3488 | - * Branch: CheckAppMsgFlagsSet(CUSTOM_SANDBOX) == true (line 256) | 3332 | + * Branch: CheckAppMsgFlagsSet(CUSTOM_SANDBOX) == true |
| 3489 | */ | 3333 | */ |
| 3490 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_003, TestSize.Level0) | 3334 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_003, TestSize.Level0) |
| 3491 | { | 3335 | { |
| @@ -3520,7 +3364,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_003, TestSize.Level0) | |||
| 3520 | /** | 3364 | /** |
| 3521 | * @brief Test SetCapabilities with SET_CAPS_FOWNER flag | 3365 | * @brief Test SetCapabilities with SET_CAPS_FOWNER flag |
| 3522 | * Expected: CAP_FOWNER is added to baseCaps | 3366 | * Expected: CAP_FOWNER is added to baseCaps |
| 3523 | - * Branch: CheckAppMsgFlagsSet(SET_CAPS_FOWNER) == true (line 257) | 3367 | + * Branch: CheckAppMsgFlagsSet(SET_CAPS_FOWNER) == true |
| 3524 | */ | 3368 | */ |
| 3525 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_004, TestSize.Level0) | 3369 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_004, TestSize.Level0) |
| 3526 | { | 3370 | { |
| @@ -3555,7 +3399,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_004, TestSize.Level0) | |||
| 3555 | /** | 3399 | /** |
| 3556 | * @brief Test SetCapabilities with all flags and NET_RAW | 3400 | * @brief Test SetCapabilities with all flags and NET_RAW |
| 3557 | * Expected: All capabilities are combined | 3401 | * Expected: All capabilities are combined |
| 3558 | - * Branch: All conditions true (line 256-258) | 3402 | + * Branch: All conditions true |
| 3559 | */ | 3403 | */ |
| 3560 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_005, TestSize.Level0) | 3404 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_005, TestSize.Level0) |
| 3561 | { | 3405 | { |
| @@ -3596,7 +3440,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_005, TestSize.Level0) | |||
| 3596 | /** | 3440 | /** |
| 3597 | * @brief Test SetCapabilities with native spawn mode | 3441 | * @brief Test SetCapabilities with native spawn mode |
| 3598 | * Expected: needExtPerm is true for native processes | 3442 | * Expected: needExtPerm is true for native processes |
| 3599 | - * Branch: IsNativeSpawnMode(content) == true (line 246) | 3443 | + * Branch: IsNativeSpawnMode(content) == true |
| 3600 | */ | 3444 | */ |
| 3601 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_006, TestSize.Level0) | 3445 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_006, TestSize.Level0) |
| 3602 | { | 3446 | { |
| @@ -3629,7 +3473,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_006, TestSize.Level0) | |||
| 3629 | /** | 3473 | /** |
| 3630 | * @brief Test SetCapabilities with no flags and no JIT permissions | 3474 | * @brief Test SetCapabilities with no flags and no JIT permissions |
| 3631 | * Expected: Only base CAP_DAC_OVERRIDE is set | 3475 | * Expected: Only base CAP_DAC_OVERRIDE is set |
| 3632 | - * Branch: Minimal capabilities (line 255-258) | 3476 | + * Branch: Minimal capabilities |
| 3633 | */ | 3477 | */ |
| 3634 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_007, TestSize.Level0) | 3478 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_007, TestSize.Level0) |
| 3635 | { | 3479 | { |
| @@ -3662,7 +3506,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_007, TestSize.Level0) | |||
| 3662 | /** | 3506 | /** |
| 3663 | * @brief Test SetCapabilities with invalid JIT permissions JSON | 3507 | * @brief Test SetCapabilities with invalid JIT permissions JSON |
| 3664 | * Expected: GetExtPermResult handles invalid JSON gracefully | 3508 | * Expected: GetExtPermResult handles invalid JSON gracefully |
| 3665 | - * Branch: GetExtPermResult handles cJSON_Parse failure (line 249) | 3509 | + * Branch: GetExtPermResult handles cJSON_Parse failure |
| 3666 | */ | 3510 | */ |
| 3667 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_008, TestSize.Level0) | 3511 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_008, TestSize.Level0) |
| 3668 | { | 3512 | { |
| @@ -3700,7 +3544,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_008, TestSize.Level0) | |||
| 3700 | /** | 3544 | /** |
| 3701 | * @brief Test SetCapabilities with empty JIT permissions array | 3545 | * @brief Test SetCapabilities with empty JIT permissions array |
| 3702 | * Expected: GetExtPermResult returns empty result | 3546 | * Expected: GetExtPermResult returns empty result |
| 3703 | - * Branch: GetExtPermResult handles empty array (line 249) | 3547 | + * Branch: GetExtPermResult handles empty array |
| 3704 | */ | 3548 | */ |
| 3705 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_009, TestSize.Level0) | 3549 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_009, TestSize.Level0) |
| 3706 | { | 3550 | { |
| @@ -3738,7 +3582,7 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_009, TestSize.Level0) | |||
| 3738 | /** | 3582 | /** |
| 3739 | * @brief Test SetCapabilities with unknown JIT permission | 3583 | * @brief Test SetCapabilities with unknown JIT permission |
| 3740 | * Expected: Unknown permissions are ignored | 3584 | * Expected: Unknown permissions are ignored |
| 3741 | - * Branch: GetExtPermResult ignores unknown permissions (line 249) | 3585 | + * Branch: GetExtPermResult ignores unknown permissions |
| 3742 | */ | 3586 | */ |
| 3743 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_010, TestSize.Level0) | 3587 | HWTEST_F(AppSpawnCommonTest, App_Spawn_SetCapabilities_010, TestSize.Level0) |
| 3744 | { | 3588 | { |
| @@ -3806,11 +3650,9 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_ExtPerm_Integration_001, TestSize.Level0) | |||
| 3806 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3650 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3807 | 3651 | ||
| 3808 | // Verify GetExtPermResult works | 3652 | // Verify GetExtPermResult works |
| 3809 | - ExtPermResult extResult = {0}; | 3653 | + uint64_t extCaps = GetExtPermResult(property); |
| 3810 | - GetExtPermResult(property, &extResult); | ||
| 3811 | 3654 | ||
| 3812 | - EXPECT_NE(extResult.caps & CAP_TO_MASK(CAP_NET_RAW), 0ULL); | 3655 | + EXPECT_EQ(extCaps, (uint64_t)CAP_TO_MASK(CAP_NET_RAW)); |
| 3813 | - EXPECT_EQ(extResult.capCount, 1); | ||
| 3814 | 3656 | ||
| 3815 | // Verify SetCapabilities processes the result | 3657 | // Verify SetCapabilities processes the result |
| 3816 | ret = SetCapabilities(mgr, property); | 3658 | ret = SetCapabilities(mgr, property); |
| @@ -3847,15 +3689,11 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_ExtPerm_Integration_002, TestSize.Level0) | |||
| 3847 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); | 3689 | APPSPAWN_CHECK(property != nullptr, break, "Failed to get property"); |
| 3848 | 3690 | ||
| 3849 | // Call GetExtPermResult multiple times | 3691 | // Call GetExtPermResult multiple times |
| 3850 | - ExtPermResult result1 = {0}; | 3692 | + uint64_t caps1 = GetExtPermResult(property); |
| 3851 | - ExtPermResult result2 = {0}; | 3693 | + uint64_t caps2 = GetExtPermResult(property); |
| 3852 | - | ||
| 3853 | - GetExtPermResult(property, &result1); | ||
| 3854 | - GetExtPermResult(property, &result2); | ||
| 3855 | 3694 | ||
| 3856 | // Results should be consistent | 3695 | // Results should be consistent |
| 3857 | - EXPECT_EQ(result1.caps, result2.caps); | 3696 | + EXPECT_EQ(caps1, caps2); |
| 3858 | - EXPECT_EQ(result1.capCount, result2.capCount); | ||
| 3859 | 3697 | ||
| 3860 | ret = 0; | 3698 | ret = 0; |
| 3861 | } while (0); | 3699 | } while (0); |