mirror of
https://github.com/openharmony/multimedia_av_session.git
synced 2026-08-25 06:18:12 -04:00
9173d71f24
Co-Authored-By: Agent Signed-off-by: xuhy <xuhuanyu2@huawei.com>
1716 lines
57 KiB
C++
1716 lines
57 KiB
C++
/*
|
|
* Copyright (c) 2023-2025 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 <cstdint>
|
|
#include <gtest/gtest.h>
|
|
#include <memory>
|
|
#include "avsession_errors.h"
|
|
#include "avsession_log.h"
|
|
#include "hw_cast_stream_player.h"
|
|
#include "hw_cast_provider.h"
|
|
#include "hw_cast_display_listener.h"
|
|
|
|
using namespace testing::ext;
|
|
using namespace OHOS::AVSession;
|
|
|
|
class IAVCastSessionStateListenerTest : public IAVCastSessionStateListener {
|
|
public:
|
|
IAVCastSessionStateListenerTest() = default;
|
|
virtual ~IAVCastSessionStateListenerTest() = default;
|
|
void OnCastStateChange(int32_t castState, DeviceInfo deviceInfo, int32_t reasonCode) override {};
|
|
void OnCastEventRecv(int32_t errorCode, std::string& errorMsg) override {};
|
|
};
|
|
|
|
class HwCastTest : public testing::Test {
|
|
public:
|
|
static void SetUpTestCase(void);
|
|
static void TearDownTestCase(void);
|
|
void SetUp();
|
|
void TearDown();
|
|
};
|
|
|
|
void HwCastTest::SetUpTestCase()
|
|
{}
|
|
|
|
void HwCastTest::TearDownTestCase()
|
|
{}
|
|
|
|
void HwCastTest::SetUp()
|
|
{}
|
|
|
|
void HwCastTest::TearDown()
|
|
{}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerInit001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerInit001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerInit001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
SLOGI("HwCastStreamPlayerInit001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerRelease001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerRelease001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerRelease001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Release();
|
|
SLOGI("HwCastStreamPlayerRelease001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommand001
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_INVALID
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommand001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommand001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_INVALID);
|
|
streamplayer->SendControlCommand(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommand001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommand002
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_PLAY
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommand002, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommand002 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_PLAY);
|
|
streamplayer->SendControlCommand(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommand002 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommand003
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_PAUSE
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommand003, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommand003 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_PAUSE);
|
|
streamplayer->SendControlCommand(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommand003 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommand004
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_STOP
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommand004, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommand004 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_STOP);
|
|
streamplayer->SendControlCommand(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommand004 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommand005
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_PLAY_NEXT
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommand005, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommand005 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_PLAY_NEXT);
|
|
streamplayer->SendControlCommand(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommand005 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommand006
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_PLAY_PREVIOUS
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommand006, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommand006 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_PLAY_PREVIOUS);
|
|
streamplayer->SendControlCommand(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommand006 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerGetCurrentItem001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerGetCurrentItem001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerGetCurrentItem001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVQueueItem item = streamplayer->GetCurrentItem();
|
|
SLOGI("HwCastStreamPlayerGetCurrentItem001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerStart001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerStart001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerStart001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVQueueItem item;
|
|
std::shared_ptr<AVMediaDescription> description = std::make_shared<AVMediaDescription>();
|
|
description->SetMediaId("123");
|
|
description->SetTitle("Title");
|
|
description->SetSubtitle("Subtitle");
|
|
description->SetDescription("This is music description");
|
|
description->SetIcon(nullptr);
|
|
description->SetIconUri("xxxxx");
|
|
description->SetExtras(nullptr);
|
|
description->SetMediaUri("Media url");
|
|
item.SetDescription(description);
|
|
int32_t ret = streamplayer->Start(item);
|
|
EXPECT_EQ(ret, AVSESSION_ERROR);
|
|
SLOGI("HwCastStreamPlayerStart001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerPrepare001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerPrepare001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerPrepare001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVQueueItem item;
|
|
std::shared_ptr<AVMediaDescription> description = std::make_shared<AVMediaDescription>();
|
|
description->SetMediaId("123");
|
|
description->SetTitle("Title");
|
|
description->SetSubtitle("Subtitle");
|
|
description->SetDescription("This is music description");
|
|
description->SetIcon(nullptr);
|
|
description->SetIconUri("xxxxx");
|
|
description->SetExtras(nullptr);
|
|
description->SetMediaUri("Media url");
|
|
item.SetDescription(description);
|
|
int32_t ret = streamplayer->Prepare(item);
|
|
EXPECT_EQ(ret, AVSESSION_ERROR);
|
|
SLOGI("HwCastStreamPlayerPrepare001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerGetDuration001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerGetDuration001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerGetDuration001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int32_t duration = 0;
|
|
int32_t ret = streamplayer->GetDuration(duration);
|
|
EXPECT_EQ(ret, AVSESSION_ERROR);
|
|
SLOGI("HwCastStreamPlayerGetDuration001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerGetCastAVPlaybackState001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerGetCastAVPlaybackState001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerGetCastAVPlaybackState001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVPlaybackState avPlaybackState;
|
|
int32_t ret = streamplayer->GetCastAVPlaybackState(avPlaybackState);
|
|
EXPECT_EQ(ret, AVSESSION_ERROR);
|
|
SLOGI("HwCastStreamPlayerGetCastAVPlaybackState001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSetDisplaySurface001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSetDisplaySurface001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSetDisplaySurface001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
std::string surfaceId = "surfaceId";
|
|
int32_t ret = streamplayer->SetDisplaySurface(surfaceId);
|
|
EXPECT_EQ(ret, AVSESSION_ERROR);
|
|
SLOGI("HwCastStreamPlayerSetDisplaySurface001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerRegisterControllerListener001
|
|
* @tc.desc: Listener is nullptr
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerRegisterControllerListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerRegisterControllerListener001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int32_t ret = streamplayer->RegisterControllerListener(nullptr);
|
|
EXPECT_EQ(ret, AVSESSION_ERROR);
|
|
SLOGI("HwCastStreamPlayerRegisterControllerListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerUnRegisterControllerListener001
|
|
* @tc.desc: Listener is nullptr
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerUnRegisterControllerListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerUnRegisterControllerListener001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int32_t ret = streamplayer->UnRegisterControllerListener(nullptr);
|
|
EXPECT_EQ(ret, AVSESSION_ERROR);
|
|
SLOGI("HwCastStreamPlayerUnRegisterControllerListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnStateChanged001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnStateChanged001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnStateChanged001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
OHOS::CastEngine::PlayerStates playbackState = OHOS::CastEngine::PlayerStates::PLAYER_STATE_ERROR;
|
|
streamplayer->OnStateChanged(playbackState, true);
|
|
SLOGI("HwCastStreamPlayerOnStateChanged001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPositionChanged001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPositionChanged001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int position = 0;
|
|
int bufferPosition = 0;
|
|
int duration = 0;
|
|
streamplayer->OnPositionChanged(position, bufferPosition, duration);
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPositionChanged002
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPositionChanged002, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged002 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int position = -1;
|
|
int bufferPosition = 0;
|
|
int duration = 0;
|
|
streamplayer->OnPositionChanged(position, bufferPosition, duration);
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged002 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPositionChanged003
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPositionChanged003, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged003 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int position = 0;
|
|
int bufferPosition = -1;
|
|
int duration = 0;
|
|
streamplayer->OnPositionChanged(position, bufferPosition, duration);
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged003 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPositionChanged004
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPositionChanged004, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged004 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int position = -1;
|
|
int bufferPosition = -1;
|
|
int duration = 0;
|
|
streamplayer->OnPositionChanged(position, bufferPosition, duration);
|
|
SLOGI("HwCastStreamPlayerOnPositionChanged004 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnMediaItemChanged001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnMediaItemChanged001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnMediaItemChanged001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
OHOS::CastEngine::MediaInfo mediaInfo;
|
|
streamplayer->OnMediaItemChanged(mediaInfo);
|
|
SLOGI("HwCastStreamPlayerOnMediaItemChanged001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnVolumeChanged001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnVolumeChanged001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnVolumeChanged001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int volume = 0;
|
|
int maxVolume = 0;
|
|
streamplayer->OnVolumeChanged(volume, maxVolume);
|
|
SLOGI("HwCastStreamPlayerOnVolumeChanged001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnLoopModeChanged001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnLoopModeChanged001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnLoopModeChanged001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
OHOS::CastEngine::LoopMode loopMode = OHOS::CastEngine::LoopMode::LOOP_MODE_SINGLE;
|
|
streamplayer->OnLoopModeChanged(loopMode);
|
|
SLOGI("HwCastStreamPlayerOnLoopModeChanged001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnNextRequest001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnNextRequest001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnNextRequest001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
streamplayer->OnNextRequest();
|
|
SLOGI("HwCastStreamPlayerOnNextRequest001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPreviousRequest001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPreviousRequest001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPreviousRequest001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
streamplayer->OnPreviousRequest();
|
|
SLOGI("HwCastStreamPlayerOnPreviousRequest001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPlaySpeedChanged001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPlaySpeedChanged001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPlaySpeedChanged001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
OHOS::CastEngine::PlaybackSpeed speed = OHOS::CastEngine::PlaybackSpeed::SPEED_FORWARD_1_00_X;
|
|
streamplayer->OnPlaySpeedChanged(speed);
|
|
SLOGI("HwCastStreamPlayerOnPlaySpeedChanged001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPlayerError001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPlayerError001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPlayerError001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int errorCode = 0;
|
|
std::string errorMsg = "errorMsg";
|
|
streamplayer->OnPlayerError(errorCode, errorMsg);
|
|
SLOGI("HwCastStreamPlayerOnPlayerError001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnSeekDone001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnSeekDone001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnSeekDone001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int32_t seekDone = 0;
|
|
streamplayer->OnSeekDone(seekDone);
|
|
SLOGI("HwCastStreamPlayerOnSeekDone001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnVideoSizeChanged001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnVideoSizeChanged001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnVideoSizeChanged001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int32_t width = 0;
|
|
int32_t height = 0;
|
|
streamplayer->OnVideoSizeChanged(width, height);
|
|
SLOGI("HwCastStreamPlayerOnVideoSizeChanged001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnEndOfStream001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnEndOfStream001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnEndOfStream001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
int32_t isLooping = 0;
|
|
streamplayer->OnEndOfStream(isLooping);
|
|
SLOGI("HwCastStreamPlayerOnEndOfStream001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnPlayRequest001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnPlayRequest001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnPlayRequest001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
OHOS::CastEngine::MediaInfo mediaInfo;
|
|
streamplayer->OnPlayRequest(mediaInfo);
|
|
SLOGI("HwCastStreamPlayerOnPlayRequest001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerOnKeyRequest001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerOnKeyRequest001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerOnKeyRequest001 begin!");
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(nullptr);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
std::string assetId = "assetId";
|
|
std::vector<uint8_t> keyRequestData;
|
|
streamplayer->OnKeyRequest(assetId, keyRequestData);
|
|
SLOGI("HwCastStreamPlayerOnKeyRequest001 end!");
|
|
}
|
|
|
|
class StreamPlayerImpl : public OHOS::CastEngine::IStreamPlayer {
|
|
public:
|
|
int GetPosition(int32_t& currentPosition) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int Seek(int32_t position) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int SetSpeed(const OHOS::CastEngine::PlaybackSpeed speed) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int FastForward(const int32_t delta) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int FastRewind(const int32_t delta) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int SetVolume(const int32_t volume) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int SetMute(bool mute) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int ProvideKeyResponse(const std::string &mediaId, const std::vector<uint8_t> &response) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int SetLoopMode(const OHOS::CastEngine::LoopMode loopMode) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int RegisterListener(std::shared_ptr<OHOS::CastEngine::IStreamPlayerListener> listener) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int UnregisterListener() override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int SetSurface(const std::string &surfaceInfo) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int Load(const OHOS::CastEngine::MediaInfo &media) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int Play() override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int Play(const OHOS::CastEngine::MediaInfo &media) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int Play(int index) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int Pause() override
|
|
{
|
|
return 0;
|
|
};
|
|
int Stop() override
|
|
{
|
|
return 0;
|
|
};
|
|
int Next() override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int Previous() override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetPlayerStatus(OHOS::CastEngine::PlayerStates &status) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetDuration(int &duration) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetVolume(int32_t &volume, int32_t &maxVolume) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetMute(bool &mute) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetLoopMode(OHOS::CastEngine::LoopMode &loopMode) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetMediaCapabilities(std::string &jsonCapabilities) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetPlaySpeed(OHOS::CastEngine::PlaybackSpeed &speed) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int GetMediaInfoHolder(OHOS::CastEngine::MediaInfoHolder &hold) override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int SetAvailableCapability(const OHOS::CastEngine::StreamCapability &streamCapability) override
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int GetAvailableCapability(OHOS::CastEngine::StreamCapability &streamCapability) override
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int Release() override
|
|
{
|
|
return 0;
|
|
};
|
|
|
|
int SendData(const OHOS::CastEngine::DataType dataType, const std::string &dataStr) override
|
|
{
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams001
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_FAST_FORWARD
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams001 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_FAST_FORWARD);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams002
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_REWIND
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams002, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams002 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_REWIND);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams002 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams003
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_SEEK
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams003, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams003 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_SEEK);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams003 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams004
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_SET_VOLUME
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams004, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams004 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_SET_VOLUME);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams004 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams005
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_SET_SPEED
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams005, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams005 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_SET_SPEED);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams005 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams006
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_SET_LOOP_MODE
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams006, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams006 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_SET_LOOP_MODE);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams006 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams007
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_TOGGLE_FAVORITE
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams007, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams007 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_TOGGLE_FAVORITE);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams007 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams008
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_TOGGLE_MUTE
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams008, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams008 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_TOGGLE_MUTE);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams008 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastStreamPlayerSendControlCommandWithParams009
|
|
* @tc.desc: cmd : CAST_CONTROL_CMD_INVALID
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastStreamPlayerSendControlCommandWithParams009, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams009 begin!");
|
|
std::shared_ptr<StreamPlayerImpl> player = std::make_shared<StreamPlayerImpl>();
|
|
std::shared_ptr<HwCastStreamPlayer> streamplayer = std::make_shared<HwCastStreamPlayer>(player);
|
|
EXPECT_EQ(streamplayer != nullptr, true);
|
|
streamplayer->Init();
|
|
AVCastControlCommand cmd;
|
|
cmd.SetCommand(OHOS::AVSession::AVCastControlCommand::CAST_CONTROL_CMD_INVALID);
|
|
streamplayer->SendControlCommandWithParams(cmd);
|
|
SLOGI("HwCastStreamPlayerSendControlCommandWithParams009 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderInit001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderInit001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderInit001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
SLOGI("HwCastProviderInit001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderStartDiscovery001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderStartDiscovery001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderStartDiscovery001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castCapability = 0;
|
|
std::vector<std::string> drmSchemes;
|
|
EXPECT_EQ(hwCastProvider->StartDiscovery(castCapability, drmSchemes), true);
|
|
SLOGI("HwCastProviderStartDiscovery001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderStopDiscovery001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderStopDiscovery001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderStopDiscovery001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
hwCastProvider->StopDiscovery();
|
|
SLOGI("HwCastProviderStopDiscovery001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSetDiscoverable001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSetDiscoverable001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSetDiscoverable001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
bool enable = true;
|
|
EXPECT_EQ(hwCastProvider->SetDiscoverable(enable), AVSESSION_SUCCESS);
|
|
SLOGI("HwCastProviderSetDiscoverable001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderRelease001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderRelease001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderRelease001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
hwCastProvider->Release();
|
|
SLOGI("HwCastProviderRelease001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderStartCastSession001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderStartCastSession001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderStartCastSession001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
// Init may fail with -1, StartCastSession may fail with -1003
|
|
hwCastProvider->Init();
|
|
int32_t retForStart =
|
|
hwCastProvider->StartCastSession(static_cast<uint32_t>(ProtocolType::TYPE_CAST_PLUS_STREAM), false);
|
|
SLOGI("HwCastProviderStartCastSession001 end with ret %{public}d", retForStart);
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderStartCastSession002
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderStartCastSession002, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderStartCastSession002 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
// Init may fail with -1, StartCastSession may fail with -1003
|
|
hwCastProvider->Init();
|
|
int32_t retForStart =
|
|
hwCastProvider->StartCastSession(static_cast<uint32_t>(ProtocolType::TYPE_CAST_PLUS_AUDIO), true);
|
|
SLOGI("HwCastProviderStartCastSession002 end with ret %{public}d", retForStart);
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderStartCastSession003
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderStartCastSession003, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderStartCastSession003 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
// Init may fail with -1, StartCastSession may fail with -1003
|
|
hwCastProvider->Init();
|
|
int32_t retForStart =
|
|
hwCastProvider->StartCastSession(static_cast<uint32_t>(ProtocolType::TYPE_CAST_PLUS_STREAM), true);
|
|
SLOGI("HwCastProviderStartCastSession003 end with ret %{public}d", retForStart);
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderStopCastSession001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderStopCastSession001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderStopCastSession001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
hwCastProvider->StopCastSession(castId);
|
|
SLOGI("HwCastProviderStopCastSession001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderAddCastDevice001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderAddCastDevice001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderAddCastDevice001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
uint32_t spid = 33;
|
|
DeviceInfo deviceInfo;
|
|
EXPECT_EQ(hwCastProvider->AddCastDevice(castId, deviceInfo, spid), false);
|
|
SLOGI("HwCastProviderAddCastDevice001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderAddCastDeviceWithConnectionConfig001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderAddCastDeviceWithConnectionConfig001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderAddCastDeviceWithConnectionConfig001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
uint32_t spid = 33;
|
|
DeviceInfo deviceInfo;
|
|
OHOS::CastEngine::ConnectionConfig connectionConfig = {};
|
|
EXPECT_EQ(hwCastProvider->AddCastDeviceWithConnectionConfig(castId, deviceInfo, spid, connectionConfig), false);
|
|
SLOGI("HwCastProviderAddCastDeviceWithConnectionConfig001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderRemoveCastDevice001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderRemoveCastDevice001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderRemoveCastDevice001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
DeviceInfo deviceInfo;
|
|
EXPECT_EQ(hwCastProvider->RemoveCastDevice(castId, deviceInfo), false);
|
|
SLOGI("HwCastProviderRemoveCastDevice001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderGetRemoteController001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderGetRemoteController001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderGetRemoteController001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
EXPECT_EQ(hwCastProvider->GetRemoteController(castId), nullptr);
|
|
SLOGI("HwCastProviderGetRemoteController001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderRegisterCastStateListener001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderRegisterCastStateListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderRegisterCastStateListener001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
EXPECT_EQ(hwCastProvider->RegisterCastStateListener(nullptr), false);
|
|
SLOGI("HwCastProviderRegisterCastStateListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderUnregisterCastStateListener001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderUnregisterCastStateListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderUnregisterCastStateListener001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
EXPECT_EQ(hwCastProvider->UnRegisterCastStateListener(nullptr), false);
|
|
SLOGI("HwCastProviderUnregisterCastStateListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderRegisterCastSessionStateListener001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderRegisterCastSessionStateListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderRegisterCastSessionStateListener001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
EXPECT_EQ(hwCastProvider->RegisterCastSessionStateListener(castId, nullptr), false);
|
|
SLOGI("HwCastProviderRegisterCastSessionStateListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderUnregisterCastSessionStateListener001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderUnregisterCastSessionStateListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderUnregisterCastSessionStateListener001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
EXPECT_EQ(hwCastProvider->RegisterCastSessionStateListener(castId, nullptr), false);
|
|
SLOGI("HwCastProviderUnregisterCastSessionStateListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderOnDeviceFound001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderOnDeviceFound001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderOnDeviceFound001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
std::vector<OHOS::CastEngine::CastRemoteDevice> device;
|
|
hwCastProvider->OnDeviceFound(device);
|
|
SLOGI("HwCastProviderOnDeviceFound001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderOnDeviceFound002
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderOnDeviceFound002, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderOnDeviceFound002 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
std::vector<OHOS::CastEngine::CastRemoteDevice> devices;
|
|
OHOS::CastEngine::CastRemoteDevice dev;
|
|
dev.streamCapability = "[33,34]";
|
|
devices.push_back(dev);
|
|
hwCastProvider->OnDeviceFound(devices);
|
|
SLOGI("HwCastProviderOnDeviceFound002 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderOnDeviceFound003
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderOnDeviceFound003, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderOnDeviceFound003 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
std::vector<OHOS::CastEngine::CastRemoteDevice> devices;
|
|
OHOS::CastEngine::CastRemoteDevice dev;
|
|
dev.streamCapability = "33";
|
|
devices.push_back(dev);
|
|
hwCastProvider->OnDeviceFound(devices);
|
|
SLOGI("HwCastProviderOnDeviceFound003 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderOnSessionCreated001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderOnSessionCreated001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderOnSessionCreated001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
hwCastProvider->OnSessionCreated(nullptr);
|
|
SLOGI("HwCastProviderOnSessionCreated001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderNotifyCastSessionCreated001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderNotifyCastSessionCreated001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderNotifyCastSessionCreated001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
int32_t ret = hwCastProvider->Init();
|
|
CHECK_AND_RETURN_LOG(ret == 0, "hwCastProvider init failed");
|
|
hwCastProvider->NotifyCastSessionCreated("123456");
|
|
SLOGI("HwCastProviderNotifyCastSessionCreated001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderOnServiceDied001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderOnServiceDied001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderOnServiceDied001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
hwCastProvider->OnServiceDied();
|
|
SLOGI("HwCastProviderOnServiceDied001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionInit001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionInit001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionInit001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
SLOGI("HwCastProviderSessionInit001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionRelease001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionRelease001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionRelease001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
provideSession->Release();
|
|
SLOGI("HwCastProviderSessionRelease001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionOnDeviceState001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionOnDeviceState001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionOnDeviceState001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
OHOS::CastEngine::DeviceStateInfo stateInfo;
|
|
stateInfo.deviceId = "testDeviceId";
|
|
provideSession->OnDeviceState(stateInfo);
|
|
SLOGI("HwCastProviderSessionOnDeviceState001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionAddDevice001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionAddDevice001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionAddDevice001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
DeviceInfo deviceInfo;
|
|
deviceInfo.deviceId_ = "deviceId";
|
|
uint32_t spid = 33;
|
|
EXPECT_EQ(provideSession->AddDevice(deviceInfo, spid), false);
|
|
SLOGI("HwCastProviderSessionAddDevice001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionAddDeviceWithConnectionConfig001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionAddDeviceWithConnectionConfig001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionAddDeviceWithConnectionConfig001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
DeviceInfo deviceInfo;
|
|
deviceInfo.deviceId_ = "deviceId";
|
|
uint32_t spid = 33;
|
|
OHOS::CastEngine::ConnectionConfig connectionConfig = {};
|
|
EXPECT_EQ(provideSession->AddDeviceWithConnectionConfig(deviceInfo, spid, connectionConfig), false);
|
|
SLOGI("HwCastProviderSessionAddDeviceWithConnectionConfig001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionRemoveDevice001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionRemoveDevice001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionRemoveDevice001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
std::string deviceId = "deviceId";
|
|
EXPECT_EQ(provideSession->RemoveDevice(deviceId), false);
|
|
SLOGI("HwCastProviderSessionRemoveDevice001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionQueryCastSessionId001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionQueryCastSessionId001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionQueryCastSessionId001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
EXPECT_EQ(provideSession->QueryCastSessionId(), "");
|
|
SLOGI("HwCastProviderSessionQueryCastSessionId001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionCreateStreamPlayer001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionCreateStreamPlayer001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionCreateStreamPlayer001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
EXPECT_EQ(provideSession->CreateStreamPlayer(), nullptr);
|
|
SLOGI("HwCastProviderSessionCreateStreamPlayer001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionRegisterCastSessionStateListener001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionRegisterCastSessionStateListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionRegisterCastSessionStateListener001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
EXPECT_EQ(hwCastProvider->RegisterCastSessionStateListener(0, nullptr), false);
|
|
SLOGI("HwCastProviderSessionRegisterCastSessionStateListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionUnregisterCastSessionStateListener001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionUnregisterCastSessionStateListener001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionUnregisterCastSessionStateListener001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
std::shared_ptr<IAVCastSessionStateListener> listener = std::make_shared<IAVCastSessionStateListenerTest>();
|
|
hwCastProvider->RegisterCastSessionStateListener(0, listener);
|
|
EXPECT_EQ(hwCastProvider->UnRegisterCastSessionStateListener(0, listener), false);
|
|
SLOGI("HwCastProviderSessionUnregisterCastSessionStateListener001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastDisplayListenerOnConnect001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastDisplayListenerOnConnect001, TestSize.Level1)
|
|
{
|
|
SLOGI("HwCastDisplayListenerOnConnect001 begin!");
|
|
OHOS::sptr<IAVSessionCallback> callback;
|
|
OHOS::sptr<HwCastDisplayListener> listener = new HwCastDisplayListener(callback, true);
|
|
EXPECT_EQ(listener != nullptr, true);
|
|
OHOS::Rosen::DisplayId displayId = 1000;
|
|
listener->OnConnect(displayId);
|
|
listener = nullptr;
|
|
SLOGI("HwCastDisplayListenerOnConnect001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastDisplayListenerOnDisconnect001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastDisplayListenerOnDisconnect001, TestSize.Level1)
|
|
{
|
|
SLOGI("HwCastDisplayListenerOnDisconnect001 begin!");
|
|
OHOS::sptr<IAVSessionCallback> callback;
|
|
OHOS::sptr<HwCastDisplayListener> listener = new HwCastDisplayListener(callback, true);
|
|
EXPECT_EQ(listener != nullptr, true);
|
|
OHOS::Rosen::DisplayId displayId = 0;
|
|
listener->SetDisplayInfo(nullptr);
|
|
listener->OnDisconnect(displayId);
|
|
listener = nullptr;
|
|
SLOGI("HwCastDisplayListenerOnDisconnect001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastDisplayListenerSetSupportExtendedScreen001
|
|
* @tc.desc: test SetSupportExtendedScreen with false
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastDisplayListenerSetSupportExtendedScreen001, TestSize.Level1)
|
|
{
|
|
SLOGI("HwCastDisplayListenerSetSupportExtendedScreen001 begin!");
|
|
OHOS::sptr<IAVSessionCallback> callback;
|
|
OHOS::sptr<HwCastDisplayListener> listener = new HwCastDisplayListener(callback, true);
|
|
EXPECT_EQ(listener != nullptr, true);
|
|
listener->SetSupportExtendedScreen(false);
|
|
EXPECT_EQ(listener->IsSupportExtendedScreen(), false);
|
|
listener = nullptr;
|
|
SLOGI("HwCastDisplayListenerSetSupportExtendedScreen001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastDisplayListenerSetSupportExtendedScreen002
|
|
* @tc.desc: test SetSupportExtendedScreen with true
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastDisplayListenerSetSupportExtendedScreen002, TestSize.Level1)
|
|
{
|
|
SLOGI("HwCastDisplayListenerSetSupportExtendedScreen002 begin!");
|
|
OHOS::sptr<IAVSessionCallback> callback;
|
|
OHOS::sptr<HwCastDisplayListener> listener = new HwCastDisplayListener(callback, false);
|
|
EXPECT_EQ(listener != nullptr, true);
|
|
listener->SetSupportExtendedScreen(true);
|
|
EXPECT_EQ(listener->IsSupportExtendedScreen(), true);
|
|
listener = nullptr;
|
|
SLOGI("HwCastDisplayListenerSetSupportExtendedScreen002 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastDisplayListenerIsSupportExtendedScreen001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastDisplayListenerIsSupportExtendedScreen001, TestSize.Level1)
|
|
{
|
|
SLOGI("HwCastDisplayListenerIsSupportExtendedScreen001 begin!");
|
|
OHOS::sptr<IAVSessionCallback> callback;
|
|
OHOS::sptr<HwCastDisplayListener> listener = new HwCastDisplayListener(callback, true);
|
|
EXPECT_EQ(listener != nullptr, true);
|
|
EXPECT_EQ(listener->IsSupportExtendedScreen(), true);
|
|
listener = nullptr;
|
|
SLOGI("HwCastDisplayListenerIsSupportExtendedScreen001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastDisplayListenerIsSupportExtendedScreen002
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastDisplayListenerIsSupportExtendedScreen002, TestSize.Level1)
|
|
{
|
|
SLOGI("HwCastDisplayListenerIsSupportExtendedScreen002 begin!");
|
|
OHOS::sptr<IAVSessionCallback> callback;
|
|
OHOS::sptr<HwCastDisplayListener> listener = new HwCastDisplayListener(callback, false);
|
|
EXPECT_EQ(listener != nullptr, true);
|
|
EXPECT_EQ(listener->IsSupportExtendedScreen(), false);
|
|
listener = nullptr;
|
|
SLOGI("HwCastDisplayListenerIsSupportExtendedScreen002 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSendCommandArgsToCast001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSendCommandArgsToCast001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSendCommandArgsToCast001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
int32_t commandType = 0;
|
|
std::string params = "";
|
|
hwCastProvider->SendCommandArgsToCast(castId, commandType, params);
|
|
EXPECT_TRUE(castId == 0);
|
|
SLOGI("HwCastProviderSendCommandArgsToCast001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderQueryCastSessionId001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderQueryCastSessionId001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderQueryCastSessionId001 begin!");
|
|
std::shared_ptr<HwCastProvider> hwCastProvider = std::make_shared<HwCastProvider>();
|
|
EXPECT_EQ(hwCastProvider != nullptr, true);
|
|
hwCastProvider->Init();
|
|
int castId = 0;
|
|
hwCastProvider->QueryCastSessionId(castId);
|
|
EXPECT_TRUE(castId == 0);
|
|
SLOGI("HwCastProviderQueryCastSessionId001 end!");
|
|
}
|
|
|
|
/**
|
|
* @tc.name: HwCastProviderSessionOnHiplayEventRecv001
|
|
* @tc.desc:
|
|
* @tc.type: FUNC
|
|
* @tc.require:
|
|
*/
|
|
static HWTEST(HwCastTest, HwCastProviderSessionOnHiplayEventRecv001, TestSize.Level0)
|
|
{
|
|
SLOGI("HwCastProviderSessionOnHiplayEventRecv001 begin!");
|
|
std::shared_ptr<HwCastProviderSession> provideSession = std::make_shared<HwCastProviderSession>(nullptr);
|
|
EXPECT_EQ(provideSession != nullptr, true);
|
|
provideSession->Init();
|
|
int32_t eventId = 0;
|
|
std::string jsonParam = "";
|
|
provideSession->OnHiplayEventRecv(eventId, jsonParam);
|
|
EXPECT_TRUE(eventId == 0);
|
|
SLOGI("HwCastProviderSessionOnHiplayEventRecv001 end!");
|
|
} |