• 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 #ifndef THERMAL_MGR_SYSTEM_TEST
17 #define THERMAL_MGR_SYSTEM_TEST
18 
19 #include <gtest/gtest.h>
20 #include <string>
21 
22 namespace OHOS {
23 namespace PowerMgr {
24 const int32_t BUFFER_SIZE = 512;
25 const uint32_t MAX_PATH = 256;
26 const uint32_t WAIT_TIME = 1;
27 std::string batteryPath = "/data/sensor/battery/temp";
28 std::string shellPath = "/data/sensor/shell/temp";
29 std::string chargerPath = "/data/sensor/charger/temp";
30 std::string socPath = "/data/sensor/soc/temp";
31 std::string ambientPath = "/data/sensor/ambient/temp";
32 std::string cpuPath = "/data/sensor/cpu/temp";
33 std::string paPath = "/data/sensor/pa/temp";
34 std::string apPath = "/data/sensor/ap/temp";
35 std::string configLevelPath = "/data/thermal/config/configLevel";
36 std::string lcdPath = "/data/thermal/config/lcd";
37 std::string processPath = "/data/thermal/config/process_ctrl";
38 std::string shutdownPath = "/data/thermal/config/shut_down";
39 std::string stateScreenPath = "/data/thermal/state/screen";
40 std::string stateScenePath = "/data/thermal/state/scene";
41 std::string stateChargePath = "/data/thermal/state/charge";
42 const std::string CPU_FREQ_PATH = "/data/cooling/cpu/freq";
43 const std::string GPU_FREQ_PATH = "/data/cooling/gpu/freq";
44 const std::string BATTERY_CHARGER_CURRENT_PATH = "/data/cooling/battery/current";
45 const std::string SIMULATION_TEMP_DIR = "/data/sensor/%s/temp";
46 class ThermalMgrSystemTest : public testing::Test {
47 public:
48     static void SetUpTestCase();
49     static void TearDownTestCase();
50     void SetUp();
51     void TearDown();
52     static int32_t WriteFile(std::string path, std::string buf, size_t size);
53     static int32_t ReadFile(const char *path, char *buf, size_t size);
54     static int32_t ConvertInt(const std::string &value);
55     static int32_t InitNode();
56 };
57 } // namespace PowerMgr
58 } // namespace OHOS
59 #endif // THERMAL_MGR_SYSTEM_TEST