1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <gtest/gtest.h> 17 18 #include "access_token_adapter_impl.h" 19 #include "ohos_adapter_helper.h" 20 21 using namespace testing; 22 using namespace testing::ext; 23 24 namespace OHOS::NWeb { 25 26 class AccessTokenAdapterImplTest : public testing::Test { 27 public: 28 static void SetUpTestCase(void); 29 static void TearDownTestCase(void); 30 void SetUp(); 31 void TearDown(); 32 }; 33 SetUpTestCase(void)34void AccessTokenAdapterImplTest::SetUpTestCase(void) {} 35 TearDownTestCase(void)36void AccessTokenAdapterImplTest::TearDownTestCase(void) {} 37 SetUp(void)38void AccessTokenAdapterImplTest::SetUp(void) {} 39 TearDown(void)40void AccessTokenAdapterImplTest::TearDown(void) {} 41 42 /** 43 * @tc.name: AccessTokenAdapterImplTest_AccessTokenAdapterImpl_001. 44 * @tc.desc: AccessToken adapter unittest. 45 * @tc.type: FUNC. 46 * @tc.require: 47 */ 48 HWTEST_F(AccessTokenAdapterImplTest, AccessTokenAdapterImplTest_AccessTokenAdapterImpl_001, TestSize.Level1) 49 { 50 std::string permissionName = "ohos.permission.INTERNET"; 51 bool isPermissionGranted = 52 OhosAdapterHelper::GetInstance().GetAccessTokenAdapterInstance().VerifyAccessToken(permissionName); 53 EXPECT_FALSE(isPermissionGranted); 54 } 55 } // namespace OHOS::NWeb 56