From 60536ee5ad836d45c91163b6242147d19553e581 Mon Sep 17 00:00:00 2001 From: huyx Date: Sat, 13 Apr 2024 10:37:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?object=5Fcollector=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E7=8E=87TDD=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- adapter/uhdf2/hdi/test/BUILD.gn | 1 + .../uhdf2/hdi/test/object_collector/BUILD.gn | 34 ++++++++++++++ .../object_collector_test.cpp | 46 +++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 adapter/uhdf2/hdi/test/object_collector/BUILD.gn create mode 100644 adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp diff --git a/adapter/uhdf2/hdi/test/BUILD.gn b/adapter/uhdf2/hdi/test/BUILD.gn index cce348212..24806c2e9 100644 --- a/adapter/uhdf2/hdi/test/BUILD.gn +++ b/adapter/uhdf2/hdi/test/BUILD.gn @@ -74,5 +74,6 @@ group("unittest") { "./../../../../adapter/uhdf2/hdi/test/buffer_handle:hdi_buffer_handle_test", "smq_test:HdiSmqTest", "stub_collector:stub_collector_test", + "object_collector:object_collector_test", ] } diff --git a/adapter/uhdf2/hdi/test/object_collector/BUILD.gn b/adapter/uhdf2/hdi/test/object_collector/BUILD.gn new file mode 100644 index 000000000..c37ac78bb --- /dev/null +++ b/adapter/uhdf2/hdi/test/object_collector/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2022-2023 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("./../../../../../adapter/uhdf2/uhdf.gni") + +module_output_path = "hdf_core/object_collector" + +ohos_unittest("object_collector_test") { + module_out_path = module_output_path + + sources = [ "object_collector_test.cpp" ] + + deps = [ + "$hdf_uhdf_path/hdi:libhdi", + "$hdf_uhdf_path/ipc:libhdf_ipc_adapter", + "$hdf_uhdf_path/utils:libhdf_utils", + ] + + external_deps = [ + "c_utils:utils", + "ipc:ipc_single", + ] +} diff --git a/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp b/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp new file mode 100644 index 000000000..f9dd45c29 --- /dev/null +++ b/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 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 +#include +#include +#include "hdi_support.h" +#include "object_collector.h" +#include "hdf_base.h" + +using namespace testing::ext; + +namespace OHOS { + struct TestService { + }; + + const std::u16string interfaceName = std::wstring_convert, char16_t> {}.from_bytes("sample_driver"); + + +class ObjectCollectorTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + + void SetUp() {}; + void TearDown() {}; +}; + +HWTEST_F(ObjectCollectorTest, ObjectCollectorTest001, TestSize.Level1) +{ + sptr object = HDI::ObjectCollector::GetInstance().NewObject(nullptr, interfaceName); + ASSERT_EQ(object, nullptr); +} +} // namespace OHOS \ No newline at end of file -- Gitee From f39bac3c574f428e71aba31912235d00e18aa040 Mon Sep 17 00:00:00 2001 From: huyx Date: Sat, 13 Apr 2024 10:49:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?object=5Fcollector=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E7=8E=87TDD=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../uhdf2/hdi/test/object_collector/object_collector_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp b/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp index f9dd45c29..86b501490 100644 --- a/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp +++ b/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp @@ -26,7 +26,8 @@ namespace OHOS { struct TestService { }; - const std::u16string interfaceName = std::wstring_convert, char16_t> {}.from_bytes("sample_driver"); + const std::u16string interfaceName = std::wstring_convert, + char16_t> {}.from_bytes("sample_driver"); class ObjectCollectorTest : public testing::Test { -- Gitee From 4dc421cc6c4a287a4c2e17d701cbc6e704967dca Mon Sep 17 00:00:00 2001 From: huyx Date: Sat, 13 Apr 2024 14:25:35 +0800 Subject: [PATCH 3/4] format Signed-off-by: huyx --- adapter/uhdf2/hdi/test/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapter/uhdf2/hdi/test/BUILD.gn b/adapter/uhdf2/hdi/test/BUILD.gn index 24806c2e9..0335d56a1 100644 --- a/adapter/uhdf2/hdi/test/BUILD.gn +++ b/adapter/uhdf2/hdi/test/BUILD.gn @@ -72,8 +72,8 @@ group("unittest") { ":HdiServiceManagerTest", ":HdiServiceManagerTestCC", "./../../../../adapter/uhdf2/hdi/test/buffer_handle:hdi_buffer_handle_test", + "object_collector:object_collector_test", "smq_test:HdiSmqTest", "stub_collector:stub_collector_test", - "object_collector:object_collector_test", ] } -- Gitee From 6cb8b90c9519f9cfb7551c708a742191937ecfee Mon Sep 17 00:00:00 2001 From: huyx Date: Mon, 15 Apr 2024 10:03:13 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=B8=E5=8F=AF?= =?UTF-8?q?=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- adapter/uhdf2/hdi/test/object_collector/BUILD.gn | 2 +- .../uhdf2/hdi/test/object_collector/object_collector_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adapter/uhdf2/hdi/test/object_collector/BUILD.gn b/adapter/uhdf2/hdi/test/object_collector/BUILD.gn index c37ac78bb..f81fdb1fc 100644 --- a/adapter/uhdf2/hdi/test/object_collector/BUILD.gn +++ b/adapter/uhdf2/hdi/test/object_collector/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# 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 diff --git a/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp b/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp index 86b501490..4a156647d 100644 --- a/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp +++ b/adapter/uhdf2/hdi/test/object_collector/object_collector_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 -- Gitee