1 /* 2 * Copyright (c) 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 #include <gtest/gtest.h> 16 #include "hidumper_test_utils.h" 17 using namespace testing::ext; 18 namespace OHOS { 19 namespace HiviewDFX { 20 class HidumperPrivacyTest : public testing::Test { 21 public: 22 static void SetUpTestCase(void); 23 static void TearDownTestCase(void); 24 void SetUp(); 25 void TearDown(); 26 const int ROOT_UID = 0; 27 const int SYSTEM_UID = 1000; 28 const int SHELL_UID = 2000; 29 const std::string KEY_WORD = "Usage"; 30 const std::string CMD = "hidumper -s 10"; 31 }; 32 SetUpTestCase(void)33void HidumperPrivacyTest::SetUpTestCase(void) 34 { 35 } TearDownTestCase(void)36void HidumperPrivacyTest::TearDownTestCase(void) 37 { 38 } SetUp(void)39void HidumperPrivacyTest::SetUp(void) 40 { 41 } TearDown(void)42void HidumperPrivacyTest::TearDown(void) 43 { 44 } 45 46 /** 47 * @tc.name: HidumperPrivacyTest001 48 * @tc.desc: When uid=root and apl=2,the content of sa can be obtained. 49 * @tc.type: FUNC 50 * @tc.require: issueI5GXTG 51 */ 52 HWTEST_F(HidumperPrivacyTest, HidumperPrivacyTest001, TestSize.Level3) 53 { 54 setuid(ROOT_UID); 55 ASSERT_TRUE(HidumperTestUtils::GetInstance().IsExistInCmdResult(CMD, KEY_WORD)); 56 } 57 } // namespace HiviewDFX 58 } // namespace OHOS 59