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 #include "charger_overtemperature_shutdown_test.h"
17
18 #include <csignal>
19 #include <iostream>
20 #include "utils/hdf_log.h"
21
22 #include "power_supply_provider.h"
23 #include "battery_thread_test.h"
24
25 using namespace testing::ext;
26 using namespace OHOS::HDI::Battery::V1_1;
27 using namespace std;
28
29 namespace ChargerOvertemperatureShutdownTest {
SetUpTestCase(void)30 void ChargerOvertemperatureShutdownTest::SetUpTestCase(void)
31 {
32 }
33
TearDownTestCase(void)34 void ChargerOvertemperatureShutdownTest::TearDownTestCase(void)
35 {
36 }
37
SetUp(void)38 void ChargerOvertemperatureShutdownTest::SetUp(void)
39 {
40 }
41
TearDown(void)42 void ChargerOvertemperatureShutdownTest::TearDown(void)
43 {
44 }
45
46 /**
47 * @tc.name: BatteryST_007
48 * @tc.desc: Test functions temperature in normal range in chargerThread
49 * @tc.type: FUNC
50 */
51 HWTEST_F (ChargerOvertemperatureShutdownTest, BatteryST_007, TestSize.Level1)
52 {
53 HDF_LOGD("%{public}s: enter. BatteryST_007 start.", __func__);
54 ChargerThread ct;
55
56 ChargerThreadInitTest(ct);
57 ChargerThreadHandleTemperatureTest(599, ct);
58 HDF_LOGD("%{public}s: enter. BatteryST_007 end.", __func__);
59 }
60
61 /**
62 * @tc.name: BatteryST_008
63 * @tc.desc: Test functions high temperature shutdown in chargerThread
64 * @tc.type: FUNC
65 */
66 HWTEST_F (ChargerOvertemperatureShutdownTest, BatteryST_008, TestSize.Level1)
67 {
68 HDF_LOGD("%{public}s: enter. BatteryST_008 start.", __func__);
69 ChargerThread ct;
70 ChargerThreadInitTest(ct);
71 if (false) {
72 ChargerThreadHandleTemperatureTest(600, ct);
73 }
74 HDF_LOGD("%{public}s: enter. BatteryST_008 end.", __func__);
75 }
76 }
77