Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6d31676c
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看板
提交
6d31676c
编写于
9月 18, 2021
作者:
B
bird_j
提交者:
Gitee
9月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
头文件刷新
Signed-off-by:
N
bird_j
<
jianghongpeng@huawei.com
>
上级
595aa672
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
120 addition
and
42 deletion
+120
-42
multimedia/media/media_cpp_test_standard/include/mediatest_log.h
...dia/media/media_cpp_test_standard/include/mediatest_log.h
+21
-14
multimedia/media/media_cpp_test_standard/player/include/ActsPlayerAPITest.h
...edia_cpp_test_standard/player/include/ActsPlayerAPITest.h
+8
-6
multimedia/media/media_cpp_test_standard/player/include/ActsPlayerFuncTest.h
...dia_cpp_test_standard/player/include/ActsPlayerFuncTest.h
+9
-6
multimedia/media/media_cpp_test_standard/player/include/TestParamsConfig.h
...media_cpp_test_standard/player/include/TestParamsConfig.h
+66
-0
multimedia/media/media_cpp_test_standard/player/include/Testplayer.h
...media/media_cpp_test_standard/player/include/Testplayer.h
+16
-16
未找到文件。
multimedia/media/media_cpp_test_standard/include/mediatest_log.h
浏览文件 @
6d31676c
...
...
@@ -13,28 +13,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "media_log.h"
#include "securec.h"
#define MEDIA_DEBUG_LOG(fmt, ...) \
#define LOGMAXSIZE 200
#define MEDIA_INFO_LOG(fmt, ...) \
do
{
\
printf
(
fmt
,
##
__VA_ARGS__
);
\
printf
(
"
\n
"
);
\
__MEDIA_LOG
(
::
OHOS
::
HiviewDFX
::
HiLog
::
Debug
,
fmt
,
##
__VA_ARGS__
);
\
}
while
(
0
)
\
char
ch
[
LOGMAXSIZE
];
\
(
void
)
sprintf_s
(
ch
,
LOGMAXSIZE
,
fmt
,
##
__VA_ARGS__
);
\
(
void
)
printf
(
"%s"
,
ch
);
\
(
void
)
printf
(
"
\n
"
);
\
__MEDIA_LOG
(
::
OHOS
::
HiviewDFX
::
HiLog
::
Info
,
"%{public}s"
,
ch
);
\
}
while
(
0
)
#define MEDIA_
INFO
_LOG(fmt, ...) \
#define MEDIA_
DEBUG
_LOG(fmt, ...) \
do
{
\
printf
(
fmt
,
##
__VA_ARGS__
)
;
\
printf
(
"
\n
"
);
\
__MEDIA_LOG
(
::
OHOS
::
HiviewDFX
::
HiLog
::
Info
,
fmt
,
##
__VA_ARGS__
);
\
}
while
(
0
)
\
char
ch
[
LOGMAXSIZE
]
;
\
(
void
)
sprintf_s
(
ch
,
LOGMAXSIZE
,
fmt
,
##
__VA_ARGS__
);
\
__MEDIA_LOG
(
::
OHOS
::
HiviewDFX
::
HiLog
::
Debug
,
"%{public}s"
,
ch
);
\
}
while
(
0
)
#define MEDIA_ERROR_LOG(fmt, ...) \
do
{
\
printf
(
fmt
,
##
__VA_ARGS__
);
\
printf
(
"
\n
"
);
\
__MEDIA_LOG
(
::
OHOS
::
HiviewDFX
::
HiLog
::
Error
,
fmt
,
##
__VA_ARGS__
);
\
}
while
(
0
)
\
char
ch
[
LOGMAXSIZE
];
\
(
void
)
sprintf_s
(
ch
,
LOGMAXSIZE
,
fmt
,
##
__VA_ARGS__
);
\
(
void
)
printf
(
"%s"
,
ch
);
\
(
void
)
printf
(
"
\n
"
);
\
__MEDIA_LOG
(
::
OHOS
::
HiviewDFX
::
HiLog
::
Error
,
"%{public}s"
,
ch
);
\
}
while
(
0
)
namespace
{
constexpr
OHOS
::
HiviewDFX
::
HiLogLabel
LABEL
=
{
LOG_CORE
,
LOG_DOMAIN
,
"MediaTest"
};
...
...
multimedia/media/media_cpp_test_standard/player/include/ActsPlayerAPITest.h
浏览文件 @
6d31676c
...
...
@@ -21,25 +21,27 @@ namespace OHOS {
namespace
Media
{
class
ActsPlayerAPITest
:
public
testing
::
Test
{
public:
// SetUpTestCase: before all testcase
e
// SetUpTestCase: before all testcase
s
static
void
SetUpTestCase
(
void
)
{
MEDIA_
INFO
_LOG
(
"ActsPlayerAPITest::SetUpTestCase"
);
MEDIA_
DEBUG
_LOG
(
"ActsPlayerAPITest::SetUpTestCase"
);
};
// TearDownTestCase: after all testcase
// TearDownTestCase: after all testcase
s
static
void
TearDownTestCase
(
void
)
{
MEDIA_
INFO
_LOG
(
"ActsPlayerAPITest::TearDownTestCase"
);
MEDIA_
DEBUG
_LOG
(
"ActsPlayerAPITest::TearDownTestCase"
);
};
// SetUp
void
SetUp
(
void
)
{
MEDIA_INFO_LOG
(
"ActsPlayerAPITest::SetUp"
);
const
::
testing
::
TestInfo
*
const
testInfo
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
MEDIA_DEBUG_LOG
(
"ActsPlayerAPITest::SetUp:%s"
,
testInfo
->
name
());
};
// TearDown
void
TearDown
(
void
)
{
MEDIA_INFO_LOG
(
"ActsPlayerAPITest::TearDown"
);
const
::
testing
::
TestInfo
*
const
testInfo
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
MEDIA_DEBUG_LOG
(
"ActsPlayerAPITest::TearDown:%s"
,
testInfo
->
name
());
};
void
LocalPlayFunc
(
const
std
::
string
uri
,
bool
isAsync
,
WindowConfig
config
=
g_config
);
};
...
...
multimedia/media/media_cpp_test_standard/player/include/ActsPlayerFuncTest.h
浏览文件 @
6d31676c
...
...
@@ -21,25 +21,28 @@ namespace OHOS {
namespace
Media
{
class
ActsPlayerFuncTest
:
public
testing
::
Test
{
public:
// SetUpTestCase: before all testcase
e
// SetUpTestCase: before all testcase
s
static
void
SetUpTestCase
(
void
)
{
MEDIA_INFO_LOG
(
"ActsPlayerFuncTest::SetUpTestCase"
);
MEDIA_DEBUG_LOG
(
"ActsPlayerFuncTest::SetUpTestCase"
);
TestPlayerBasic
::
TestParamsConfig
::
GetInstance
().
InitPlayProtocol
();
};
// TearDownTestCase: after all testcase
// TearDownTestCase: after all testcase
s
static
void
TearDownTestCase
(
void
)
{
MEDIA_
INFO
_LOG
(
"ActsPlayerFuncTest::TearDownTestCase"
);
MEDIA_
DEBUG
_LOG
(
"ActsPlayerFuncTest::TearDownTestCase"
);
};
// SetUp
void
SetUp
(
void
)
{
MEDIA_INFO_LOG
(
"ActsPlayerFuncTest::SetUp"
);
const
::
testing
::
TestInfo
*
const
testInfo
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
MEDIA_DEBUG_LOG
(
"ActsPlayerFuncTest::SetUp:%s"
,
testInfo
->
name
());
};
// TearDown
void
TearDown
(
void
)
{
MEDIA_INFO_LOG
(
"ActsPlayerFuncTest::TearDown"
);
const
::
testing
::
TestInfo
*
const
testInfo
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
MEDIA_DEBUG_LOG
(
"ActsPlayerFuncTest::TearDown:%s"
,
testInfo
->
name
());
};
static
void
LocalPlayFunc
(
const
std
::
string
uri
,
bool
isAsync
,
WindowConfig
config
=
g_sub_config
);
static
void
*
LocalMulitPlayFunc
(
void
*
threadarg
);
...
...
multimedia/media/media_cpp_test_standard/player/include/TestParamsConfig.h
0 → 100644
浏览文件 @
6d31676c
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PLAYER_COMMON_TEST_H
#define PLAYER_COMMON_TEST_H
#include "gtest/gtest.h"
#include "mediatest_log.h"
#include "player.h"
namespace
{
static
const
int32_t
PLAYING_TIME
=
3
;
static
const
int32_t
SEEK_TIME_5_SEC
=
5000
;
static
const
int32_t
SEEK_TIME_2_SEC
=
2000
;
static
const
int32_t
DELTA_TIME
=
1000
;
static
const
int32_t
CLOSEST_DELTA_TIME
=
300
;
static
const
int32_t
WAITSECOND
=
2
;
static
const
int32_t
RET_OK
=
0
;
static
const
int32_t
FILE_BEGIN
=
0
;
static
const
int32_t
PARA_MAX_LEN
=
256
;
static
const
int32_t
TIME_SEC2MS
=
1000
;
static
const
int32_t
WAIT_TIME
=
1000
;
static
const
OHOS
::
Media
::
PlayerSeekMode
SEEK_MODE
=
OHOS
::
Media
::
PlayerSeekMode
::
SEEK_CLOSEST
;
}
namespace
TestPlayerBasic
{
class
TestParamsConfig
{
public:
static
TestParamsConfig
&
GetInstance
()
{
static
TestParamsConfig
config
;
return
config
;
}
std
::
string
GetMountPath
()
const
{
return
mountPath_
;
}
void
SetMountPath
(
std
::
string
mountPath
)
{
mountPath_
=
mountPath
;
}
bool
CompareTime
(
int32_t
expectTime
,
int32_t
realTme
,
OHOS
::
Media
::
PlayerSeekMode
seekMode
);
std
::
string
GetUri
();
void
InitPlayProtocol
();
private:
TestParamsConfig
();
~
TestParamsConfig
();
std
::
string
mountPath_
=
""
;
};
}
#endif
\ No newline at end of file
multimedia/media/media_cpp_test_standard/player/include/Testplayer.h
浏览文件 @
6d31676c
...
...
@@ -13,9 +13,11 @@
* limitations under the License.
*/
#ifndef PLAYER_TEST_H
#define PLAYER_TEST_H
#include "securec.h"
#include "common.h"
#include "mediatest_log.h"
#include "TestParamsConfig.h"
#include "window_manager.h"
#include "surface_type.h"
#include "display_type.h"
...
...
@@ -65,13 +67,13 @@ public:
};
class
TestPlayer
{
public:
std
::
shared_ptr
<
Player
>
player
;
std
::
unique_ptr
<
Window
>
mwindow
;
std
::
unique_ptr
<
SubWindow
>
window
;
explicit
TestPlayer
(
PlayerSignal
*
test
);
~
TestPlayer
();
std
::
shared_ptr
<
Player
>
player_
;
sptr
<
Window
>
window_
;
explicit
TestPlayer
(
std
::
shared_ptr
<
PlayerSignal
>
test
);
virtual
~
TestPlayer
();
bool
CreatePlayer
();
int32_t
SetSource
(
const
std
::
string
&
uri
);
int32_t
SetDataSrc
(
const
std
::
string
&
uri
,
bool
seekable
);
int32_t
Play
();
int32_t
Prepare
();
int32_t
PrepareAsync
();
...
...
@@ -92,16 +94,14 @@ public:
int32_t
SetLooping
(
bool
loop
);
int32_t
SetPlayerCallback
(
const
std
::
shared_ptr
<
PlayerCallback
>
&
callback
);
private:
void
InitSubWindow
(
WindowConfig
sub_config
);
PlayerSignal
*
test_
;
std
::
shared_ptr
<
PlayerSignal
>
test_
;
};
class
TestPlayerCallback
:
public
PlayerCallback
{
public:
int
errorNum
=
0
;
int
errorNum
_
=
0
;
PlayerStates
state_
=
PLAYER_STATE_ERROR
;
explicit
TestPlayerCallback
(
PlayerSignal
*
test
);
~
TestPlayerCallback
();
explicit
TestPlayerCallback
(
std
::
shared_ptr
<
PlayerSignal
>
test
);
virtual
~
TestPlayerCallback
();
void
OnError
(
PlayerErrorType
errorType
,
int32_t
errorCode
);
int
WaitForSeekDone
(
int32_t
currentPositon
);
void
OnInfo
(
PlayerOnInfoType
type
,
int32_t
extra
,
const
Format
&
infoBody
=
{});
...
...
@@ -109,11 +109,11 @@ public:
private:
PlayerErrorType
errorType_
=
PLAYER_ERROR_UNKNOWN
;
int32_t
errorCode_
=
-
1
;
bool
seekDoneFlag
=
false
;
bool
seekDoneFlag
_
=
false
;
int32_t
postion_
=
0
;
void
PrintState
(
PlayerStates
state
);
PlayerSignal
*
test_
;
std
::
shared_ptr
<
PlayerSignal
>
test_
;
};
}
}
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录