100600bfbSopenharmony_ci/*
200600bfbSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
300600bfbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
400600bfbSopenharmony_ci * you may not use this file except in compliance with the License.
500600bfbSopenharmony_ci * You may obtain a copy of the License at
600600bfbSopenharmony_ci *
700600bfbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
800600bfbSopenharmony_ci *
900600bfbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1000600bfbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1100600bfbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1200600bfbSopenharmony_ci * See the License for the specific language governing permissions and
1300600bfbSopenharmony_ci * limitations under the License.
1400600bfbSopenharmony_ci */
1500600bfbSopenharmony_ci#include <gtest/gtest.h>
1600600bfbSopenharmony_ci#include "hidumper_test_utils.h"
1700600bfbSopenharmony_ciusing namespace testing::ext;
1800600bfbSopenharmony_cinamespace OHOS {
1900600bfbSopenharmony_cinamespace HiviewDFX {
2000600bfbSopenharmony_ciclass HidumperPrivacyTest : public testing::Test {
2100600bfbSopenharmony_cipublic:
2200600bfbSopenharmony_ci    static void SetUpTestCase(void);
2300600bfbSopenharmony_ci    static void TearDownTestCase(void);
2400600bfbSopenharmony_ci    void SetUp();
2500600bfbSopenharmony_ci    void TearDown();
2600600bfbSopenharmony_ci    const int ROOT_UID = 0;
2700600bfbSopenharmony_ci    const int SYSTEM_UID = 1000;
2800600bfbSopenharmony_ci    const int SHELL_UID = 2000;
2900600bfbSopenharmony_ci    const std::string KEY_WORD = "Usage";
3000600bfbSopenharmony_ci    const std::string CMD = "hidumper -s 10";
3100600bfbSopenharmony_ci};
3200600bfbSopenharmony_ci
3300600bfbSopenharmony_civoid HidumperPrivacyTest::SetUpTestCase(void)
3400600bfbSopenharmony_ci{
3500600bfbSopenharmony_ci}
3600600bfbSopenharmony_civoid HidumperPrivacyTest::TearDownTestCase(void)
3700600bfbSopenharmony_ci{
3800600bfbSopenharmony_ci}
3900600bfbSopenharmony_civoid HidumperPrivacyTest::SetUp(void)
4000600bfbSopenharmony_ci{
4100600bfbSopenharmony_ci}
4200600bfbSopenharmony_civoid HidumperPrivacyTest::TearDown(void)
4300600bfbSopenharmony_ci{
4400600bfbSopenharmony_ci}
4500600bfbSopenharmony_ci
4600600bfbSopenharmony_ci/**
4700600bfbSopenharmony_ci * @tc.name: HidumperPrivacyTest001
4800600bfbSopenharmony_ci * @tc.desc: When uid=root and apl=2,the content of sa can be obtained.
4900600bfbSopenharmony_ci * @tc.type: FUNC
5000600bfbSopenharmony_ci * @tc.require: issueI5GXTG
5100600bfbSopenharmony_ci */
5200600bfbSopenharmony_ciHWTEST_F(HidumperPrivacyTest, HidumperPrivacyTest001, TestSize.Level3)
5300600bfbSopenharmony_ci{
5400600bfbSopenharmony_ci    setuid(ROOT_UID);
5500600bfbSopenharmony_ci    ASSERT_TRUE(HidumperTestUtils::GetInstance().IsExistInCmdResult(CMD, KEY_WORD));
5600600bfbSopenharmony_ci}
5700600bfbSopenharmony_ci} // namespace HiviewDFX
5800600bfbSopenharmony_ci} // namespace OHOS
59