• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #include "string"
18 
19 #include "frameworks/base/perfmonitor/perf_monitor.h"
20 
21 using namespace testing;
22 using namespace testing::ext;
23 
24 namespace OHOS::Ace {
25 
26 namespace {
27 constexpr int32_t SUB_HEALTH_DURATION = 1;
28 } // namespace
29 
30 class PerfMonitorTest : public testing::Test {
31 public:
SetUpTestSuite()32     static void SetUpTestSuite() {}
TearDownTestSuite()33     static void TearDownTestSuite() {}
SetUp()34     void SetUp() {};
TearDown()35     void TearDown() {};
36 };
37 
38 /**
39  * @tc.name: PerfMonitorTest001
40  * @tc.desc: SetSubHealthInfo
41  * @tc.type: FUNC
42  */
43 HWTEST_F(PerfMonitorTest, PerfMonitorTest001, TestSize.Level1)
44 {
45     /**
46      * @tc.steps: step1. Get currentId from initial env
47      * @tc.expected: CurrentId equals the value in initial env
48      */
49     std::string info = "testSubHealthInfo";
50     std::string reson = "testSubHealthReason";
51     int32_t duration = SUB_HEALTH_DURATION;
52     EXPECT_NE(PerfMonitor::GetPerfMonitor(), nullptr);
53     PerfMonitor::GetPerfMonitor()->SetSubHealthInfo(info, reson, duration);
54 }
55 
56 } // namespace OHOS::Ace
57