1 /*
2  * Copyright (c) 2024 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 #include <gtest/gtest.h>
17 
18 #include "hilog_tag_wrapper.h"
19 
20 using namespace testing::ext;
21 using UTAAFwkTag = OHOS::AAFwk::AAFwkLogTag;
22 
23 namespace OHOS {
24 namespace AbilityRuntime {
25 class AbilityServiceLogTest : public testing::Test {
26 public:
27     static void SetUpTestCase();
28     static void TearDownTestCase();
29     void SetUp() override;
30     void TearDown() override;
31 };
32 
SetUpTestCase(void)33 void AbilityServiceLogTest::SetUpTestCase(void)
34 {}
35 
TearDownTestCase(void)36 void AbilityServiceLogTest::TearDownTestCase(void)
37 {}
38 
SetUp()39 void AbilityServiceLogTest::SetUp()
40 {}
41 
TearDown()42 void AbilityServiceLogTest::TearDown()
43 {}
44 
45 /*
46  * Feature: HILOG
47  * Function: Create
48  * SubFunction: NA
49  * FunctionPoints: Create
50  * EnvConditions: NA
51  * CaseDescription: NA
52  */
53 HWTEST_F(AbilityServiceLogTest, Log_0100, TestSize.Level1)
54 {
55     GTEST_LOG_(INFO) << "AbilityServiceLog_0100 start";
56     TAG_LOGI(AAFwkTag::TEST, "AbilityServiceLog_0100 info start");
57     TAG_LOGD(AAFwkTag::TEST, "AbilityServiceLog_0100 debug start");
58     TAG_LOGW(AAFwkTag::TEST, "AbilityServiceLog_0100 warn start");
59     TAG_LOGE(AAFwkTag::TEST, "AbilityServiceLog_0100 error start");
60     TAG_LOGF(AAFwkTag::TEST, "AbilityServiceLog_0100 fatal start");
61     GTEST_LOG_(INFO) << "AbilityServiceLog_0100 end";
62 }
63 
64 /*
65  * Feature: HILOG
66  * Function: Create
67  * SubFunction: NA
68  * FunctionPoints: Create
69  * EnvConditions: NA
70  * CaseDescription: NA
71  */
72 HWTEST_F(AbilityServiceLogTest, Log_0200, TestSize.Level1)
73 {
74     GTEST_LOG_(INFO) << "AbilityServiceLog_0200 start";
75     TAG_LOGI(AAFwkTag::END, "AbilityServiceLog_0200 info start");
76     TAG_LOGD(AAFwkTag::END, "AbilityServiceLog_0200 debug start");
77     TAG_LOGW(AAFwkTag::END, "AbilityServiceLog_0200 warn start");
78     TAG_LOGE(AAFwkTag::END, "AbilityServiceLog_0200 error start");
79     TAG_LOGF(AAFwkTag::END, "AbilityServiceLog_0200 fatal start");
80     GTEST_LOG_(INFO) << "AbilityServiceLog_0200 end";
81 }
82 
83 /*
84  * Feature: HILOG
85  * Function: Create
86  * SubFunction: NA
87  * FunctionPoints: Create
88  * EnvConditions: NA
89  * CaseDescription: NA
90  */
91 HWTEST_F(AbilityServiceLogTest, Log_0300, TestSize.Level1)
92 {
93     size_t tag = 255;
94     GTEST_LOG_(INFO) << "AbilityServiceLog_0300 start";
95     TAG_LOGI(static_cast<AAFwkTag>(tag), "AbilityServiceLog_0300 info start");
96     TAG_LOGD(static_cast<AAFwkTag>(tag), "AbilityServiceLog_0300 debug start");
97     TAG_LOGW(static_cast<AAFwkTag>(tag), "AbilityServiceLog_0300 warn start");
98     TAG_LOGE(static_cast<AAFwkTag>(tag), "AbilityServiceLog_0300 error start");
99     TAG_LOGF(static_cast<AAFwkTag>(tag), "AbilityServiceLog_0300 fatal start");
100     GTEST_LOG_(INFO) << "AbilityServiceLog_0300 end";
101 }
102 }  // namespace AbilityRuntime
103 }  // namespace OHOS
104