!1120 异常修改

Merge pull request !1120 from 师皓杰/master
This commit is contained in:
openharmony_ci 2024-10-15 01:37:28 +00:00 committed by Gitee
commit 6d21d3bbe1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 237 additions and 20 deletions

View File

@ -126,18 +126,92 @@ distributed_event_sources = [
"${dms_path}/interfaces/innerkits/distributed_event/src/dms_sa_client.cpp", "${dms_path}/interfaces/innerkits/distributed_event/src/dms_sa_client.cpp",
] ]
ohos_unittest("distributedschedsvrtest") { ohos_unittest("distributedschedcallbacktest") {
module_out_path = module_output_path
sources = [
"unittest/dms_callback_task_test.cpp",
"unittest/dms_token_callback_test.cpp",
"unittest/mock_remote_stub.cpp",
]
sources += dtbschedmgr_sources
configs = [
":test_config",
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
]
configs += dsched_configs
if (is_standard_system) {
external_deps = dsched_external_deps
public_deps = dsched_public_deps
}
if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) {
defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
}
part_name = "dmsfwk"
subsystem_name = "ability"
}
ohos_unittest("distributedschedservicetest") {
module_out_path = module_output_path
sources = [
"unittest/distributed_sched_service_first_test.cpp",
"unittest/distributed_sched_service_second_test.cpp",
"unittest/mock_distributed_sched.cpp",
]
sources += dtbschedmgr_sources
configs = [
":test_config",
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
]
configs += dsched_configs
if (is_standard_system) {
external_deps = dsched_external_deps
public_deps = dsched_public_deps
}
if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) {
defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
}
part_name = "dmsfwk"
subsystem_name = "ability"
}
ohos_unittest("distributedschedstubtest") {
module_out_path = module_output_path
sources = [ "unittest/distributed_sched_stub_test.cpp" ]
sources += dtbschedmgr_sources
configs = [
":test_config",
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
]
configs += dsched_configs
if (is_standard_system) {
external_deps = dsched_external_deps
public_deps = dsched_public_deps
}
if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) {
defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
}
part_name = "dmsfwk"
subsystem_name = "ability"
}
ohos_unittest("distributedschedadaptertest") {
module_out_path = module_output_path module_out_path = module_output_path
sources = [ sources = [
"unittest/continue_scene_session_handler_test.cpp", "unittest/continue_scene_session_handler_test.cpp",
"unittest/distributed_sched_adapter_test.cpp", "unittest/distributed_sched_adapter_test.cpp",
"unittest/distributed_sched_service_first_test.cpp",
"unittest/distributed_sched_service_second_test.cpp",
"unittest/distributed_sched_stub_test.cpp",
"unittest/dms_callback_task_test.cpp",
"unittest/dms_token_callback_test.cpp",
"unittest/mock_distributed_sched.cpp",
"unittest/mock_remote_stub.cpp", "unittest/mock_remote_stub.cpp",
] ]
sources += dtbschedmgr_sources sources += dtbschedmgr_sources
@ -303,7 +377,7 @@ ohos_unittest("dschedpermissiontest") {
subsystem_name = "ability" subsystem_name = "ability"
} }
ohos_unittest("dschedmissionmanagertest") { ohos_unittest("distributedmissionmanagertest") {
sanitize = { sanitize = {
cfi = true cfi = true
cfi_cross_dso = true cfi_cross_dso = true
@ -313,11 +387,7 @@ ohos_unittest("dschedmissionmanagertest") {
cflags = [ "-Dprivate=public" ] cflags = [ "-Dprivate=public" ]
sources = [ sources = [
"unittest/mission/distributed_bm_storage_test.cpp", "unittest/mission/distributed_bm_storage_test.cpp",
"unittest/mission/distributed_data_storage_test.cpp",
"unittest/mission/distributed_mission_info_test.cpp", "unittest/mission/distributed_mission_info_test.cpp",
"unittest/mission/dms_continue_manager_test.cpp",
"unittest/mission/dms_mission_manager_test.cpp",
"unittest/mission/dsched_sync_e2e_test.cpp",
"unittest/mission/mission_info_converter_test.cpp", "unittest/mission/mission_info_converter_test.cpp",
"unittest/mission/snapshot_test.cpp", "unittest/mission/snapshot_test.cpp",
"unittest/mock_remote_stub.cpp", "unittest/mock_remote_stub.cpp",
@ -339,6 +409,65 @@ ohos_unittest("dschedmissionmanagertest") {
subsystem_name = "ability" subsystem_name = "ability"
} }
ohos_unittest("dmscontinuemanagertest") {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
module_out_path = module_output_path
cflags = [ "-Dprivate=public" ]
sources = [
"unittest/mission/dms_continue_manager_test.cpp",
"unittest/mission/dsched_sync_e2e_test.cpp",
]
sources += dtbschedmgr_sources
configs = [
":test_config",
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
]
configs += dsched_configs
if (is_standard_system) {
external_deps = dsched_external_deps
external_deps += [ "config_policy:configpolicy_util" ]
public_deps = dsched_public_deps
}
part_name = "dmsfwk"
subsystem_name = "ability"
}
ohos_unittest("dmsmissionmanagertest") {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
module_out_path = module_output_path
cflags = [ "-Dprivate=public" ]
sources = [
"unittest/mission/distributed_data_storage_test.cpp",
"unittest/mission/dms_mission_manager_test.cpp",
"unittest/mission/mock_image_packer.cpp",
]
sources += dtbschedmgr_sources
configs = [
":test_config",
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
]
configs += dsched_configs
if (is_standard_system) {
external_deps = dsched_external_deps
external_deps += [ "config_policy:configpolicy_util" ]
public_deps = dsched_public_deps
}
part_name = "dmsfwk"
subsystem_name = "ability"
}
ohos_unittest("bundlemanagerinternaltest") { ohos_unittest("bundlemanagerinternaltest") {
sanitize = { sanitize = {
cfi = true cfi = true
@ -613,7 +742,10 @@ group("unittest") {
":distributedadaptertest", ":distributedadaptertest",
":distributedcalltest", ":distributedcalltest",
":distributedeventtest", ":distributedeventtest",
":distributedschedsvrtest", ":distributedschedadaptertest",
":distributedschedcallbacktest",
":distributedschedservicetest",
":distributedschedstubtest",
":distributeduidtest", ":distributeduidtest",
":distributedwanttest", ":distributedwanttest",
":dmsbasetest", ":dmsbasetest",
@ -628,7 +760,9 @@ group("unittest") {
] ]
if (dmsfwk_mission_manager) { if (dmsfwk_mission_manager) {
deps += [ deps += [
":dschedmissionmanagertest", ":distributedmissionmanagertest",
":dmscontinuemanagertest",
":dmsmissionmanagertest",
":dschedpermissiontest", ":dschedpermissiontest",
] ]
} }

View File

@ -220,6 +220,7 @@ HWTEST_F(DMSContinueManagerTest, testRegisterOnListener001, TestSize.Level1)
sptr<IRemoteObject> obj02(new RemoteOnListenerStubTest()); sptr<IRemoteObject> obj02(new RemoteOnListenerStubTest());
ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj02); ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj02);
EXPECT_EQ(ret, ERR_OK); EXPECT_EQ(ret, ERR_OK);
DMSContinueRecvMgr::GetInstance().UnInit();
DTEST_LOG << "DMSContinueManagerTest testRegisterOnListener001 end" << std::endl; DTEST_LOG << "DMSContinueManagerTest testRegisterOnListener001 end" << std::endl;
} }
@ -279,7 +280,7 @@ HWTEST_F(DMSContinueManagerTest, testGetMissionId001, TestSize.Level1)
EXPECT_EQ(ret, ERR_OK); EXPECT_EQ(ret, ERR_OK);
ret = DMSContinueSendMgr::GetInstance().GetMissionIdByBundleName(BUNDLENAME_02, missionId); ret = DMSContinueSendMgr::GetInstance().GetMissionIdByBundleName(BUNDLENAME_02, missionId);
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR); EXPECT_EQ(ret, MISSION_NOT_FOCUSED);
DTEST_LOG << "DMSContinueManagerTest testGetMissionId001 end" << std::endl; DTEST_LOG << "DMSContinueManagerTest testGetMissionId001 end" << std::endl;
} }
@ -661,14 +662,12 @@ HWTEST_F(DMSContinueManagerTest, testOnDeviceScreenOff001, TestSize.Level1)
HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline001, TestSize.Level1) HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline001, TestSize.Level1)
{ {
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline001 start" << std::endl; DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline001 start" << std::endl;
DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId = NETWORKID_01;
DMSContinueRecvMgr::GetInstance().NotifyDeviceOffline(NETWORKID_01);
sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest()); sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01); DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
EXPECT_NE(DMSContinueRecvMgr::GetInstance().registerOnListener_.size(), 0); EXPECT_NE(DMSContinueRecvMgr::GetInstance().registerOnListener_.size(), 0);
DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId = NETWORKID_01;
DMSContinueRecvMgr::GetInstance().NotifyDeviceOffline(NETWORKID_01);
EXPECT_EQ(DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId, "");
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline001 end" << std::endl; DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline001 end" << std::endl;
} }

View File

@ -0,0 +1,41 @@
/*
* 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.
*/
#include "mock_image_packer.h"
#include <string>
namespace OHOS {
namespace DistributedSchedule {
ImagePacker::ImagePacker()
{}
ImagePacker::~ImagePacker()
{}
uint32_t ImagePacker::StartPacking(std::ostream &outputStream, const PackOption &option)
{
return 0;
}
uint32_t ImagePacker::AddImage(PixelMap &pixelMap)
{
return 0;
}
uint32_t ImagePacker::FinalizePacking()
{
return 0;
}
} // namespace DistributedSchedule
} // namespace OHOS

View File

@ -0,0 +1,43 @@
/*
* 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.
*/
#ifndef MOCK_IMAGE_PACKER_H
#define MOCK_IMAGE_PACKER_H
#include <vector>
#include <sstream>
namespace OHOS {
namespace DistributedSchedule {
struct PackOption {
};
class PixelMap {
public:
PixelMap() = default;
~PixelMap() = default;
};
class ImagePacker {
public:
ImagePacker();
~ImagePacker();
uint32_t StartPacking(std::ostream &outputStream, const PackOption &option);
uint32_t AddImage(PixelMap &pixelMap);
uint32_t FinalizePacking();
};
} // namespace DistributedSchedule
} // namespace OHOS
#endif //MOCK_IMAGE_PACKER_H