• 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 <iostream>
18 #include "sp_utils.h"
19 #include "Power.h"
20 
21 using namespace testing::ext;
22 using namespace std;
23 
24 namespace OHOS {
25 namespace SmartPerf {
26 class PowerTest : public testing::Test {
27 public:
SetUpTestCase()28     static void SetUpTestCase() {}
TearDownTestCase()29     static void TearDownTestCase() {}
SetUp()30     void SetUp() {}
TearDown()31     void TearDown() {}
32 
33     const std::string currentNowPath = "/sys/class/power_supply/Battery/current_now";
34     const std::string voltageNowPath = "/sys/class/power_supply/Battery/voltage_now";
35 };
36 
37 HWTEST_F(PowerTest, PowerTestCase02, TestSize.Level1)
38 {
39     Power &power = Power::GetInstance();
40     power.SetRkFlag();
41     std::map<std::string, std::string> result = power.ItemData();
42     EXPECT_EQ(result["failed"], "RK does not support power acquisition");
43 }
44 }
45 }