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