1 /*
2 * Copyright (c) 2024 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 "access_token_wrapper_test.h"
17
18 #include <cstring>
19 #include <gtest/gtest.h>
20
21 #include "asset_system_type.h"
22 #include "access_token_wrapper.h"
23
24 using namespace testing::ext;
25 namespace UnitTest::AssetPermissionCheckWrapperTest {
26 class AssetPermissionCheckWrapperTest : public testing::Test {
27 public:
28 static void SetUpTestCase(void);
29
30 static void TearDownTestCase(void);
31
32 void SetUp(void);
33
34 void TearDown(void);
35 };
36
SetUpTestCase(void)37 void AssetPermissionCheckWrapperTest::SetUpTestCase(void)
38 {
39 }
40
TearDownTestCase(void)41 void AssetPermissionCheckWrapperTest::TearDownTestCase(void)
42 {
43 }
44
SetUp(void)45 void AssetPermissionCheckWrapperTest::SetUp(void)
46 {
47 }
48
TearDown(void)49 void AssetPermissionCheckWrapperTest::TearDown(void)
50 {
51 }
52
53 /**
54 * @tc.name: AssetPermissionCheckWrapperTest.AssetPermissionCheckWrapperTest001
55 * @tc.desc: Test asset func CheckPersistentPermission, expect ERROR
56 * @tc.type: FUNC
57 * @tc.result:0
58 */
59 HWTEST_F(AssetPermissionCheckWrapperTest, AssetPermissionCheckWrapperTest001, TestSize.Level0)
60 {
61 const char *permission = "ohos.permission.STORE_PERSISTENT_DATA"
62 ASSERT_EQ(false, CheckPermission(permission));
63 }
64
65 /**
66 * @tc.name: AssetPermissionCheckWrapperTest.AssetPermissionCheckWrapperTest002
67 * @tc.desc: Test asset func CheckSystemHapPermission, expect SUCCESS
68 * @tc.type: FUNC
69 * @tc.result:0
70 */
71 HWTEST_F(AssetPermissionCheckWrapperTest, AssetPermissionCheckWrapperTest002, TestSize.Level0)
72 {
73 ASSERT_EQ(true, CheckSystemHapPermission());
74 }
75 }
76