mirror of
https://github.com/openharmony/powermgr_battery_lite.git
synced 2026-06-30 22:08:36 -04:00
Modify standard definition
Signed-off-by: toutes <zhaoruiyuan2@huawei.com>
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ import("config.gni")
|
||||
|
||||
batterymgr_path = "//base/powermgr/battery_lite"
|
||||
|
||||
batterymgr_frameworks_path = "${batterymgr_path}/frameworks"
|
||||
batterymgr_frameworks_path = "${batterymgr_path}/frameworks/native"
|
||||
|
||||
batterymgr_interfaces_path = "${batterymgr_path}/interfaces"
|
||||
|
||||
|
||||
+2
-2
@@ -24,11 +24,11 @@ if (battery_mini_system) {
|
||||
]
|
||||
|
||||
local_deps +=
|
||||
[ "//base/powermgr/battery_lite/frameworks/src/mini:battery_impl" ]
|
||||
[ "//base/powermgr/battery_lite/frameworks/native/src/mini:battery_impl" ]
|
||||
} else {
|
||||
local_deps += [
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/powermgr/battery_lite/frameworks/src/small:battery_impl",
|
||||
"//base/powermgr/battery_lite/frameworks/native/src/small:battery_impl",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ shared_library("ace_kit_battery") {
|
||||
"//foundation/ace/ace_engine_lite/interfaces/innerkits/builtin/async",
|
||||
"${aafwk_lite_path}/interfaces/kits/ability_lite",
|
||||
"//base/powermgr/battery_lite/interfaces/kits",
|
||||
"//base/powermgr/battery_lite/frameworks/include",
|
||||
"//base/powermgr/battery_lite/frameworks/native/include",
|
||||
]
|
||||
deps = [
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//build/lite/ndk/ndk.gni")
|
||||
|
||||
group("unittest") {
|
||||
deps = [ "./test/unittest:unittest" ]
|
||||
}
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
@@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//build/lite/config/test.gni")
|
||||
|
||||
unittest("battery_lite_test_interface") {
|
||||
output_extension = "bin"
|
||||
output_dir = "$root_out_dir/test/unittest/batterymng_test_lite"
|
||||
|
||||
sources = [ "src/batterymgr_interfaces_test.cpp" ]
|
||||
|
||||
include_dirs = [
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/kits",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//base/powermgr/battery_lite/interfaces/kits",
|
||||
"//base/powermgr/battery_lite/frameworks/include",
|
||||
]
|
||||
deps = [
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/powermgr/battery_lite/frameworks:batterymgr",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
]
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
deps = [ ":battery_lite_test_interface" ]
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "hilog/log.h"
|
||||
#include "battery_info.h"
|
||||
#include "battery_framework.h"
|
||||
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "BATTERYMGR_LITE"
|
||||
|
||||
using namespace std;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
class BatterymgrInterfacesTest : public testing::Test {
|
||||
protected:
|
||||
static void SetUpTestCase(void) {}
|
||||
static void TearDownTestCase(void) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: BatteryMgrInterfaceTest001
|
||||
* @tc.desc: Test the interface Battery::GetBatSoc.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest001, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest001 called");
|
||||
int32_t soc = GetBatSoc();
|
||||
EXPECT_EQ(soc >= 0 && soc <= 100, 1) << "GetBatterySoc ret = " << soc << endl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: BatteryMgrInterfaceTest002
|
||||
* @tc.desc: Test the interface Battery::GetChargingStatus().
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest002, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest002 called");
|
||||
BatteryChargeState status = GetChargingStatus();
|
||||
EXPECT_EQ(status >= CHARGE_STATE_NONE && status <= CHARGE_STATE_BUTT, 1)
|
||||
<< "GetChargingStatus ret = " << status << endl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: BatteryMgrInterfaceTest003
|
||||
* @tc.desc: Test the interface Battery::GetHealthStatus().
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest003, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest003 called");
|
||||
BatteryHealthState status = GetHealthStatus();
|
||||
EXPECT_EQ(status >= HEALTH_STATE_UNKNOWN && status <= HEALTH_STATE_BUTT, 1)
|
||||
<< "GetHealthStatus ret = " << status << endl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: BatteryMgrInterfaceTest004
|
||||
* @tc.desc: Test the interface Battery::GetPluggedType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest004, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest004 called");
|
||||
BatteryPluggedType status = GetPluggedType();
|
||||
EXPECT_EQ(status >= PLUGGED_TYPE_NONE && status <= PLUGGED_TYPE_BUTT, 1)
|
||||
<< "GetPluggedType ret = " << status << endl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: BatteryMgrInterfaceTest005
|
||||
* @tc.desc: Test the interface Battery::GetBatVoltage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest005, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest005 called");
|
||||
int32_t voltage = GetBatVoltage();
|
||||
EXPECT_EQ(voltage >= 0 && voltage <= 100, 1)
|
||||
<< "GetBatVoltage ret = " << voltage << endl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: BatteryMgrInterfaceTest006
|
||||
* @tc.desc: Test the interface Battery::GetBatTemperature
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest006, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest007 called");
|
||||
int32_t temperature = GetBatTemperature();
|
||||
EXPECT_EQ(temperature >= 0 && temperature <= 100, 1)
|
||||
<< "GetBatTemperature ret = " << temperature << endl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: BatteryMgrInterfaceTest007
|
||||
* @tc.desc: Test the interface Battery::GetBatTechnology
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest007, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest006 called");
|
||||
char *technology = GetBatTechnology();
|
||||
EXPECT_EQ(strcmp(technology, "Ternary_Lithium"), 0)
|
||||
<< "GetBatTechnology ret = " << technology << endl;
|
||||
};
|
||||
};
|
||||
@@ -24,7 +24,7 @@ unittest("battery_lite_test_interface") {
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/kits",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//base/powermgr/battery_lite/interfaces/kits",
|
||||
"//base/powermgr/battery_lite/frameworks/include",
|
||||
"//base/powermgr/battery_lite/frameworks/native/include",
|
||||
]
|
||||
deps = [
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
|
||||
@@ -40,7 +40,7 @@ HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest001, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest001 called");
|
||||
int32_t soc = GetBatSoc();
|
||||
EXPECT_EQ(soc >= 0 && soc <= 100, 1) << "GetBatterySoc ret = " << soc << endl;
|
||||
EXPECT_EQ((soc >= 0 && soc <= 100), 1) << "GetBatterySoc ret = " << soc << endl;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest002, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest002 called");
|
||||
BatteryChargeState status = GetChargingStatus();
|
||||
EXPECT_EQ(status >= CHARGE_STATE_NONE && status <= CHARGE_STATE_BUTT, 1)
|
||||
EXPECT_EQ((status >= CHARGE_STATE_NONE && status <= CHARGE_STATE_BUTT), 1)
|
||||
<< "GetChargingStatus ret = " << status << endl;
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest003, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest003 called");
|
||||
BatteryHealthState status = GetHealthStatus();
|
||||
EXPECT_EQ(status >= HEALTH_STATE_UNKNOWN && status <= HEALTH_STATE_BUTT, 1)
|
||||
EXPECT_EQ((status >= HEALTH_STATE_UNKNOWN && status <= HEALTH_STATE_BUTT), 1)
|
||||
<< "GetHealthStatus ret = " << status << endl;
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest004, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest004 called");
|
||||
BatteryPluggedType status = GetPluggedType();
|
||||
EXPECT_EQ(status >= PLUGGED_TYPE_NONE && status <= PLUGGED_TYPE_BUTT, 1)
|
||||
EXPECT_EQ((status >= PLUGGED_TYPE_NONE && status <= PLUGGED_TYPE_BUTT), 1)
|
||||
<< "GetPluggedType ret = " << status << endl;
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest005, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest005 called");
|
||||
int32_t voltage = GetBatVoltage();
|
||||
EXPECT_EQ(voltage >= 0 && voltage <= 100, 1)
|
||||
EXPECT_EQ((voltage >= 0 && voltage <= 100), 1)
|
||||
<< "GetBatVoltage ret = " << voltage << endl;
|
||||
};
|
||||
|
||||
@@ -104,7 +104,7 @@ HWTEST_F(BatterymgrInterfacesTest, BatteryMgrInterfaceTest006, TestSize.Level0)
|
||||
{
|
||||
HILOG_INFO(HILOG_MODULE_APP, "BatteryMgrInterfaceTest007 called");
|
||||
int32_t temperature = GetBatTemperature();
|
||||
EXPECT_EQ(temperature >= 0 && temperature <= 100, 1)
|
||||
EXPECT_EQ((temperature >= 0 && temperature <= 100), 1)
|
||||
<< "GetBatTemperature ret = " << temperature << endl;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user