• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 /* This files contains faultlog secure module unittest. */
17 
18 #include "faultlogger_secure_test.h"
19 
20 #include <string>
21 #include "fault_logger_secure.h"
22 
23 using namespace OHOS::HiviewDFX;
24 using namespace testing::ext;
25 using namespace std;
26 
SetUpTestCase(void)27 void FaultLoggerSecureTest::SetUpTestCase(void)
28 {
29 }
30 
TearDownTestCase(void)31 void FaultLoggerSecureTest::TearDownTestCase(void)
32 {
33 }
34 
SetUp(void)35 void FaultLoggerSecureTest::SetUp(void)
36 {
37 }
38 
TearDown(void)39 void FaultLoggerSecureTest::TearDown(void)
40 {
41 }
42 
43 
44 /**
45  * @tc.name: FaultLoggerSecureTest001
46  * @tc.desc: test check caller uid
47  * @tc.type: FUNC
48  */
49 HWTEST_F (FaultLoggerSecureTest, FaultLoggerSecureTest001, TestSize.Level2)
50 {
51     GTEST_LOG_(INFO) << "FaultLoggerSecureTest001: start.";
52     std::shared_ptr<FaultLoggerSecure> secure = std::make_shared<FaultLoggerSecure>();
53     int callingUid = 1000;
54     int pid = 100;
55     bool ret = secure->CheckCallerUID(callingUid, pid);
56     if (ret != true) {
57         printf("check error!");
58     }
59     EXPECT_EQ(true, ret == true);
60     GTEST_LOG_(INFO) << "FaultLoggerSecureTest001: end.";
61 }
62