1/*
2 * Copyright (c) 2022-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#ifndef EDM_UNIT_TEST_UTILS_H
17#define EDM_UNIT_TEST_UTILS_H
18
19#include <string>
20#include <unistd.h>
21#include "accesstoken_kit.h"
22#include "nativetoken_kit.h"
23#include "token_setproc.h"
24
25namespace OHOS {
26namespace EDM {
27namespace TEST {
28class Utils {
29public:
30    static constexpr int32_t EDM_UID = 3057;
31    static constexpr int32_t ROOT_UID = 0;
32    static constexpr int32_t USERIAM_UID = 1088;
33    static void ExecCmdSync(const std::string &cmd);
34    static void SetNativeTokenTypeAndPermissions(const char* permissions[], int size);
35    static void SetEdmInitialEnv();
36    static void ResetTokenTypeAndUid();
37    static bool GetEdmServiceState();
38    static bool IsOriginalUTEnv();
39    static void SetEdmServiceEnable();
40    static void SetEdmServiceDisable();
41    static void SetBluetoothEnable();
42    static void SetBluetoothDisable();
43
44private:
45    static uint64_t selfTokenId_;
46};
47} // namespace TEST
48} // namespace EDM
49} // namespace OHOS
50#endif // EDM_UNIT_TEST_UTILS_H
51