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 "get_hap_dlp_flag_test.h"
17 #include "gtest/gtest.h"
18 #include <thread>
19 #include <unistd.h>
20
21 #include "access_token.h"
22 #include "access_token_error.h"
23 #include "accesstoken_common_log.h"
24 #include "iaccess_token_manager.h"
25 #include "permission_grant_info.h"
26 #include "permission_state_change_info_parcel.h"
27 #include "string_ex.h"
28 #include "test_common.h"
29 #include "tokenid_kit.h"
30 #include "token_setproc.h"
31
32 using namespace testing::ext;
33 namespace OHOS {
34 namespace Security {
35 namespace AccessToken {
36 static const int INVALID_DLP_TOKEN_FLAG = -1;
37
SetUpTestCase()38 void GetHapDlpFlagTest::SetUpTestCase()
39 {
40 }
41
TearDownTestCase()42 void GetHapDlpFlagTest::TearDownTestCase()
43 {
44 }
45
SetUp()46 void GetHapDlpFlagTest::SetUp()
47 {
48 LOGI(ATM_DOMAIN, ATM_TAG, "SetUp ok.");
49 }
50
TearDown()51 void GetHapDlpFlagTest::TearDown()
52 {
53 }
54
55 /**
56 * @tc.name: GetHapDlpFlagFuncTest001
57 * @tc.desc: GetHapDlpFlag function abnormal branch.
58 * @tc.type: FUNC
59 * @tc.require Issue Number:I5RJBB
60 */
61 HWTEST_F(GetHapDlpFlagTest, GetHapDlpFlagFuncTest001, TestSize.Level0)
62 {
63 LOGI(ATM_DOMAIN, ATM_TAG, "GetHapDlpFlagFuncTest001");
64
65 AccessTokenID tokenID = 0;
66 int32_t ret = AccessTokenKit::GetHapDlpFlag(tokenID);
67 EXPECT_EQ(INVALID_DLP_TOKEN_FLAG, ret);
68 }
69 } // namespace AccessToken
70 } // namespace Security
71 } // namespace OHOS