13fc297bdSopenharmony_ci/* 23fc297bdSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 33fc297bdSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 43fc297bdSopenharmony_ci * you may not use this file except in compliance with the License. 53fc297bdSopenharmony_ci * You may obtain a copy of the License at 63fc297bdSopenharmony_ci * 73fc297bdSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 83fc297bdSopenharmony_ci * 93fc297bdSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 103fc297bdSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 113fc297bdSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 123fc297bdSopenharmony_ci * See the License for the specific language governing permissions and 133fc297bdSopenharmony_ci * limitations under the License. 143fc297bdSopenharmony_ci */ 153fc297bdSopenharmony_ci 163fc297bdSopenharmony_ci#include <gtest/gtest.h> 173fc297bdSopenharmony_ci#include "accesstoken_kit.h" 183fc297bdSopenharmony_ci 193fc297bdSopenharmony_cinamespace { 203fc297bdSopenharmony_ci int32_t g_GetTokenTypeFlag = 0; 213fc297bdSopenharmony_ci int32_t g_VerifyAccessToken = 0; 223fc297bdSopenharmony_ci} 233fc297bdSopenharmony_ci 243fc297bdSopenharmony_civoid MockGetTokenTypeFlag(int32_t mockRet) 253fc297bdSopenharmony_ci{ 263fc297bdSopenharmony_ci g_GetTokenTypeFlag = mockRet; 273fc297bdSopenharmony_ci} 283fc297bdSopenharmony_ci 293fc297bdSopenharmony_civoid MockVerifyAccessToken(int32_t mockRet) 303fc297bdSopenharmony_ci{ 313fc297bdSopenharmony_ci g_VerifyAccessToken = mockRet; 323fc297bdSopenharmony_ci} 333fc297bdSopenharmony_ci 343fc297bdSopenharmony_cinamespace OHOS { 353fc297bdSopenharmony_ci namespace Security { 363fc297bdSopenharmony_ci namespace AccessToken { 373fc297bdSopenharmony_ci int AccessTokenKit::VerifyAccessToken(AccessTokenID tokenID, const std::string& permissionName) 383fc297bdSopenharmony_ci { 393fc297bdSopenharmony_ci GTEST_LOG_(INFO) << "VerifyAccessToken called " << g_VerifyAccessToken; 403fc297bdSopenharmony_ci return g_VerifyAccessToken; 413fc297bdSopenharmony_ci } 423fc297bdSopenharmony_ci 433fc297bdSopenharmony_ci } // namespace AccessToken 443fc297bdSopenharmony_ci } // namespace Security 453fc297bdSopenharmony_ci} // namespace OHOS