1 /*
2  * Copyright (c) 2021-2022 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 SLEEP_INTERVAL_SEC = 5;
27 const std::string BATTERY_PATH = "/data/service/el0/thermal/sensor/battery/temp";
28 const std::string SHELL_PATH = "/data/service/el0/thermal/sensor/shell/temp";
29 const std::string CHARGER_PATH = "/data/service/el0/thermal/sensor/charger/temp";
30 const std::string SOC_PATH = "/data/service/el0/thermal/sensor/soc/temp";
31 const std::string AMBIENT_PATH = "/data/service/el0/thermal/sensor/ambient/temp";
32 const std::string CPU_PATH = "/data/service/el0/thermal/sensor/cpu/temp";
33 const std::string PA_PATH = "/data/service/el0/thermal/sensor/pa/temp";
34 const std::string AP_PATH = "/data/service/el0/thermal/sensor/ap/temp";
35 const std::string CONFIG_LEVEL_PATH = "/data/service/el0/thermal/config/configLevel";
36 const std::string LCD_PATH = "/data/service/el0/thermal/config/lcd";
37 const std::string PROCESS_PATH = "/data/service/el0/thermal/config/process_ctrl";
38 const std::string SHUTDOWN_PATH = "/data/service/el0/thermal/config/shut_down";
39 const std::string STATE_SCREEN_PATH = "/data/service/el0/thermal/state/screen";
40 const std::string STATE_SCENE_PATH = "/data/service/el0/thermal/state/scene";
41 const std::string STATE_CHARGE_PATH = "/data/service/el0/thermal/state/charge";
42 const std::string VENDOR_CONFIG = "/vendor/etc/thermal_config/thermal_service_config.xml";
43 const std::string SIMUL_CPU_FREQ_PATH = "/data/service/el0/thermal/cooling/cpu/freq";
44 const std::string REAL_CPU_FREQ_PATH = "/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq";
45 const std::string GPU_FREQ_PATH = "/data/service/el0/thermal/cooling/gpu/freq";
46 const std::string SIMUL_BATTERY_CHARGER_CURRENT_PATH = "/data/service/el0/thermal/cooling/battery/current";
47 const std::string REAL_BATTERY_CHARGER_CURRENT_PATH = "/data/service/el0/battery/current_limit";
48 const std::string SIMULATION_TEMP_DIR = "/data/service/el0/thermal/sensor/%s/temp";
49 class ThermalMgrSystemTest : public testing::Test {
50 public:
51     static void SetUpTestCase();
52     static void TearDownTestCase();
53     void SetUp();
54     void TearDown();
55     static int32_t WriteFile(std::string path, std::string buf, size_t size);
56     static int32_t ReadFile(const char *path, char *buf, size_t size);
57     static int32_t ConvertInt(const std::string &value);
58     static int32_t InitNode();
59 };
60 } // namespace PowerMgr
61 } // namespace OHOS
62 #endif // THERMAL_MGR_SYSTEM_TEST