• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 #ifndef ACCESSTOKEN_KIT_TEST_H
17 #define ACCESSTOKEN_KIT_TEST_H
18 
19 #include <gtest/gtest.h>
20 
21 namespace OHOS {
22 namespace Security {
23 namespace AccessToken {
24 static const std::string TEST_BUNDLE_NAME = "ohos";
25 static const std::string TEST_PERMISSION_NAME_ALPHA = "ohos.permission.ALPHA";
26 static const std::string TEST_PERMISSION_NAME_BETA = "ohos.permission.BETA";
27 static const std::string TEST_PERMISSION_NAME_GAMMA = "ohos.permission.GAMMA";
28 static const int TEST_USER_ID = 0;
29 static const int TEST_USER_ID_INVALID = -1;
30 static const unsigned int TEST_TOKENID_INVALID = 0;
31 static const int INVALID_BUNDLENAME_LEN = 260;
32 static const int INVALID_APPIDDESC_LEN = 10244;
33 static const int INVALID_LABEL_LEN = 260;
34 static const int INVALID_DESCRIPTION_LEN = 260;
35 static const int INVALID_PERMNAME_LEN = 260;
36 static const int CYCLE_TIMES = 100;
37 static const int THREAD_NUM = 3;
38 static const int INVALID_DCAP_LEN = 1025;
39 class AccessTokenKitTest : public testing::Test {
40 public:
41     static void SetUpTestCase();
42 
43     static void TearDownTestCase();
44 
45     void SetUp();
46 
47     void TearDown();
48     unsigned int GetAccessTokenID(int userID, std::string bundleName, int instIndex);
49     void DeleteTestToken() const;
50     void AllocTestToken() const;
51 };
52 } // namespace AccessToken
53 } // namespace Security
54 } // namespace OHOS
55 #endif // ACCESSTOKEN_KIT_TEST_H
56