diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c6ba00f311ae3238aa3e93cf2398faa6e22e13ff --- /dev/null +++ b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn @@ -0,0 +1,64 @@ +# Copyright (c) 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( + "//foundation/distributedhardware/distributed_hardware_fwk/av_transport/distributed_av_transport.gni") + +module_out_path = "distributed_hardware_fwk/histreamer_ability_querier_test" + +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "include", + "//third_party/json/include", + "${handler_path}/histreamer_ability_querier/include", + "${engine_path}/av_sender/include", + "${engine_path}/av_receiver/include", + "${interface_path}", + "${common_path}/include", + "${media_standard_path}/interfaces/inner_api/native", + ] +} + +ohos_unittest("HistreamerAbilityQuerierTest") { + module_out_path = module_out_path + + sources = [ "src/histreamer_ability_querier_test.cpp" ] + + configs = [ ":module_private_config" ] + + deps = [ + "${handler_path}/histreamer_ability_querier:histreamer_ability_querier", + "//third_party/googletest:gtest_main", + ] + + external_deps = [ + "c_utils:utils", + "histreamer:histreamer_base", + "histreamer:histreamer_codec_filters", + "histreamer:histreamer_ffmpeg_convert", + "histreamer:histreamer_plugin_base", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"HistreamerAbilityQuerierTest\"", + ] +} + +group("histreamer_ability_querier_test") { + testonly = true + deps = [ ":HistreamerAbilityQuerierTest" ] +} diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/include/histreamer_ability_querier_test.h b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/include/histreamer_ability_querier_test.h new file mode 100644 index 0000000000000000000000000000000000000000..abbbf30ab8e7d3395c88792dc25ac702a8eb9ad7 --- /dev/null +++ b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/include/histreamer_ability_querier_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 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. + */ + +#ifndef OHOS_DISTRIBUTED_HARDWARE_HISTREAMER_ABILITY_QUERIER_TEST_H +#define OHOS_DISTRIBUTED_HARDWARE_HISTREAMER_ABILITY_QUERIER_TEST_H + +#include "nlohmann/json.hpp" +#include + +namespace OHOS { +namespace DistributedHardware { +class HistreamerAbilityQuerierTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; +bool IsUInt8(const nlohmann::json& jsonObj, const std::string& key); + +bool IsUInt32(const nlohmann::json& jsonObj, const std::string& key); + +bool IsString(const nlohmann::json& jsonObj, const std::string& key); +} // namespace DistributedHardware +} // namespace OHOS +#endif \ No newline at end of file diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/src/histreamer_ability_querier_test.cpp b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/src/histreamer_ability_querier_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3da6be10f8f975f89d43ebd2e89bdbeb12204569 --- /dev/null +++ b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/src/histreamer_ability_querier_test.cpp @@ -0,0 +1,514 @@ +/* + * Copyright (c) 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 "histreamer_ability_querier_test.h" +#include "histreamer_ability_querier.h" + +#include +#include +#include +#include + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void HistreamerAbilityQuerierTest::SetUpTestCase(void) {} + +void HistreamerAbilityQuerierTest::TearDownTestCase(void) {} + +void HistreamerAbilityQuerierTest::SetUp() {} + +void HistreamerAbilityQuerierTest::TearDown() {} + +namespace { +int32_t g_maxMessagesLen = 1 * 1024 * 1024; +static const std::uint16_t NUM = 1; +static const std::string KEY = "key"; +static const std::string NAME = "name"; +static const std::string MIME = "mime"; +static const std::string AD_MPEG_VER = "ad_mpeg_ver"; +static const std::string AUDIO_AAC_PROFILE = "aac_profile"; +static const std::string AUDIO_AAC_STREAM_FORMAT = "aac_stm_fmt"; + +static const std::vector AUDIO_ENCODER_WANT = { "ffmpegAuEnc_aac" }; +static const std::vector AUDIO_DECODER_WANT = { "ffmpegAuDec_aac" }; +static const std::vector VIDEO_ENCODER_WANT = { + "HdiCodecAdapter.OMX.hisi.video.encoder.hevc", + "HdiCodecAdapter.OMX.hisi.video.encoder.avc", + "HdiCodecAdapter.OMX.rk.video_encoder.hevc", + "HdiCodecAdapter.OMX.rk.video_encoder.avc" + }; +static const std::vector VIDEO_DECODER_WANT = { + "HdiCodecAdapter.OMX.hisi.video.decoder.hevc", + "HdiCodecAdapter.OMX.hisi.video.decoder.avc", + "HdiCodecAdapter.OMX.rk.video_decoder.hevc", + "HdiCodecAdapter.OMX.rk.video_decoder.avc" + }; +} + +/** + * @tc.name:histreamer_ability_querier_test_001 + * @tc.desc: Verify the QueryAudioEncoderAbility function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_001, TestSize.Level0) +{ + std::vector audioEncoders = QueryAudioEncoderAbility(); + EXPECT_FALSE(audioEncoders.empty()); + EXPECT_EQ(NUM, audioEncoders.size()); + EXPECT_STREQ(AUDIO_ENCODER_WANT.front().c_str(), audioEncoders.front().name.c_str()); +} + +/** + * @tc.name: histreamer_ability_querier_test_002 + * @tc.desc: Verify QueryAudioDecoderAbility function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_002, TestSize.Level0) +{ + std::vector audioDecoders = QueryAudioDecoderAbility(); + EXPECT_FALSE(audioDecoders.empty()); + EXPECT_EQ(NUM, audioDecoders.size()); + EXPECT_STREQ(AUDIO_DECODER_WANT.front().c_str(), audioDecoders.front().name.c_str()); +} + +/** + * @tc.name: histreamer_ability_querier_test_003 + * @tc.desc: Verify QueryVideoEncoderAbility function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_003, TestSize.Level0) +{ + std::vector videoEncoders = QueryVideoEncoderAbility(); + EXPECT_FALSE(videoEncoders.empty() || videoEncoders.size() > 4); + for (std::uint16_t i = 0; i < videoEncoders.size(); i++) { + auto it = find(VIDEO_ENCODER_WANT.begin(), VIDEO_ENCODER_WANT.end(), videoEncoders[i].name); + EXPECT_TRUE(it != VIDEO_ENCODER_WANT.end()); + } +} + +/** + * @tc.name: histreamer_ability_querier_test_004 + * @tc.desc: Verify QueryVideoDecoderAbility function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + * + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_004, TestSize.Level0) +{ + std::vector videoDecoders = QueryVideoDecoderAbility(); + EXPECT_FALSE(videoDecoders.empty() || videoDecoders.size() > 4); + for (std::uint16_t i = 0; i < videoDecoders.size(); i++) { + auto it = find(VIDEO_DECODER_WANT.begin(), VIDEO_DECODER_WANT.end(), videoDecoders[i].name); + EXPECT_TRUE(it != VIDEO_DECODER_WANT.end()); + } +} + +/** + * @tc.name: histreamer_ability_querier_test_005 + * @tc.desc: Verify QueryAudioEncoderAbilityStr function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_005, TestSize.Level0) +{ + char* RES_MAX = new char[g_maxMessagesLen]; + EXPECT_TRUE(QueryAudioEncoderAbilityStr(RES_MAX) >= 0); + EXPECT_TRUE(QueryAudioEncoderAbilityStr(RES_MAX) <= g_maxMessagesLen); + delete[] RES_MAX; +} + +/** + * @tc.name: histreamer_ability_querier_test_006 + * @tc.desc: Verify QueryAudioDecoderAbilityStr function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_006, TestSize.Level0) +{ + char* RES_MAX = new char[g_maxMessagesLen]; + EXPECT_TRUE(QueryAudioDecoderAbilityStr(RES_MAX) >= 0); + EXPECT_TRUE(QueryAudioDecoderAbilityStr(RES_MAX) <= g_maxMessagesLen); + delete[] RES_MAX; +} + +/** + * @tc.name: histreamer_ability_querier_test_007 + * @tc.desc: Verify QueryVideoEncoderAbilityStr function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_007, TestSize.Level0) +{ + char* RES_MAX = new char[g_maxMessagesLen]; + EXPECT_TRUE(QueryVideoEncoderAbilityStr(RES_MAX) >= 0); + EXPECT_TRUE(QueryVideoEncoderAbilityStr(RES_MAX) <= g_maxMessagesLen); + delete[] RES_MAX; +} + +/** + * @tc.name: histreamer_ability_querier_test_008 + * @tc.desc: Verify the QueryVideoDecoderAbilityStr function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_008, TestSize.Level0) +{ + char* RES_MAX = new char[g_maxMessagesLen]; + EXPECT_TRUE(QueryVideoDecoderAbilityStr(RES_MAX) >= 0); + EXPECT_TRUE(QueryVideoDecoderAbilityStr(RES_MAX) <= g_maxMessagesLen); + delete[] RES_MAX; +} + +/** + * @tc.name: histreamer_ability_querier_test_009 + * @tc.desc: Verify the IsString function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_009, TestSize.Level0) +{ + nlohmann::json jsonObject; + jsonObject[KEY] = "testing str"; + EXPECT_TRUE(IsString(jsonObject, KEY)); + + jsonObject[KEY] = 1; + EXPECT_FALSE(IsString(jsonObject, KEY)); +} + +/** + * @tc.name: histreamer_ability_querier_test_010 + * @tc.desc: Verify the IsUint8 function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_010, TestSize.Level0) +{ + nlohmann::json jsonObject; + const uint8_t num_s = 1; + jsonObject[KEY] = num_s; + EXPECT_TRUE(IsUInt8(jsonObject, KEY)); + + const uint16_t num_b = UINT8_MAX + 1 ; + jsonObject[KEY] = num_b; + EXPECT_FALSE(IsUInt8(jsonObject, KEY)); +} + +/** + * @tc.name: histreamer_ability_querier_test_011 + * @tc.desc: Verify the IsUInt32 function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_011, TestSize.Level0) +{ + nlohmann::json jsonObject; + const uint32_t num_s = 1; + jsonObject[KEY] = num_s; + EXPECT_TRUE(IsUInt32(jsonObject, KEY)); + + const int32_t num_i = -1; + jsonObject[KEY] = num_i; + EXPECT_FALSE(IsUInt32(jsonObject, KEY)); +} + +/** + * @tc.name: histreamer_ability_querier_test_012 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioEncoderIn &audioEncoderIn) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_012, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioEncoderIn audioEncoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioEncoderIn); + EXPECT_TRUE(audioEncoderIn.mime.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_013 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioEncoderOut &audioEncoderOut) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_013, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioEncoderOut audioEncoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioEncoderOut); + EXPECT_TRUE(audioEncoderOut.mime.empty()); + + jsonObject[MIME] = "audio/mp4a-latm"; + jsonObject[AD_MPEG_VER] = "hello"; + FromJson(jsonObject, audioEncoderOut); + EXPECT_EQ("audio/mp4a-latm", audioEncoderOut.mime); + + jsonObject[AD_MPEG_VER] = (uint32_t)4; + jsonObject[AUDIO_AAC_PROFILE] = "hello"; + FromJson(jsonObject, audioEncoderOut); + EXPECT_EQ(4, (uint32_t)audioEncoderOut.ad_mpeg_ver); + + jsonObject[AUDIO_AAC_PROFILE] = 0; + jsonObject[AUDIO_AAC_STREAM_FORMAT] = "hello"; + FromJson(jsonObject, audioEncoderOut); + EXPECT_EQ(0, (uint32_t)audioEncoderOut.aac_profile); +} + +/** + * @tc.name: histreamer_ability_querier_test_014 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioEncoder &audioEncoder) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_014, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioEncoder audioEncoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, audioEncoder); + EXPECT_TRUE(audioEncoder.name.empty()); + + jsonObject[NAME] = "ffmpegAuEnc_aac"; + FromJson(jsonObject, audioEncoder); + EXPECT_EQ("ffmpegAuEnc_aac", audioEncoder.name); + EXPECT_TRUE(audioEncoder.ins.empty()); + + AudioEncoderIn audioEncoderIn; + audioEncoderIn.mime = "audio/raw"; + audioEncoderIn.sample_rate = {96000, 88200, 64000, 48000, 44100, 32000}; + audioEncoder.ins.push_back(audioEncoderIn); + FromJson(jsonObject, audioEncoder); + EXPECT_FALSE(audioEncoder.ins.empty()); + EXPECT_TRUE(audioEncoder.outs.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_015 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioDecoderIn &audioDecoderIn) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_015, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioDecoderIn audioDecoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioDecoderIn); + EXPECT_TRUE(audioDecoderIn.mime.empty()); + + jsonObject[MIME] = "audio/mp4a-latm"; + FromJson(jsonObject, audioDecoderIn); + EXPECT_EQ("audio/mp4a-latm", audioDecoderIn.mime); + EXPECT_TRUE(audioDecoderIn.channel_layout.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_016 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioDecoderOut &audioDecoderOut) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_016, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioDecoderOut audioDecoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioDecoderOut); + EXPECT_TRUE(audioDecoderOut.mime.empty()); + + jsonObject[MIME] = "audio/raw"; + FromJson(jsonObject, audioDecoderOut); + EXPECT_EQ("audio/raw", audioDecoderOut.mime); + EXPECT_TRUE(audioDecoderOut.sample_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_017 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioDecoder &audioDecoder) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_017, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioDecoder audioDecoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, audioDecoder); + EXPECT_TRUE(audioDecoder.name.empty()); + + jsonObject[NAME] = "ffmpegAuDec_aac"; + FromJson(jsonObject, audioDecoder); + EXPECT_EQ("ffmpegAuDec_aac", audioDecoder.name); + EXPECT_TRUE(audioDecoder.ins.empty()); + + AudioDecoderIn audioDecoderIn; + audioDecoderIn.mime = "audio/mp4a-latm"; + audioDecoderIn.channel_layout = { + AudioChannelLayout::CH_2POINT1, + AudioChannelLayout::CH_2_1, + AudioChannelLayout::SURROUND, + }; + audioDecoder.ins.push_back(audioDecoderIn); + FromJson(jsonObject, audioDecoder); + EXPECT_FALSE(audioDecoder.ins.empty()); + EXPECT_TRUE(audioDecoder.outs.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_018 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoEncoderIn &videoEncoderIn) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_018, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoEncoderIn videoEncoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoEncoderIn); + EXPECT_TRUE(videoEncoderIn.mime.empty()); + + jsonObject[MIME] = "video/raw"; + FromJson(jsonObject, videoEncoderIn); + EXPECT_EQ("video/raw", videoEncoderIn.mime); + EXPECT_TRUE(videoEncoderIn.pixel_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_019 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoEncoderOut &videoEncoderOut) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_019, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoEncoderOut videoEncoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoEncoderOut); + EXPECT_TRUE(videoEncoderOut.mime.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_020 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoEncoder &videoEncoder) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_020, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoEncoder videoEncoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, videoEncoder); + EXPECT_TRUE(videoEncoder.name.empty()); + + jsonObject[NAME] = "HdiCodecAdapter.OMX.rk.video_encoder.hevc"; + FromJson(jsonObject, videoEncoder); + EXPECT_EQ("HdiCodecAdapter.OMX.rk.video_encoder.hevc", videoEncoder.name); + EXPECT_TRUE(videoEncoder.ins.empty()); + + VideoEncoderIn videoEncoderIn; + videoEncoderIn.mime = "vide/raw"; + videoEncoderIn.pixel_fmt = { + VideoPixelFormat::YUV410P, + VideoPixelFormat::RGBA, + }; + videoEncoder.ins.push_back(videoEncoderIn); + FromJson(jsonObject, videoEncoder); + EXPECT_FALSE(videoEncoder.ins.empty()); + EXPECT_TRUE(videoEncoder.outs.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_021 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoDecoderIn &videoDecoderIn) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_021, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoDecoderIn videoDecoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoDecoderIn); + EXPECT_TRUE(videoDecoderIn.mime.empty()); + + jsonObject[MIME] = "video/hevc"; + FromJson(jsonObject, videoDecoderIn); + EXPECT_EQ("video/hevc", videoDecoderIn.mime); + EXPECT_TRUE(videoDecoderIn.vd_bit_stream_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_022 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoDecoderOut &videoDecoderOut) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_022, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoDecoderOut videoDecoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoDecoderOut); + EXPECT_TRUE(videoDecoderOut.mime.empty()); + + jsonObject[MIME] = "video/raw"; + FromJson(jsonObject, videoDecoderOut); + EXPECT_EQ("video/raw", videoDecoderOut.mime); + EXPECT_TRUE(videoDecoderOut.pixel_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_querier_test_023 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoDecoder &videoDecoder) function. + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityQuerierTest, histreamer_ability_querier_test_023, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoDecoder videoDecoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, videoDecoder); + EXPECT_TRUE(videoDecoder.name.empty()); + + jsonObject[NAME] = "HdiCodecAdapter.OMX.rk.video_decoder.hevc"; + FromJson(jsonObject, videoDecoder); + EXPECT_EQ("HdiCodecAdapter.OMX.rk.video_decoder.hevc", videoDecoder.name); + EXPECT_TRUE(videoDecoder.ins.empty()); + + VideoDecoderIn videoDecoderIn; + videoDecoderIn.mime = "vide/avc"; + videoDecoderIn.vd_bit_stream_fmt = { + VideoBitStreamFormat::AVC1, + VideoBitStreamFormat::HEVC, + }; + videoDecoder.ins.push_back(videoDecoderIn); + FromJson(jsonObject, videoDecoder); + EXPECT_FALSE(videoDecoder.ins.empty()); + EXPECT_TRUE(videoDecoder.outs.empty()); +} + +} // namespace DistributedHardware +} // namespace OHOS \ No newline at end of file diff --git a/bundle.json b/bundle.json index bfe9c1cc247281f69e8048f592e22547fa3c2188..2e00f11c1db18448bc3e73ae475868a28aa0f0c6 100644 --- a/bundle.json +++ b/bundle.json @@ -107,6 +107,7 @@ } ], "test": [ + "//foundation/distributedhardware/distributed_hardware_fwk/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common:histreamer_ability_querier_test", "//foundation/distributedhardware/distributed_hardware_fwk/utils/test/unittest:utils_test", "//foundation/distributedhardware/distributed_hardware_fwk/services/distributedhardwarefwkservice/test/unittest:test", "//foundation/distributedhardware/distributed_hardware_fwk/interfaces/inner_kits/test/unittest:kit_test", diff --git a/utils/test/unittest/BUILD.gn b/utils/test/unittest/BUILD.gn index 9333ec9c4af301f4630ec10f7a5ad8cdb413b8b5..fb9faf0b9c3dcf47754c26e63ab4d5cced281cd2 100644 --- a/utils/test/unittest/BUILD.gn +++ b/utils/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 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 @@ -16,6 +16,7 @@ group("utils_test") { deps = [ "common/eventbus:event_bus_test", "common/eventtrance:event_trance_test", + "common/histreamer_ability_parser:histreamer_ability_parser_test", "common/utilstool:utils_tool_test", ] } diff --git a/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn b/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0f2046f3f5e8fefabb3ea86c68b25a84c4dbe537 --- /dev/null +++ b/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn @@ -0,0 +1,49 @@ +# Copyright (c) 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( + "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") + +module_out_path = "distributed_hardware_fwk/histreamer_ability_parser_test" + +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "include", + "${utils_path}/include", + "${utils_path}/include/log", + "//third_party/json/include", + ] +} + +## UnitTest histreamer_ability_parser_test +ohos_unittest("HistreamerAbilityParserTest") { + module_out_path = module_out_path + + sources = [ "${utils_path}/test/unittest/common/histreamer_ability_parser/histreamer_ability_parser_test.cpp" ] + + configs = [ ":module_private_config" ] + + deps = [ + "${utils_path}:distributedhardwareutils", + "//third_party/googletest:gtest_main", + ] + + external_deps = [ "c_utils:utils" ] +} + +group("histreamer_ability_parser_test") { + testonly = true + deps = [ ":HistreamerAbilityParserTest" ] +} diff --git a/utils/test/unittest/common/histreamer_ability_parser/histreamer_ability_parser_test.cpp b/utils/test/unittest/common/histreamer_ability_parser/histreamer_ability_parser_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d3bfea9bf47e9a34b7a27e7f307611a19d4e2d06 --- /dev/null +++ b/utils/test/unittest/common/histreamer_ability_parser/histreamer_ability_parser_test.cpp @@ -0,0 +1,409 @@ +/* + * Copyright (c) 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 "histreamer_ability_parser_test.h" +#include +#include + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +static const std::string NAME = "name"; +static const std::string INS = "ins"; +static const std::string OUTS = "outs"; +static const std::string MIME = "mime"; +static const std::string SAMPLE_RATE = "sample_rate"; +static const std::string AD_MPEG_VER = "ad_mpeg_ver"; +static const std::string AUDIO_AAC_PROFILE = "aac_profile"; +static const std::string AUDIO_AAC_STREAM_FORMAT = "aac_stm_fmt"; +static const std::string VIDEO_PIXEL_FMT = "pixel_fmt"; + +void HistreamerAbilityParserTest::SetUpTestCase(void) {} + +void HistreamerAbilityParserTest::TearDownTestCase(void) {} + +void HistreamerAbilityParserTest::SetUp() {} + +void HistreamerAbilityParserTest::TearDown() {} + +/** + * @tc.name: histreamer_ability_parser_test_001 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioEncoderIn &audioEncoderIn) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_001, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioEncoderIn audioEncoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioEncoderIn); + EXPECT_TRUE(audioEncoderIn.mime.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_002 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioEncoderOut &audioEncoderOut) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_002, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioEncoderOut audioEncoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioEncoderOut); + EXPECT_TRUE(audioEncoderOut.mime.empty()); + + jsonObject[MIME] = "audio/mp4a-latm"; + jsonObject[AD_MPEG_VER] = "hello"; + FromJson(jsonObject, audioEncoderOut); + EXPECT_EQ("audio/mp4a-latm", audioEncoderOut.mime); + + jsonObject[AD_MPEG_VER] = (uint32_t)4; + jsonObject[AUDIO_AAC_PROFILE] = "hello"; + FromJson(jsonObject, audioEncoderOut); + EXPECT_EQ(4, (uint32_t)audioEncoderOut.ad_mpeg_ver); + + jsonObject[AUDIO_AAC_PROFILE] = 0; + jsonObject[AUDIO_AAC_STREAM_FORMAT] = "hello"; + FromJson(jsonObject, audioEncoderOut); + EXPECT_EQ(0, (uint32_t)audioEncoderOut.aac_profile); +} + +/** + * @tc.name: histreamer_ability_parser_test_003 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioEncoder &audioEncoder) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_003, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioEncoder audioEncoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, audioEncoder); + EXPECT_TRUE(audioEncoder.name.empty()); + + jsonObject[NAME] = "ffmpegAuEnc_aac"; + FromJson(jsonObject, audioEncoder); + EXPECT_EQ("ffmpegAuEnc_aac", audioEncoder.name); + EXPECT_TRUE(audioEncoder.ins.empty()); + + AudioEncoderIn audioEncoderIn; + audioEncoderIn.mime = "audio/raw"; + audioEncoderIn.sample_rate = {96000, 88200, 64000, 48000, 44100, 32000}; + audioEncoder.ins.push_back(audioEncoderIn); + FromJson(jsonObject, audioEncoder); + EXPECT_FALSE(audioEncoder.ins.empty()); + EXPECT_TRUE(audioEncoder.outs.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_004 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioDecoderIn &audioDecoderIn) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_004, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioDecoderIn audioDecoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioDecoderIn); + EXPECT_TRUE(audioDecoderIn.mime.empty()); + + jsonObject[MIME] = "audio/mp4a-latm"; + FromJson(jsonObject, audioDecoderIn); + EXPECT_EQ("audio/mp4a-latm", audioDecoderIn.mime); + EXPECT_TRUE(audioDecoderIn.channel_layout.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_005 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioDecoderOut &audioDecoderOut) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_005, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioDecoderOut audioDecoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, audioDecoderOut); + EXPECT_TRUE(audioDecoderOut.mime.empty()); + + jsonObject[MIME] = "audio/raw"; + FromJson(jsonObject, audioDecoderOut); + EXPECT_EQ("audio/raw", audioDecoderOut.mime); + EXPECT_TRUE(audioDecoderOut.sample_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_006 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, AudioDecoder &audioDecoder) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_006, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioDecoder audioDecoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, audioDecoder); + EXPECT_TRUE(audioDecoder.name.empty()); + + jsonObject[NAME] = "ffmpegAuDec_aac"; + FromJson(jsonObject, audioDecoder); + EXPECT_EQ("ffmpegAuDec_aac", audioDecoder.name); + EXPECT_TRUE(audioDecoder.ins.empty()); + + AudioDecoderIn audioDecoderIn; + audioDecoderIn.mime = "audio/mp4a-latm"; + audioDecoderIn.channel_layout = { + AudioChannelLayout::CH_2POINT1, + AudioChannelLayout::CH_2_1, + AudioChannelLayout::SURROUND, + }; + audioDecoder.ins.push_back(audioDecoderIn); + FromJson(jsonObject, audioDecoder); + EXPECT_FALSE(audioDecoder.ins.empty()); + EXPECT_TRUE(audioDecoder.outs.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_007 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoEncoderIn &videoEncoderIn) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_007, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoEncoderIn videoEncoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoEncoderIn); + EXPECT_TRUE(videoEncoderIn.mime.empty()); + + jsonObject[MIME] = "video/raw"; + FromJson(jsonObject, videoEncoderIn); + EXPECT_EQ("video/raw", videoEncoderIn.mime); + EXPECT_TRUE(videoEncoderIn.pixel_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_008 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoEncoderOut &videoEncoderOut) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_008, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoEncoderOut videoEncoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoEncoderOut); + EXPECT_TRUE(videoEncoderOut.mime.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_009 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoEncoder &videoEncoder) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_009, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoEncoder videoEncoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, videoEncoder); + EXPECT_TRUE(videoEncoder.name.empty()); + + jsonObject[NAME] = "HdiCodecAdapter.OMX.rk.video_encoder.hevc"; + FromJson(jsonObject, videoEncoder); + EXPECT_EQ("HdiCodecAdapter.OMX.rk.video_encoder.hevc", videoEncoder.name); + EXPECT_TRUE(videoEncoder.ins.empty()); + + VideoEncoderIn videoEncoderIn; + videoEncoderIn.mime = "vide/raw"; + videoEncoderIn.pixel_fmt = { + VideoPixelFormat::YUV410P, + VideoPixelFormat::RGBA, + }; + videoEncoder.ins.push_back(videoEncoderIn); + FromJson(jsonObject, videoEncoder); + EXPECT_FALSE(videoEncoder.ins.empty()); + EXPECT_TRUE(videoEncoder.outs.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_010 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoDecoderIn &videoDecoderIn) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_010, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoDecoderIn videoDecoderIn; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoDecoderIn); + EXPECT_TRUE(videoDecoderIn.mime.empty()); + + jsonObject[MIME] = "video/hevc"; + FromJson(jsonObject, videoDecoderIn); + EXPECT_EQ("video/hevc", videoDecoderIn.mime); + EXPECT_TRUE(videoDecoderIn.vd_bit_stream_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_011 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoDecoderOut &videoDecoderOut) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_011, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoDecoderOut videoDecoderOut; + jsonObject[MIME] = 1; + FromJson(jsonObject, videoDecoderOut); + EXPECT_TRUE(videoDecoderOut.mime.empty()); + + jsonObject[MIME] = "video/raw"; + FromJson(jsonObject, videoDecoderOut); + EXPECT_EQ("video/raw", videoDecoderOut.mime); + EXPECT_TRUE(videoDecoderOut.pixel_fmt.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_012 + * @tc.desc: Verify the FromJson(const nlohmann::json &jsonObject, VideoDecoder &videoDecoder) function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_012, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoDecoder videoDecoder; + jsonObject[NAME] = 1; + FromJson(jsonObject, videoDecoder); + EXPECT_TRUE(videoDecoder.name.empty()); + + jsonObject[NAME] = "HdiCodecAdapter.OMX.rk.video_decoder.hevc"; + FromJson(jsonObject, videoDecoder); + EXPECT_EQ("HdiCodecAdapter.OMX.rk.video_decoder.hevc", videoDecoder.name); + EXPECT_TRUE(videoDecoder.ins.empty()); + + VideoDecoderIn videoDecoderIn; + videoDecoderIn.mime = "vide/avc"; + videoDecoderIn.vd_bit_stream_fmt = { + VideoBitStreamFormat::AVC1, + VideoBitStreamFormat::HEVC, + }; + videoDecoder.ins.push_back(videoDecoderIn); + FromJson(jsonObject, videoDecoder); + EXPECT_FALSE(videoDecoder.ins.empty()); + EXPECT_TRUE(videoDecoder.outs.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_013 + * @tc.desc: Verify the FromJson function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_013, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioEncoder audioEncoder; + jsonObject[NAME] = "ffmpegAuEnc_aac"; + audioEncoder.name = "ffmpegAuEnc_aac"; + std::vectoraudioEncoders; + + FromJson(VIDEO_PIXEL_FMT, jsonObject, audioEncoders); + EXPECT_TRUE(audioEncoders.empty()); + + FromJson(NAME, jsonObject, audioEncoders); + EXPECT_FALSE(audioEncoders.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_014 + * @tc.desc: Verify the FromJson function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_014, TestSize.Level0) +{ + nlohmann::json jsonObject; + AudioDecoder audioDecoder; + jsonObject[NAME] = "ffmpegAuDec_aac"; + audioDecoder.name = "ffmpegAuDec_aac"; + std::vectoraudioDecoders; + + FromJson(VIDEO_PIXEL_FMT, jsonObject, audioDecoders); + EXPECT_TRUE(audioDecoders.empty()); + + FromJson(NAME, jsonObject, audioDecoders); + EXPECT_FALSE(audioDecoders.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_015 + * @tc.desc: Verify the FromJson function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_015, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoEncoder videoEncoder; + jsonObject[NAME] = "HdiCodecAdapter.OMX.rk.video_encoder.hevc"; + videoEncoder.name = "HdiCodecAdapter.OMX.rk.video_encoder.hevc"; + std::vectorvideoEncoders; + + FromJson(AUDIO_AAC_PROFILE, jsonObject, videoEncoders); + EXPECT_TRUE(videoEncoders.empty()); + + FromJson(NAME, jsonObject, videoEncoders); + EXPECT_FALSE(videoEncoders.empty()); +} + +/** + * @tc.name: histreamer_ability_parser_test_016 + * @tc.desc: Verify the FromJson function + * @tc.type: FUNC + * @tc.require: issuelI7MJPJ + */ +HWTEST_F(HistreamerAbilityParserTest, histreamer_ability_parser_test_016, TestSize.Level0) +{ + nlohmann::json jsonObject; + VideoDecoder videoDecoder; + jsonObject[NAME] = "HdiCodecAdapter.OMX.rk.video_decoder.hevc"; + videoDecoder.name = "HdiCodecAdapter.OMX.rk.video_decoder.hevc"; + std::vectorvideoDecoders; + + FromJson(AUDIO_AAC_PROFILE, jsonObject, videoDecoders); + EXPECT_TRUE(videoDecoders.empty()); + + FromJson(NAME, jsonObject, videoDecoders); + EXPECT_FALSE(videoDecoders.empty()); +} + +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/test/unittest/common/histreamer_ability_parser/histreamer_ability_parser_test.h b/utils/test/unittest/common/histreamer_ability_parser/histreamer_ability_parser_test.h new file mode 100644 index 0000000000000000000000000000000000000000..65d7279ddcb84385715567a5b74606cd828d15aa --- /dev/null +++ b/utils/test/unittest/common/histreamer_ability_parser/histreamer_ability_parser_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 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. + */ + +#ifndef OHOS_DISTRIBUTED_HARDWARE_HISTREAMER_ABILITY_PARSER_TEST_H +#define OHOS_DISTRIBUTED_HARDWARE_HISTREAMER_ABILITY_PARSER_TEST_H + +#include "histreamer_ability_parser.h" +#include "nlohmann/json.hpp" +#include +#include +#include +#include + +namespace OHOS { +namespace DistributedHardware { +class HistreamerAbilityParserTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif \ No newline at end of file