diff --git a/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn index c028a65b5d5d499f326846484ccccb6af0d2a4e0..19dcd22fa8582f00f65d984b63e5d6741112b20e 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-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 @@ -23,7 +23,6 @@ group("unittest") { "${interfaces_path}/inner_kits/native_cpp/test/unittest/audiosinktest:audio_sink_test", "${interfaces_path}/inner_kits/native_cpp/test/unittest/audiosourcetest:audio_source_test", "${services_path}/audioclient/test/unittest:daudio_client_test", - "${services_path}/audiocontrol/test/unittest:daudio_control_test", "${services_path}/audiohdiproxy/test/unittest:daudio_hdi_proxy_test", "${services_path}/audiomanager/test/unittest:daudio_manager_test", "${services_path}/audioprocessor/test/unittest:daudio_processor_test", diff --git a/services/audiocontrol/controlsink/include/daudio_sink_dev_ctrl_mgr.h b/services/audiocontrol/controlsink/include/daudio_sink_dev_ctrl_mgr.h deleted file mode 100644 index 5727469b86f31bb632861553f2cc0b194663b084..0000000000000000000000000000000000000000 --- a/services/audiocontrol/controlsink/include/daudio_sink_dev_ctrl_mgr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_DAUDIO_SINK_DEV_CTRL_MANAGER_H -#define OHOS_DAUDIO_SINK_DEV_CTRL_MANAGER_H - -#include -#include -#include - -#include "audio_event.h" -#include "iaudio_event_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class DAudioSinkDevCtrlMgr { -public: - DAudioSinkDevCtrlMgr(const std::string &networkId, std::shared_ptr audioEventCallback); - ~DAudioSinkDevCtrlMgr(); - - int32_t SetUp(); - int32_t Start(); - int32_t Stop(); - int32_t Release(); - bool IsOpened(); - int32_t SendAudioEvent(const AudioEvent &event); -}; -} // DistributedHardware -} // OHOS -#endif // OHOS_DAUDIO_SINK_DEV_CTRL_MANAGER_H diff --git a/services/audiocontrol/controlsink/src/daudio_sink_dev_ctrl_manager.cpp b/services/audiocontrol/controlsink/src/daudio_sink_dev_ctrl_manager.cpp deleted file mode 100644 index b08677b34e784a42867a9e34b55477fde35c4c23..0000000000000000000000000000000000000000 --- a/services/audiocontrol/controlsink/src/daudio_sink_dev_ctrl_manager.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 "daudio_sink_dev_ctrl_mgr.h" - -#include "if_system_ability_manager.h" -#include "iservice_registry.h" - -#include "audio_param.h" -#include "daudio_constants.h" -#include "daudio_errorcode.h" -#include "daudio_log.h" -#include "daudio_util.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "DAudioSinkDevCtrlMgr" - -namespace OHOS { -namespace DistributedHardware { -DAudioSinkDevCtrlMgr::DAudioSinkDevCtrlMgr(const std::string &devId, - std::shared_ptr audioEventCallback) -{ - DHLOGD("Control manager constructed."); -} - -DAudioSinkDevCtrlMgr::~DAudioSinkDevCtrlMgr() -{ - DHLOGD("Control manager deconstructed."); -} - -int32_t DAudioSinkDevCtrlMgr::SetUp() -{ - DHLOGI("Set up sink device control manager."); - return DH_SUCCESS; -} - -int32_t DAudioSinkDevCtrlMgr::Start() -{ - DHLOGI("Start sink device control manager."); - return DH_SUCCESS; -} - -int32_t DAudioSinkDevCtrlMgr::Stop() -{ - DHLOGI("Stop sink device control manager."); - return DH_SUCCESS; -} - -int32_t DAudioSinkDevCtrlMgr::Release() -{ - DHLOGI("Release sink device control manager."); - return DH_SUCCESS; -} - -bool DAudioSinkDevCtrlMgr::IsOpened() -{ - return true; -} - -int32_t DAudioSinkDevCtrlMgr::SendAudioEvent(const AudioEvent &event) -{ - DHLOGD("Send audio event."); - return DH_SUCCESS; -} -} // namespace DistributedHardware -} // namespace OHOS diff --git a/services/audiocontrol/controlsource/include/daudio_source_dev_ctrl_mgr.h b/services/audiocontrol/controlsource/include/daudio_source_dev_ctrl_mgr.h deleted file mode 100644 index ff5ea9304dd4fbcb9c44adfe304c2eb6b45319a6..0000000000000000000000000000000000000000 --- a/services/audiocontrol/controlsource/include/daudio_source_dev_ctrl_mgr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_DAUDIO_SOURCE_DEV_CTRL_MANAGER_H -#define OHOS_DAUDIO_SOURCE_DEV_CTRL_MANAGER_H - -#include -#include -#include - -#include "audio_event.h" -#include "iaudio_event_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class DAudioSourceDevCtrlMgr { -public: - DAudioSourceDevCtrlMgr(const std::string &networkId, std::shared_ptr audioEventCallback); - ~DAudioSourceDevCtrlMgr(); - - int32_t SetUp(); - int32_t Start(); - int32_t Stop(); - int32_t Release(); - bool IsOpened(); - int32_t SendAudioEvent(const AudioEvent &event); -}; -} // DistributedHardware -} // OHOS -#endif // OHOS_DAUDIO_SOURCE_DEV_CTRL_MANAGER_H \ No newline at end of file diff --git a/services/audiocontrol/controlsource/src/daudio_source_dev_ctrl_manager.cpp b/services/audiocontrol/controlsource/src/daudio_source_dev_ctrl_manager.cpp deleted file mode 100644 index 18174c5c54e986409b8121ec71faf7550f2d4ab3..0000000000000000000000000000000000000000 --- a/services/audiocontrol/controlsource/src/daudio_source_dev_ctrl_manager.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "daudio_source_dev_ctrl_mgr.h" - -#include "audio_param.h" -#include "daudio_constants.h" -#include "daudio_errorcode.h" -#include "daudio_log.h" -#include "daudio_util.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "DAudioSourceDevCtrlMgr" - -namespace OHOS { -namespace DistributedHardware { -DAudioSourceDevCtrlMgr::DAudioSourceDevCtrlMgr(const std::string &devId, - std::shared_ptr audioEventCallback) -{ - DHLOGD("Control manager constructed."); -} - -DAudioSourceDevCtrlMgr::~DAudioSourceDevCtrlMgr() -{ - DHLOGD("Control manager deconstructed."); -} - -int32_t DAudioSourceDevCtrlMgr::SetUp() -{ - DHLOGI("Set up source device control manager."); - return DH_SUCCESS; -} - -int32_t DAudioSourceDevCtrlMgr::Start() -{ - DHLOGI("Start source device control manager."); - return DH_SUCCESS; -} - -int32_t DAudioSourceDevCtrlMgr::Stop() -{ - return DH_SUCCESS; -} - -int32_t DAudioSourceDevCtrlMgr::Release() -{ - DHLOGI("Release source device control manager."); - return DH_SUCCESS; -} - -bool DAudioSourceDevCtrlMgr::IsOpened() -{ - return true; -} - -int32_t DAudioSourceDevCtrlMgr::SendAudioEvent(const AudioEvent &event) -{ - DHLOGD("Send audio event."); - return DH_SUCCESS; -} -} // namespace DistributedHardware -} // namespace OHOS diff --git a/services/audiocontrol/test/unittest/BUILD.gn b/services/audiocontrol/test/unittest/BUILD.gn deleted file mode 100644 index b71dc28762cf8d80e452b719e5ecb27dcb073ab3..0000000000000000000000000000000000000000 --- a/services/audiocontrol/test/unittest/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# 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. - -import("//build/ohos.gni") -import("//build/ohos_var.gni") -import("../../../../distributedaudio.gni") - -group("daudio_control_test") { - testonly = true - deps = [ - "${audio_control_path}/test/unittest/controlsink:control_sink_test", - "${audio_control_path}/test/unittest/controlsource:control_source_test", - ] -} diff --git a/services/audiocontrol/test/unittest/controlsink/BUILD.gn b/services/audiocontrol/test/unittest/controlsink/BUILD.gn deleted file mode 100644 index d8f272d1e885b4317171434c55a41496966cd6f3..0000000000000000000000000000000000000000 --- a/services/audiocontrol/test/unittest/controlsink/BUILD.gn +++ /dev/null @@ -1,58 +0,0 @@ -# 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. - -import("//build/test.gni") -import("../../../../../distributedaudio.gni") - -module_out_path = "distributed_audio/services/audiocontrol/control_sink_test" - -config("module_private_config") { - visibility = [ ":*" ] - - include_dirs = [ "${fwk_common_path}/utils/include" ] - - include_dirs += [ - "include", - "${common_path}/include", - "${services_path}/common/audiodata/include", - "${services_path}/common/audioeventcallback", - "${services_path}/common/audioparam", - "${audio_transport_path}/interface", - "${audio_transport_path}/audiochannel/interface", - "${audio_transport_path}/audioctrltransport/include", - "${audio_transport_path}/audioctrltransport/interface", - "${audio_control_path}/controlsink/include", - ] -} - -## UnitTest ControlSinkTest -ohos_unittest("ControlSinkTest") { - module_out_path = module_out_path - - sources = [ "src/daudio_sink_dev_ctrl_manager_test.cpp" ] - - configs = [ ":module_private_config" ] - - deps = [ - "${services_path}/audiomanager/servicesink:distributed_audio_sink", - "//third_party/googletest:gmock", - "//third_party/googletest:gtest_main", - ] - - external_deps = [ "c_utils:utils" ] -} - -group("control_sink_test") { - testonly = true - deps = [ ":ControlSinkTest" ] -} diff --git a/services/audiocontrol/test/unittest/controlsink/include/daudio_sink_dev_ctrl_manager_test.h b/services/audiocontrol/test/unittest/controlsink/include/daudio_sink_dev_ctrl_manager_test.h deleted file mode 100644 index 8efbf70e8e1e250bdb59ce38ec7bb75eb65202b0..0000000000000000000000000000000000000000 --- a/services/audiocontrol/test/unittest/controlsink/include/daudio_sink_dev_ctrl_manager_test.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_DAUDIO_SINK_DEV_CTRL_MANAGER_TEST_H -#define OHOS_DAUDIO_SINK_DEV_CTRL_MANAGER_TEST_H - -#include -#include - -#include "audio_event.h" -#include "daudio_errorcode.h" -#include "iaudio_event_callback.h" -#define private public -#include "daudio_sink_dev_ctrl_mgr.h" -#undef private - -namespace OHOS { -namespace DistributedHardware { -class DAudioSinkDevCtrlMgrTest : public testing::Test { -public: - static void SetUpTestCase(void); - static void TearDownTestCase(void); - void SetUp(); - void TearDown(); - - std::shared_ptr sinkDevCtrl_ = nullptr; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_DAUDIO_SINK_DEV_CTRL_MANAGER_TEST_H diff --git a/services/audiocontrol/test/unittest/controlsink/src/daudio_sink_dev_ctrl_manager_test.cpp b/services/audiocontrol/test/unittest/controlsink/src/daudio_sink_dev_ctrl_manager_test.cpp deleted file mode 100644 index 4b064ee0070fa2ed473ee58e923db3836955d57f..0000000000000000000000000000000000000000 --- a/services/audiocontrol/test/unittest/controlsink/src/daudio_sink_dev_ctrl_manager_test.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 "daudio_sink_dev_ctrl_manager_test.h" - -using namespace testing::ext; -namespace OHOS { -namespace DistributedHardware { -void DAudioSinkDevCtrlMgrTest::SetUpTestCase(void) {} - -void DAudioSinkDevCtrlMgrTest::TearDownTestCase(void) {} - -void DAudioSinkDevCtrlMgrTest::SetUp(void) -{ - std::string networkId = "devId"; - std::shared_ptr audioEventCallback = nullptr; - sinkDevCtrl_ = std::make_shared(networkId, audioEventCallback); -} - -void DAudioSinkDevCtrlMgrTest::TearDown(void) -{ - sinkDevCtrl_ = nullptr; -} - -/** - * @tc.name: SetUp_001 - * @tc.desc: Verify the SetUp function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ - -HWTEST_F(DAudioSinkDevCtrlMgrTest, SetUp_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->SetUp()); -} - -/** - * @tc.name: Start_001 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSinkDevCtrlMgrTest, Start_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->Start()); -} - -/** - * @tc.name: Stop_001 - * @tc.desc: Verify the Stop function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSinkDevCtrlMgrTest, Stop_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->Stop()); -} - -/** - * @tc.name: Release_001 - * @tc.desc: Verify the Release function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSinkDevCtrlMgrTest, Release_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->Release()); -} - -/** - * @tc.name: IsOpened_001 - * @tc.desc: Verify the IsOpened function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSinkDevCtrlMgrTest, IsOpened_001, TestSize.Level1) -{ - EXPECT_EQ(true, sinkDevCtrl_->IsOpened()); -} - -/** - * @tc.name: SendAudioEvent_001 - * @tc.desc: Verify the SendAudioEvent function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSinkDevCtrlMgrTest, SendAudioEvent_001, TestSize.Level1) -{ - AudioEvent event; - EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->SendAudioEvent(event)); -} -} // namespace DistributedHardware -} // namespace OHOS diff --git a/services/audiocontrol/test/unittest/controlsource/BUILD.gn b/services/audiocontrol/test/unittest/controlsource/BUILD.gn deleted file mode 100644 index 4bdab18487ff47c93e73d28134d845df8abcaf7f..0000000000000000000000000000000000000000 --- a/services/audiocontrol/test/unittest/controlsource/BUILD.gn +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2022-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") -import("../../../../../distributedaudio.gni") - -module_out_path = "distributed_audio/services/audiocontrol/control_source_test" - -config("module_private_config") { - visibility = [ ":*" ] - - include_dirs = [ "${fwk_common_path}/utils/include" ] - - include_dirs += [ - "include", - "${common_path}/include", - "${services_path}/common/audioparam", - "${services_path}/common/audiodata/include", - "${services_path}/common/audioeventcallback", - "${audio_transport_path}/interface", - "${audio_transport_path}/audiochannel/interface", - "${audio_control_path}/controlsource/include", - ] -} - -## UnitTest ControlSourceTest -ohos_unittest("ControlSourceTest") { - module_out_path = module_out_path - - sources = [ "src/daudio_source_dev_ctrl_manager_test.cpp" ] - - configs = [ ":module_private_config" ] - - deps = [ - "${services_path}/audiomanager/servicesource:distributed_audio_source", - "//third_party/googletest:gmock", - "//third_party/googletest:gtest_main", - ] - - external_deps = [ - "access_token:libaccesstoken_sdk", - "access_token:libnativetoken_shared", - "access_token:libtokensetproc_shared", - "c_utils:utils", - ] -} - -group("control_source_test") { - testonly = true - deps = [ ":ControlSourceTest" ] -} diff --git a/services/audiocontrol/test/unittest/controlsource/include/daudio_source_dev_ctrl_manager_test.h b/services/audiocontrol/test/unittest/controlsource/include/daudio_source_dev_ctrl_manager_test.h deleted file mode 100644 index 50112f33afa228fc825717526816cbf81629df6a..0000000000000000000000000000000000000000 --- a/services/audiocontrol/test/unittest/controlsource/include/daudio_source_dev_ctrl_manager_test.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_DAUDIO_SOURCE_DEV_CTRL_MANAGER_TEST_H -#define OHOS_DAUDIO_SOURCE_DEV_CTRL_MANAGER_TEST_H - -#include -#include - -#include "audio_event.h" -#include "daudio_errorcode.h" -#include "iaudio_event_callback.h" -#define private public -#include "daudio_source_dev_ctrl_mgr.h" -#undef private - -namespace OHOS { -namespace DistributedHardware { -class DAudioSourceDevCtrlMgrTest : public testing::Test { -public: - static void SetUpTestCase(void); - static void TearDownTestCase(void); - void SetUp(); - void TearDown(); - - std::shared_ptr sourceDevCtrl_ = nullptr; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_DAUDIO_SOURCE_DEV_CTRL_MANAGER_TEST_H diff --git a/services/audiocontrol/test/unittest/controlsource/src/daudio_source_dev_ctrl_manager_test.cpp b/services/audiocontrol/test/unittest/controlsource/src/daudio_source_dev_ctrl_manager_test.cpp deleted file mode 100644 index a3a63c8611aa349ebe606466f601cd9222ffaae0..0000000000000000000000000000000000000000 --- a/services/audiocontrol/test/unittest/controlsource/src/daudio_source_dev_ctrl_manager_test.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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 "daudio_source_dev_ctrl_manager_test.h" - -#include "accesstoken_kit.h" -#include "nativetoken_kit.h" -#include "token_setproc.h" - -using namespace testing::ext; - -namespace OHOS { -namespace DistributedHardware { -void DAudioSourceDevCtrlMgrTest::SetUpTestCase(void) {} - -void DAudioSourceDevCtrlMgrTest::TearDownTestCase(void) {} - -void DAudioSourceDevCtrlMgrTest::SetUp(void) -{ - uint64_t tokenId; - const char** perms = new const char *[2]; - perms[0] = "ohos.permission.DISTRIBUTED_DATASYNC"; - perms[1] = "ohos.permission.DISTRIBUTED_SOFTBUS_CENTER"; - NativeTokenInfoParams infoInstance = { - .dcapsNum = 0, - .permsNum = 2, - .aclsNum = 0, - .dcaps = nullptr, - .perms = perms, - .acls = nullptr, - .processName = "daudio_source_dev_ctrl_manager_test", - .aplStr = "system_basic", - }; - tokenId = GetAccessTokenId(&infoInstance); - SetSelfTokenID(tokenId); - - std::string networkId = "devId"; - std::shared_ptr audioEventCallback = nullptr; - sourceDevCtrl_ = std::make_shared(networkId, audioEventCallback); -} - -void DAudioSourceDevCtrlMgrTest::TearDown(void) -{ - sourceDevCtrl_ = nullptr; -} - -/** - * @tc.name: SetUp_001 - * @tc.desc: Verify the SetUp function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSourceDevCtrlMgrTest, SetUp_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sourceDevCtrl_->SetUp()); -} - -/** - * @tc.name: Start_001 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSourceDevCtrlMgrTest, Start_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sourceDevCtrl_->Start()); -} - -/** - * @tc.name: Stop_001 - * @tc.desc: Verify the Stop function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSourceDevCtrlMgrTest, Stop_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sourceDevCtrl_->Stop()); -} - -/** - * @tc.name: Release_001 - * @tc.desc: Verify the Release function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSourceDevCtrlMgrTest, Release_001, TestSize.Level1) -{ - EXPECT_EQ(DH_SUCCESS, sourceDevCtrl_->Release()); -} - -/** - * @tc.name: IsOpened_001 - * @tc.desc: Verify the IsOpened function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSourceDevCtrlMgrTest, IsOpened_001, TestSize.Level1) -{ - EXPECT_EQ(true, sourceDevCtrl_->IsOpened()); -} - -/** - * @tc.name: SendAudioEvent_001 - * @tc.desc: Verify the SendAudioEvent function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSourceDevCtrlMgrTest, SendAudioEvent_001, TestSize.Level1) -{ - AudioEvent event; - EXPECT_EQ(DH_SUCCESS, sourceDevCtrl_->SendAudioEvent(event)); -} -} // namespace DistributedHardware -} // namespace OHOS diff --git a/services/audiomanager/managersink/include/daudio_sink_dev.h b/services/audiomanager/managersink/include/daudio_sink_dev.h index 384fc5ddd417f22609dca0392a2ec3d19338c139..5580e63701ed6edc2a445b4d4792a6bc8139bd24 100644 --- a/services/audiomanager/managersink/include/daudio_sink_dev.h +++ b/services/audiomanager/managersink/include/daudio_sink_dev.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -24,7 +24,6 @@ #include "event_handler.h" -#include "daudio_sink_dev_ctrl_mgr.h" #include "dmic_client.h" #include "dspeaker_client.h" #include "iaudio_event_callback.h" @@ -94,7 +93,6 @@ private: std::map> spkClientMap_; std::mutex micClientMutex_; std::map> micClientMap_; - std::shared_ptr audioCtrlMgr_ = nullptr; static constexpr size_t WAIT_HANDLER_IDLE_TIME_US = 10000; const std::string SUBTYPE = "mic"; sptr ipcSinkCallback_ = nullptr; diff --git a/services/audiomanager/managersource/include/daudio_source_dev.h b/services/audiomanager/managersource/include/daudio_source_dev.h index 10ef8da93efdb2b328a90bc8a4abd60cef670ef4..38241470cca7e4e31a3735af8613cb555fb98104 100644 --- a/services/audiomanager/managersource/include/daudio_source_dev.h +++ b/services/audiomanager/managersource/include/daudio_source_dev.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -25,7 +25,6 @@ #include "audio_event.h" #include "daudio_io_dev.h" -#include "daudio_source_dev_ctrl_mgr.h" #include "daudio_source_mgr_callback.h" #include "dmic_dev.h" #include "dspeaker_dev.h" @@ -139,7 +138,6 @@ private: std::map> deviceMap_; std::shared_ptr speaker_; std::shared_ptr mic_; - std::shared_ptr audioCtrlMgr_; std::mutex rpcWaitMutex_; std::condition_variable rpcWaitCond_; diff --git a/services/audiomanager/servicesink/BUILD.gn b/services/audiomanager/servicesink/BUILD.gn index 7d0ba2f8c1d3cbe30bacbe0348c372d9a764b356..097ff2b33e45ae2395e0bb3088eba66ca4c387f8 100755 --- a/services/audiomanager/servicesink/BUILD.gn +++ b/services/audiomanager/servicesink/BUILD.gn @@ -50,7 +50,6 @@ ohos_shared_library("distributed_audio_sink") { sources = [ "${audio_client_path}/micclient/src/dmic_client.cpp", "${audio_client_path}/spkclient/src/dspeaker_client.cpp", - "${audio_control_path}/controlsink/src/daudio_sink_dev_ctrl_manager.cpp", "${innerkits_path}/native_cpp/audio_sink/src/daudio_sink_handler.cpp", "${innerkits_path}/native_cpp/audio_sink/src/daudio_sink_load_callback.cpp", "${innerkits_path}/native_cpp/audio_sink/src/daudio_sink_proxy.cpp", diff --git a/services/audiomanager/servicesource/BUILD.gn b/services/audiomanager/servicesource/BUILD.gn index c35befe867dee7d989803a3e734f2f0688a94575..77b558497271270c9b3d405d492b7c68bc384052 100755 --- a/services/audiomanager/servicesource/BUILD.gn +++ b/services/audiomanager/servicesource/BUILD.gn @@ -62,7 +62,6 @@ ohos_shared_library("distributed_audio_source") { } sources = [ - "${audio_control_path}/controlsource/src/daudio_source_dev_ctrl_manager.cpp", "${audio_hdi_proxy_path}/src/daudio_hdf_operate.cpp", "${audio_hdi_proxy_path}/src/daudio_hdi_handler.cpp", "${audio_hdi_proxy_path}/src/daudio_manager_callback.cpp", diff --git a/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp b/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp index 7047ff58d45f4f0b5db4dfc6a1fb6964edc86595..4e25132a8ce2d88545ac2cdf71094234aed1d3da 100644 --- a/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp +++ b/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp @@ -486,8 +486,6 @@ HWTEST_F(DAudioSinkDevTest, TaskVolumeChange_001, TestSize.Level1) HWTEST_F(DAudioSinkDevTest, TaskVolumeChange_002, TestSize.Level1) { std::string args; - std::string devId = "devId"; - sinkDev_->audioCtrlMgr_ = std::make_shared(devId, sinkDev_); EXPECT_NE(DH_SUCCESS, sinkDev_->TaskVolumeChange(args)); } @@ -512,8 +510,6 @@ HWTEST_F(DAudioSinkDevTest, TaskFocusChange_001, TestSize.Level1) HWTEST_F(DAudioSinkDevTest, TaskFocusChange_002, TestSize.Level1) { std::string args; - std::string devId = "devId"; - sinkDev_->audioCtrlMgr_ = std::make_shared(devId, sinkDev_); EXPECT_NE(DH_SUCCESS, sinkDev_->TaskFocusChange(args)); } @@ -556,11 +552,9 @@ HWTEST_F(DAudioSinkDevTest, TaskRenderStateChange_001, TestSize.Level1) HWTEST_F(DAudioSinkDevTest, TaskRenderStateChange_002, TestSize.Level1) { std::string args; - std::string devId = "devId"; cJSON *j = cJSON_CreateObject(); CHECK_NULL_VOID(j); AudioParam audioParam; - sinkDev_->audioCtrlMgr_ = std::make_shared(devId, sinkDev_); EXPECT_NE(DH_SUCCESS, sinkDev_->TaskRenderStateChange(args)); EXPECT_EQ(ERR_DH_AUDIO_FAILED, sinkDev_->from_json(j, audioParam)); cJSON_Delete(j); diff --git a/services/audiomanager/test/unittest/sourcedevice/src/daudio_source_dev_test.cpp b/services/audiomanager/test/unittest/sourcedevice/src/daudio_source_dev_test.cpp index 1915e4a5256e095917295cd5f3e785ecba10c6b0..ef8eb51f88461f4e78a78b562aac8432211b1e6a 100644 --- a/services/audiomanager/test/unittest/sourcedevice/src/daudio_source_dev_test.cpp +++ b/services/audiomanager/test/unittest/sourcedevice/src/daudio_source_dev_test.cpp @@ -832,7 +832,6 @@ HWTEST_F(DAudioSourceDevTest, TaskSetVolume_001, TestSize.Level1) */ HWTEST_F(DAudioSourceDevTest, TaskSetVolume_002, TestSize.Level1) { - sourceDev_->audioCtrlMgr_ = std::make_shared(DEV_ID, sourceDev_); EXPECT_NE(DH_SUCCESS, sourceDev_->TaskSetVolume(ARGS)); cJSON *jParam = cJSON_CreateObject(); @@ -893,7 +892,6 @@ HWTEST_F(DAudioSourceDevTest, TaskPlayStatusChange_001, TestSize.Level1) { EXPECT_EQ(ERR_DH_AUDIO_FAILED, sourceDev_->TaskPlayStatusChange(AUDIO_EVENT_PAUSE)); - sourceDev_->audioCtrlMgr_ = std::make_shared(DEV_ID, sourceDev_); sourceDev_->speaker_ = std::make_shared(DEV_ID, nullptr); EXPECT_NE(DH_SUCCESS, sourceDev_->TaskPlayStatusChange(AUDIO_EVENT_PAUSE)); EXPECT_NE(DH_SUCCESS, sourceDev_->TaskPlayStatusChange(AUDIO_EVENT_RESTART));