添加esim业务代码

Signed-off-by: yangyang <yangyang651@h-partners.com>
This commit is contained in:
yangyang 2024-09-28 10:50:25 +08:00
parent f7579c2de0
commit 3c4bb12199
7 changed files with 52 additions and 216 deletions

View File

@ -3273,7 +3273,8 @@ int32_t CoreServiceProxy::SetProfileNickname(
TELEPHONY_LOGE("Remote is null");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t sendRequestRet = remote->SendRequest(static_cast<uint32_t>(CoreServiceInterfaceCode::UPDATE_PROFILE_NICKNAME), data, reply, option);
int32_t sendRequestRet = remote->SendRequest(
static_cast<uint32_t>(CoreServiceInterfaceCode::UPDATE_PROFILE_NICKNAME), data, reply, option);
if (sendRequestRet != ERR_NONE) {
TELEPHONY_LOGE("SetProfileNickname failed, error code is %{public}d", st);
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;

View File

@ -288,9 +288,9 @@ bool EsimFile::ProcessSetNicknameDone(const AppExecFwk::InnerEvent::Pointer &eve
void EsimFile::InitMemberFunc()
{
memberFuncMap_[MSG_ESIM_DELETE_PROFILE] =
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessDeleteProfileDone(event); };
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessDeleteProfileDone(event); };
memberFuncMap_[MSG_ESIM_SWITCH_PROFILE] =
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSwitchToProfileDone(event); };
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSwitchToProfileDone(event); };
memberFuncMap_[MSG_ESIM_SET_NICK_NAME] =
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetNicknameDone(event); };
}

40
test/BUILD.gn Normal file
View File

@ -0,0 +1,40 @@
# 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/test.gni")
import("../../core_service/telephony_core_service.gni")
group("unittest") {
testonly = true
deps = []
deps += [
"unittest/core_service_gtest:tel_core_service_common_test",
"unittest/core_service_gtest:tel_core_service_gtest",
"unittest/core_service_gtest:tel_core_service_native_branch_gtest",
"unittest/core_service_gtest:tel_core_service_test",
"unittest/core_service_gtest:tel_core_zero_branch_gtest",
"unittest/core_service_gtest:tel_network_search_branch_gtest",
"unittest/core_service_gtest:tel_network_search_gtest",
"unittest/core_service_gtest:tel_network_search_manager_gtest",
"unittest/core_service_gtest:tel_sim_file_manager_branch_gtest",
"unittest/core_service_gtest:tel_sim_gtest",
"unittest/core_service_gtest:tel_sim_zero_branch_gtest",
"unittest/icc_dialling_numbers_handler_gtest:icc_dialling_numbers_handler_gtest",
"unittest/icc_file_gtest:icc_file_gtest",
"unittest/sim_manager_gtest:sim_manager_gtest",
"unittest/sim_state_handle_gtest:sim_state_handle_gtest",
"unittest/tel_ril_gtest:tel_ril_gtest",
"unittest/utils_vcard_gtest:utils_vcard_branch_gtest",
"unittest/utils_vcard_gtest:utils_vcard_gtest",
]
}

View File

@ -1,208 +0,0 @@
# Copyright (C) 2024 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/test.gni")
SOURCE_DIR = "../../../"
ohos_unittest("tel_esim_gtest") {
install_enable = true
subsystem_name = "telephony"
part_name = "core_service"
test_module = "tel_esim_gtest"
module_out_path = part_name + "/" + test_module
sources = [
"esim_core_service_client_test.cpp",
"esim_core_service_proxy_test.cpp",
"esim_core_service_stub_test.cpp",
"esim_core_service_test.cpp",
"esim_file_manager_test.cpp",
"esim_manager_test.cpp",
"esim_test.cpp",
]
include_dirs = [
"$SOURCE_DIR/services/core/include",
"$SOURCE_DIR/utils/codec/include",
"$SOURCE_DIR/utils/log/include",
"$SOURCE_DIR/utils/preferences/include",
"$SOURCE_DIR/services/sim/include",
"$SOURCE_DIR/services/network_search/include",
"$SOURCE_DIR/services/tel_ril/include",
"$SOURCE_DIR/services/telephony_ext_wrapper/include",
"$SOURCE_DIR/interfaces/innerkits/include",
"$SOURCE_DIR/test/unittest/esim_gtest/mock/include",
]
configs = [ "$SOURCE_DIR/utils:telephony_log_config" ]
deps = [
"$SOURCE_DIR:tel_core_service",
"$SOURCE_DIR/interfaces/innerkits:tel_core_service_api",
"$SOURCE_DIR/utils:libtel_common",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [
"ability_base:want",
"ability_base:zuri",
"ability_runtime:ability_manager",
"ability_runtime:data_ability_helper",
"ability_runtime:wantagent_innerkits",
"access_token:libaccesstoken_sdk",
"access_token:libnativetoken",
"access_token:libtoken_setproc",
"cJSON:cjson",
"c_utils:utils",
"common_event_service:cesfwk_innerkits",
"config_policy:configpolicy_util",
"core_service:libtel_vcard",
"data_share:datashare_common",
"data_share:datashare_consumer",
"drivers_interface_ril:ril_idl_headers",
"eventhandler:libeventhandler",
"hdf_core:libhdi",
"hilog:libhilog",
"init:libbegetutil",
"ipc:ipc_single",
"netmanager_base:net_conn_manager_if",
"netmanager_ext:net_tether_manager_if",
"power_manager:powermgr_client",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
defines = [
"TELEPHONY_LOG_TAG = \"CoreServiceGtest\"",
"LOG_DOMAIN = 0xD000F00",
]
if (defined(global_parts_info) &&
defined(global_parts_info.location_location) &&
global_parts_info.location_location) {
external_deps += [
"location:lbsservice_common",
"location:locator_sdk",
]
defines += [ "ABILITY_LOCATION_SUPPORT" ]
}
cflags = [
"-flto",
"-fsanitize=cfi",
"-fsanitize-cfi-cross-dso",
"-fvisibility=hidden",
]
ldflags = [
"-flto",
"-fsanitize=cfi",
"-fsanitize-cfi-cross-dso",
]
}
ohos_unittest("esim_core_service_client_branch_test") {
install_enable = true
subsystem_name = "telephony"
part_name = "core_service"
test_module = "tel_esim_gtest"
module_out_path = part_name + "/" + test_module
sources = [ "esim_core_service_client_branch_test.cpp" ]
include_dirs = [
"$SOURCE_DIR/services/core/include",
"$SOURCE_DIR/utils/codec/include",
"$SOURCE_DIR/utils/log/include",
"$SOURCE_DIR/utils/preferences/include",
"$SOURCE_DIR/services/sim/include",
"$SOURCE_DIR/services/network_search/include",
"$SOURCE_DIR/services/tel_ril/include",
"$SOURCE_DIR/services/telephony_ext_wrapper/include",
"$SOURCE_DIR/interfaces/innerkits/include",
"$SOURCE_DIR/test/unittest/esim_gtest/mock/include",
]
configs = [ "$SOURCE_DIR/utils:telephony_log_config" ]
deps = [
"$SOURCE_DIR:tel_core_service",
"$SOURCE_DIR/interfaces/innerkits:tel_core_service_api",
"$SOURCE_DIR/utils:libtel_common",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [
"ability_base:want",
"ability_base:zuri",
"ability_runtime:ability_manager",
"ability_runtime:data_ability_helper",
"ability_runtime:wantagent_innerkits",
"access_token:libaccesstoken_sdk",
"access_token:libnativetoken",
"access_token:libtoken_setproc",
"cJSON:cjson",
"c_utils:utils",
"common_event_service:cesfwk_innerkits",
"config_policy:configpolicy_util",
"core_service:libtel_vcard",
"data_share:datashare_common",
"data_share:datashare_consumer",
"drivers_interface_ril:ril_idl_headers",
"eventhandler:libeventhandler",
"hdf_core:libhdi",
"hilog:libhilog",
"init:libbegetutil",
"ipc:ipc_single",
"netmanager_base:net_conn_manager_if",
"netmanager_ext:net_tether_manager_if",
"power_manager:powermgr_client",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
defines = [
"TELEPHONY_LOG_TAG = \"CoreServiceGtest\"",
"LOG_DOMAIN = 0xD000F00",
]
if (defined(global_parts_info) &&
defined(global_parts_info.location_location) &&
global_parts_info.location_location) {
external_deps += [
"location:lbsservice_common",
"location:locator_sdk",
]
defines += [ "ABILITY_LOCATION_SUPPORT" ]
}
cflags = [
"-flto",
"-fsanitize=cfi",
"-fsanitize-cfi-cross-dso",
"-fvisibility=hidden",
]
ldflags = [
"-flto",
"-fsanitize=cfi",
"-fsanitize-cfi-cross-dso",
]
}
group("unittest") {
testonly = true
deps = [
":esim_core_service_client_branch_test",
":tel_esim_gtest",
]
}

View File

@ -107,4 +107,4 @@ HWTEST_F(EsimFileManagerTest, SetProfileNickname_001, Function | MediumTest | Le
EXPECT_EQ(res, ResultState::RESULT_UNDEFINED_ERROR);
}
} // Telephony
}// OHOS
} // OHOS

View File

@ -72,7 +72,8 @@ HWTEST_F(EsimManagerTest, DeleteProfile, Function | MediumTest | Level1)
EventFwk::CommonEventSubscribeInfo sp;
std::weak_ptr<Telephony::ITelRilManager> iTelRilManager = telRilManager;
std::weak_ptr<Telephony::SimStateManager> state = simStateManager;
std::shared_ptr<Telephony::SimFileManager> simFileManager = std::make_shared<SimFileManager>(sp, iTelRilManager, state);
std::shared_ptr<Telephony::SimFileManager> simFileManager =
std::make_shared<SimFileManager>(sp, iTelRilManager, state);
simManager->simFileManager_.push_back(simFileManager);
simManager->simFileManager_[slotId]->Init(slotId);
ret = simManager->DeleteProfile(slotId, iccId, DeleteProfileResult);
@ -101,7 +102,8 @@ HWTEST_F(EsimManagerTest, SwitchToProfile, Function | MediumTest | Level1)
EventFwk::CommonEventSubscribeInfo sp;
std::weak_ptr<Telephony::ITelRilManager> iTelRilManager = telRilManager;
std::weak_ptr<Telephony::SimStateManager> state = simStateManager;
std::shared_ptr<Telephony::SimFileManager> simFileManager = std::make_shared<SimFileManager>(sp, iTelRilManager, state);
std::shared_ptr<Telephony::SimFileManager> simFileManager =
std::make_shared<SimFileManager>(sp, iTelRilManager, state);
simManager->simFileManager_.push_back(simFileManager);
simManager->simFileManager_[slotId]->Init(slotId);
ret = simManager->SwitchToProfile(slotId, portIndex, iccId, forceDeactivateSim, SwitchProfileResult);
@ -129,7 +131,8 @@ HWTEST_F(EsimManagerTest, SetProfileNickname, Function | MediumTest | Level1)
EventFwk::CommonEventSubscribeInfo sp;
std::weak_ptr<Telephony::ITelRilManager> iTelRilManager = telRilManager;
std::weak_ptr<Telephony::SimStateManager> state = simStateManager;
std::shared_ptr<Telephony::SimFileManager> simFileManager = std::make_shared<SimFileManager>(sp, iTelRilManager, state);
std::shared_ptr<Telephony::SimFileManager> simFileManager =
std::make_shared<SimFileManager>(sp, iTelRilManager, state);
simManager->simFileManager_.push_back(simFileManager);
simManager->simFileManager_[slotId]->Init(slotId);
ret = simManager->SetProfileNickname(slotId, iccId, nickname, UpdateResult);

View File

@ -200,7 +200,7 @@ HWTEST_F(EsimTest, ProcessSwitchToProfileDone_001, Function | MediumTest | Level
}
HWTEST_F(EsimTest, ProcessSetNickname_001, Function | MediumTest | Level2)
{
{
std::shared_ptr<TelRilManager> telRilManager = std::make_shared<TelRilManager>();
std::shared_ptr<Telephony::SimStateManager> simStateManager = std::make_shared<SimStateManager>(telRilManager);
std::shared_ptr<Telephony::EsimFile> esimFile = std::make_shared<EsimFile>(simStateManager);