Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
20b7f5e7
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
20b7f5e7
编写于
9月 18, 2021
作者:
B
bird_j
提交者:
Gitee
9月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ActsPlayerFuncTest刷新
Signed-off-by:
N
bird_j
<
jianghongpeng@huawei.com
>
上级
4b3fe52e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
256 addition
and
261 deletion
+256
-261
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateAsyncTest.cpp
...standard/player/src/function/ActsPlayerStateAsyncTest.cpp
+256
-261
未找到文件。
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateAsyncTest.cpp
浏览文件 @
20b7f5e7
...
...
@@ -20,75 +20,75 @@ using namespace std;
using
namespace
OHOS
;
using
namespace
OHOS
::
Media
;
using
namespace
testing
::
ext
;
using
namespace
PlayerNameSpace
;
using
namespace
TestPlayerBasic
;
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0100
* @tc.name : 001.prepare-reset
,销毁播放器
* @tc.name : 001.prepare-reset
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0100
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0200
* @tc.name : 002.prepare-reset
,不销毁播放器
* @tc.name : 002.prepare-reset
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0200
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0300
* @tc.name : 003.prepare-stop-reset
,销毁播放器
* @tc.name : 003.prepare-stop-reset
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0300
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
...
...
@@ -96,257 +96,257 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0300, Func
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0400
* @tc.name : 004.prepare-stop-reset
,不销毁播放器
* @tc.name : 004.prepare-stop-reset
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0400
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0600
* @tc.name : 006.prepare-play-reset
,不销毁播放器
* @tc.name : 006.prepare-play-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0600
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
time
,
PLAYING_TIME
*
1000
,
1000
);
EXPECT_NEAR
(
time
,
PLAYING_TIME
*
TIME_SEC2MS
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0700
* @tc.name : 007.prepare-seek-play-reset
,销毁播放器
* @tc.name : 007.prepare-seek-play-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0700
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
time
,
PLAYING_TIME
*
1000
,
1000
);
EXPECT_NEAR
(
time
,
PLAYING_TIME
*
TIME_SEC2MS
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0800
* @tc.name : 008.prepare-seek-play-reset
,不销毁播放器
* @tc.name : 008.prepare-seek-play-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0800
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
time
,
SEEK_TIME_5_SEC
+
PLAYING_TIME
*
1000
,
1000
);
EXPECT_NEAR
(
time
,
SEEK_TIME_5_SEC
+
PLAYING_TIME
*
TIME_SEC2MS
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0900
* @tc.name : 009.prepare-play-seek-reset
,销毁播放器
* @tc.name : 009.prepare-play-seek-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_0900
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1000
* @tc.name : 010.prepare-play-seek-reset
,不销毁播放器
* @tc.name : 010.prepare-play-seek-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1000
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1100
* @tc.name : 011.prepare-play-seek-pause-reset
,不销毁播放器
* @tc.name : 011.prepare-play-seek-pause-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1100
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1200
* @tc.name : 012.prepare-play-seek-pause-reset
,销毁播放器
* @tc.name : 012.prepare-play-seek-pause-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1200
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
...
...
@@ -354,36 +354,36 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1200, Func
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1300
* @tc.name : 013.prepare-play-seek-pause-stop-reset
,不销毁播放器
* @tc.name : 013.prepare-play-seek-pause-stop-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1300
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
...
...
@@ -391,37 +391,37 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1300, Func
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1400
* @tc.name : 014.prepare-play-seek-pause-stop-reset
,销毁播放器
* @tc.name : 014.prepare-play-seek-pause-stop-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1400
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
...
...
@@ -430,91 +430,91 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1400, Func
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1500
* @tc.name : 015.prepare-play-stop-reset
,不销毁播放器
* @tc.name : 015.prepare-play-stop-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1500
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1600
* @tc.name : 016.prepare-play-stop-reset
,销毁播放器
* @tc.name : 016.prepare-play-stop-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1600
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1700
* @tc.name : 017.prepare-stop
,不销毁播放器
* @tc.name : 017.prepare-stop
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1700
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -524,35 +524,35 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1700, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1800
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
*
2
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_NEAR
(
PLAYING_TIME
*
TIME_SEC2MS
+
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -562,39 +562,39 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1800, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_1900
,
Function
|
MediumTest
|
Level0
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_2_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
+
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_NEAR
(
SEEK_TIME_2_SEC
+
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -604,24 +604,24 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1900, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2000
,
Function
|
MediumTest
|
Level1
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
...
...
@@ -629,13 +629,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_FALSE
(
player
->
IsLooping
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
FILE_BEGIN
,
time
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -645,18 +645,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2100
,
Function
|
MediumTest
|
Level1
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
...
...
@@ -664,13 +664,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_FALSE
(
player
->
IsLooping
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
FILE_BEGIN
,
time
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -680,42 +680,42 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2200
,
Function
|
MediumTest
|
Level1
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time_before
;
int32_t
time_after
;
int32_t
time
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_MODE
));
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsLooping
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_before
));
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_after
));
EXPECT_NEAR
(
time_after
-
time_before
,
PLAYING_TIME
*
1000
,
DELTA_TIME
);
EXPECT_NEAR
(
time_after
-
time_before
,
PLAYING_TIME
*
TIME_SEC2MS
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_
EQ
(
FILE_BEGIN
,
time
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -725,23 +725,23 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2200, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2300
,
Function
|
MediumTest
|
Level1
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
...
...
@@ -750,11 +750,11 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func
EXPECT_EQ
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_FALSE
(
player
->
IsLooping
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -764,31 +764,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2400
,
Function
|
MediumTest
|
Level1
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
-
1
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
durationTime
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -798,33 +798,33 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2400, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2500
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
->
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
testObj
.
mutexFlag_
=
true
;
testObj
->
mutexFlag_
=
true
;
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
+
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
+
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -834,31 +834,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2500, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2600
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
->
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
testObj
.
mutexFlag_
=
true
;
testObj
->
mutexFlag_
=
true
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2625
...
...
@@ -867,27 +867,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2600, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2625
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
->
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
testObj
.
mutexFlag_
=
true
;
testObj
->
mutexFlag_
=
true
;
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2650
...
...
@@ -896,27 +896,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2625, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2650
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
->
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2651
...
...
@@ -925,28 +925,28 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2650, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2651
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
->
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_NEAR
(
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2675
...
...
@@ -955,30 +955,30 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2651, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2675
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
->
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
testObj
.
mutexFlag_
=
true
;
testObj
->
mutexFlag_
=
true
;
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_NEAR
(
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2700
...
...
@@ -987,18 +987,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2675, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2700
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
...
...
@@ -1007,15 +1007,15 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -1025,38 +1025,38 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2800
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -1066,20 +1066,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2800, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_2900
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
time_before
;
int32_t
time_after
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
...
...
@@ -1087,22 +1085,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_before
));
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_after
));
EXPECT_TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
/**
...
...
@@ -1112,20 +1106,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_Local_Async_Function_04_3000
,
Function
|
MediumTest
|
Level3
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
std
::
shared_ptr
<
PlayerSignal
>
testObj
=
std
::
make_shared
<
PlayerSignal
>
()
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
int32_t
time
;
int32_t
time_before
;
int32_t
time_after
;
int32_t
durationTime
;
std
::
string
uri
=
GetUri
();
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
sptr
<
Surface
>
videoSurface
=
player
->
GetVideoSurface
(
g_sub_config
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVideoSurface
(
videoSurface
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
...
...
@@ -1135,24 +1129,25 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Func
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
durationTime
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_before
));
sleep
(
PLAYING_TIME
);
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_after
));
EXPECT_NEAR
(
time_after
-
time_before
,
PLAYING_TIME
*
1000
,
DELTA_TIME
);
EXPECT_NEAR
(
time_after
-
time_before
,
PLAYING_TIME
*
TIME_SEC2MS
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_
EQ
(
SEEK_TIME_2_SEC
,
time
);
EXPECT_
TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_2_SEC
,
time
,
SEEK_MODE
)
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
FILE_BEGIN
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
_
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录