146debc2cSopenharmony_ci/* 246debc2cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 346debc2cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 446debc2cSopenharmony_ci * you may not use this file except in compliance with the License. 546debc2cSopenharmony_ci * You may obtain a copy of the License at 646debc2cSopenharmony_ci * 746debc2cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 846debc2cSopenharmony_ci * 946debc2cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1046debc2cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1146debc2cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1246debc2cSopenharmony_ci * See the License for the specific language governing permissions and 1346debc2cSopenharmony_ci * limitations under the License. 1446debc2cSopenharmony_ci */ 1546debc2cSopenharmony_ci 1646debc2cSopenharmony_ci#include "scan_service_ability_mock.h" 1746debc2cSopenharmony_ci 1846debc2cSopenharmony_ci#include "nativetoken_kit.h" 1946debc2cSopenharmony_ci#include "token_setproc.h" 2046debc2cSopenharmony_ci 2146debc2cSopenharmony_cinamespace OHOS { 2246debc2cSopenharmony_cinamespace Scan { 2346debc2cSopenharmony_civoid ScanServiceAbilityMock::MockPermission() 2446debc2cSopenharmony_ci{ 2546debc2cSopenharmony_ci static const char *PERMS[] = { 2646debc2cSopenharmony_ci "ohos.permission.PRINT" 2746debc2cSopenharmony_ci }; 2846debc2cSopenharmony_ci uint64_t tokenId; 2946debc2cSopenharmony_ci NativeTokenInfoParams infoInstance = { 3046debc2cSopenharmony_ci .dcapsNum = 0, 3146debc2cSopenharmony_ci .permsNum = 1, 3246debc2cSopenharmony_ci .aclsNum = 0, 3346debc2cSopenharmony_ci .dcaps = nullptr, 3446debc2cSopenharmony_ci .perms = PERMS, 3546debc2cSopenharmony_ci .acls = nullptr, 3646debc2cSopenharmony_ci .processName = "scan_service", 3746debc2cSopenharmony_ci .aplStr = "system_core", 3846debc2cSopenharmony_ci }; 3946debc2cSopenharmony_ci tokenId = GetAccessTokenId(&infoInstance); 4046debc2cSopenharmony_ci SetSelfTokenID(tokenId); 4146debc2cSopenharmony_ci} 4246debc2cSopenharmony_ci} 4346debc2cSopenharmony_ci}