Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a0f24507
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
11 个月 前同步成功
通知
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a0f24507
编写于
7月 11, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 11, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4234 recorder profile xts testcase
Merge pull request !4234 from NOBUGGERS/r00514670_0708
上级
119876a9
0e4923ca
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
2064 addition
and
0 deletion
+2064
-0
multimedia/BUILD.gn
multimedia/BUILD.gn
+1
-0
multimedia/media/media_js_standard/recorderProfile/BUILD.gn
multimedia/media/media_js_standard/recorderProfile/BUILD.gn
+32
-0
multimedia/media/media_js_standard/recorderProfile/Test.json
multimedia/media/media_js_standard/recorderProfile/Test.json
+18
-0
multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b
..._js_standard/recorderProfile/signature/openharmony_sx.p7b
+0
-0
multimedia/media/media_js_standard/recorderProfile/src/main/config.json
...ia/media_js_standard/recorderProfile/src/main/config.json
+96
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/app.js
...ia_js_standard/recorderProfile/src/main/js/default/app.js
+23
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/en-US.json
...ndard/recorderProfile/src/main/js/default/i18n/en-US.json
+6
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/zh-CN.json
...ndard/recorderProfile/src/main/js/default/i18n/zh-CN.json
+6
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.css
...recorderProfile/src/main/js/default/pages/index/index.css
+61
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.hml
...recorderProfile/src/main/js/default/pages/index/index.hml
+20
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.js
.../recorderProfile/src/main/js/default/pages/index/index.js
+41
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js
...js_standard/recorderProfile/src/main/js/test/List.test.js
+19
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js
...file/src/main/js/test/ProfileAbnormalTestCallback.test.js
+344
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js
...ofile/src/main/js/test/ProfileAbnormalTestPromise.test.js
+353
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js
...ndard/recorderProfile/src/main/js/test/ProfileTestBase.js
+330
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js
...orderProfile/src/main/js/test/ProfileTestCallback.test.js
+341
-0
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js
...corderProfile/src/main/js/test/ProfileTestPromise.test.js
+361
-0
multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json
...corderProfile/src/main/resources/base/element/string.json
+12
-0
multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png
...rd/recorderProfile/src/main/resources/base/media/icon.png
+0
-0
未找到文件。
multimedia/BUILD.gn
浏览文件 @
a0f24507
...
...
@@ -31,6 +31,7 @@ group("multimedia") {
"media/media_js_standard/audioPlayer:audio_player_js_hap",
"media/media_js_standard/audioRecorder:audio_recorder_js_hap",
"media/media_js_standard/recorderFormat:recorder_format_js_hap",
"media/media_js_standard/recorderProfile:recorder_profile_js_hap",
"media/media_js_standard/videoPlayer:video_player_js_hap",
#"medialibrary/mediaLibrary_js_standard:mediaLibrary_js_hap",
...
...
multimedia/media/media_js_standard/recorderProfile/BUILD.gn
0 → 100644
浏览文件 @
a0f24507
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("recorder_profile_js_hap") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":profile_js_assets",
":profile_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsRecorderProfileJsTest"
}
ohos_js_assets("profile_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("profile_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
multimedia/media/media_js_standard/recorderProfile/Test.json
0 → 100644
浏览文件 @
a0f24507
{
"description"
:
"Configuration for profile Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"2000000"
,
"package"
:
"ohos.acts.multimedia.recorder.profile"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsRecorderProfileJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
a0f24507
文件已添加
multimedia/media/media_js_standard/recorderProfile/src/main/config.json
0 → 100644
浏览文件 @
a0f24507
{
"app"
:
{
"apiVersion"
:
{
"compatible"
:
6
,
"releaseType"
:
"Beta1"
,
"target"
:
7
},
"vendor"
:
"acts"
,
"bundleName"
:
"ohos.acts.multimedia.recorder.profile"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
}
},
"deviceConfig"
:
{
"default"
:
{
"debug"
:
true
}
},
"module"
:
{
"abilities"
:
[
{
"iconId"
:
16777218
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"descriptionId"
:
16777217
,
"visible"
:
true
,
"labelId"
:
16777216
,
"icon"
:
"$media:icon"
,
"name"
:
"ohos.acts.multimedia.recorder.profile.MainAbility"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"homeAbility"
:
true
,
"launchType"
:
"standard"
}
],
"deviceType"
:
[
"phone"
,
"tablet"
,
"tv"
,
"wearable"
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.MEDIA_LOCATION"
,
"reason"
:
"use ohos.permission.MEDIA_LOCATION"
},
{
"name"
:
"ohos.permission.READ_MEDIA"
,
"reason"
:
"use ohos.permission.READ_MEDIA"
},
{
"name"
:
"ohos.permission.WRITE_MEDIA"
,
"reason"
:
"use ohos.permission.WRITE_MEDIA"
}
],
"mainAbility"
:
"ohos.acts.multimedia.recorder.profile.MainAbility"
,
"distro"
:
{
"moduleType"
:
"entry"
,
"installationFree"
:
false
,
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
},
"package"
:
"ohos.acts.multimedia.recorder.profile"
,
"name"
:
".MyApplication"
,
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
}
}
]
}
}
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/app.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/en-US.json
0 → 100644
浏览文件 @
a0f24507
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/zh-CN.json
0 → 100644
浏览文件 @
a0f24507
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
40px
;
color
:
#000000
;
opacity
:
0.9
;
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
@media
screen
and
(
device-type
:
wearable
)
{
.title
{
font-size
:
28px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
tv
)
{
.container
{
background-image
:
url("/common/images/Wallpaper.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
background-position
:
center
;
}
.title
{
font-size
:
100px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
a0f24507
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
this
.
timeout
=
60000
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./ProfileTestCallback.test.js
'
)
require
(
'
./ProfileTestPromise.test.js
'
)
require
(
'
./ProfileAbnormalTestCallback.test.js
'
)
require
(
'
./ProfileAbnormalTestPromise.test.js
'
)
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
*
as
base
from
'
./ProfileTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ProfileAbnormalTestCallback
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
function
()
{
console
.
info
(
'
afterAll case
'
);
})
async
function
callbackAbnormalGetVideoProfile
(
sourceId
,
qualityLevel
,
done
){
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
sourceId
,
qualityLevel
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
base
.
checkVideoCapsArray
(
videoCapsArray
);
console
.
info
(
'
getVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
async
function
callbackAbnormalAudioRecoderConfigSupported
(
audioProfile
,
done
)
{
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
isAudioRecoderConfigSupported
(
audioProfile
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
isAudioRecoderConfigSupported: success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
})
}
async
function
callbackAbnormalHasVideoProfile
(
sourceId
,
qualityLevel
,
done
)
{
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
sourceId
,
qualityLevel
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
})
}
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0100
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : 5 args all set wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalAll
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0200
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : FormatType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalFormatType
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0300
* @tc.name : test isAudioRecoderConfigSupported fasle
* @tc.desc : CodecMimeType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalCodecMimeType
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0400
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : bitrate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalBitrate
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0500
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : sampleRate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalSampleRate
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0600
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : channel is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalSampleChannel
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0700
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test hasVideoRecorderProfile
'
);
callbackAbnormalHasVideoProfile
(
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0800
* @tc.name : test hasVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
callbackAbnormalHasVideoProfile
(
-
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0900
* @tc.name : test hasVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
callbackAbnormalHasVideoProfile
(
0
,
-
1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1000
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
callbackAbnormalHasVideoProfile
(
65535
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1100
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
callbackAbnormalHasVideoProfile
(
65536
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1200
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
callbackAbnormalHasVideoProfile
(
0
,
65535
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1300
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
callbackAbnormalHasVideoProfile
(
0
,
65536
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1400
* @tc.name : test getVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
callbackAbnormalGetVideoProfile
(
-
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1500
* @tc.name : test getVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
callbackAbnormalGetVideoProfile
(
0
,
-
1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1600
* @tc.name : test getVideoRecorderProfile sourceId 65535
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
callbackAbnormalGetVideoProfile
(
65535
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1700
* @tc.name : test getVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
callbackAbnormalGetVideoProfile
(
65536
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1800
* @tc.name : test getVideoRecorderProfile qualityLevel 65535
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
callbackAbnormalGetVideoProfile
(
0
,
65535
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1900
* @tc.name : test getVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
callbackAbnormalGetVideoProfile
(
0
,
65536
,
done
);
})
})
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* Distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* Limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
*
as
base
from
'
./ProfileTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ProfileAbnormalTestPromise
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
function
()
{
console
.
info
(
'
afterAll case
'
);
})
async
function
promiseAbnormalGetVideoProfile
(
sourceId
,
qualityLevel
,
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
sourceId
,
qualityLevel
).
then
(
async
(
videoCapsArray
)
=>
{
base
.
checkVideoCapsArray
(
videoCapsArray
);
console
.
info
(
'
getVideoRecorderProfile success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
async
function
promiseAbnormalAudioRecoderConfigSupported
(
audioProfile
,
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
isAudioRecoderConfigSupported
(
audioProfile
).
then
(
async
(
ean
)
=>
{
console
.
info
(
'
isAudioRecoderConfigSupported: success
'
+
ean
);
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
isAudioRecoderConfigSupported: success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
async
function
promiseAbnormalHasVideoProfile
(
sourceId
,
qualityLevel
,
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
sourceId
,
qualityLevel
).
then
(
async
(
ean
)
=>
{
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0100
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : 5 args all set wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalAll
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0200
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : FormatType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalFormatType
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0300
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : CodecMimeType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalCodecMimeType
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0400
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : bitrate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalBitrate
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0500
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : sampleRate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalSampleRate
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0600
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : channel is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAbnormalAudioRecoderConfigSupported
(
base
.
audioRecorderAbnormalSampleChannel
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0700
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test hasVideoRecorderProfile
'
);
promiseAbnormalHasVideoProfile
(
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0800
* @tc.name : test hasVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
promiseAbnormalHasVideoProfile
(
-
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0900
* @tc.name : test hasVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
promiseAbnormalHasVideoProfile
(
0
,
-
1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1000
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
promiseAbnormalHasVideoProfile
(
65535
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1100
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
promiseAbnormalHasVideoProfile
(
65536
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1200
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
promiseAbnormalHasVideoProfile
(
0
,
65535
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1300
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
promiseAbnormalHasVideoProfile
(
0
,
65536
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1400
* @tc.name : test getVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
promiseAbnormalGetVideoProfile
(
-
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1500
* @tc.name : test getVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
promiseAbnormalGetVideoProfile
(
0
,
-
1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1600
* @tc.name : test getVideoRecorderProfile sourceId 65535
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
promiseAbnormalGetVideoProfile
(
65535
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1700
* @tc.name : test getVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
promiseAbnormalGetVideoProfile
(
65536
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1800
* @tc.name : test getVideoRecorderProfile qualityLevel 65535
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
promiseAbnormalGetVideoProfile
(
0
,
65535
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1900
* @tc.name : test getVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it
(
'
SUB_PROFILE_ABNORMAL_PROMISE_1900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
promiseAbnormalGetVideoProfile
(
0
,
65536
,
done
);
})
})
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* Distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* Limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
audioRecorderCaps
=
{
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
audioEncoderMime
:
media
.
CodecMimeType
.
AUDIO_AAC
,
sampleRates
:
[
8000
,
11025
,
12000
,
16000
,
22050
,
24000
,
32000
,
44100
,
48000
,
64000
,
88200
,
96000
],
bitrateRange
:
{
min
:
1
,
max
:
384000
},
channelRange
:
{
min
:
1
,
max
:
2
},
}
const
audioRecorderCapsArray
=
[
audioRecorderCaps
];
const
videoRecorderCaps
=
{
audioRecorderCaps
,
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
videoEncoderMime
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoWidthRange
:
{
min
:
2
,
max
:
1920
},
videoBitrateRange
:
{
min
:
1
,
max
:
3000000
},
videoFramerateRange
:
{
min
:
1
,
max
:
30
},
videoHeightRange
:
{
min
:
2
,
max
:
1080
},
}
const
videoRecorderCaps2
=
{
audioRecorderCaps
,
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
videoEncoderMime
:
media
.
CodecMimeType
.
VIDEO_AVC
,
videoWidthRange
:
{
min
:
2
,
max
:
1920
},
videoBitrateRange
:
{
min
:
1
,
max
:
3000000
},
videoFramerateRange
:
{
min
:
1
,
max
:
30
},
videoHeightRange
:
{
min
:
2
,
max
:
1080
},
}
const
videoRecorderCapsArray
=
[
videoRecorderCaps
,
videoRecorderCaps2
];
export
const
recorderQualityLowPara
=
{
audioBitrate
:
96000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
videoBitrate
:
192000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
176
,
videoFrameHeight
:
144
,
videoFrameRate
:
30
};
export
const
recorderQualityHighPara
=
{
audioBitrate
:
192000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_HIGH
,
videoBitrate
:
17000000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
1920
,
videoFrameHeight
:
1080
,
videoFrameRate
:
30
};
export
const
recorderQualityQcifPara
=
{
audioBitrate
:
96000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_QCIF
,
videoBitrate
:
192000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
176
,
videoFrameHeight
:
144
,
videoFrameRate
:
30
};
export
const
recorderQualityCifPara
=
{
audioBitrate
:
96000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_CIF
,
videoBitrate
:
1536000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
352
,
videoFrameHeight
:
288
,
videoFrameRate
:
30
};
export
const
recorderQuality480PPara
=
{
audioBitrate
:
96000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_480P
,
videoBitrate
:
5000000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
640
,
videoFrameHeight
:
480
,
videoFrameRate
:
30
};
export
const
recorderQuality720PPara
=
{
audioBitrate
:
192000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_720P
,
videoBitrate
:
12000000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
1280
,
videoFrameHeight
:
720
,
videoFrameRate
:
30
};
export
const
recorderQuality1080PPara
=
{
audioBitrate
:
192000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_1080P
,
videoBitrate
:
17000000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
1920
,
videoFrameHeight
:
1080
,
videoFrameRate
:
30
};
export
const
recorderQualityQvgaPara
=
{
audioBitrate
:
96000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
30
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_QVGA
,
videoBitrate
:
1200000
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
320
,
videoFrameHeight
:
240
,
videoFrameRate
:
30
};
export
const
recorderQualityLowParaSourceId1
=
{
audioBitrate
:
0
,
audioChannels
:
0
,
audioCodec
:
''
,
audioSampleRate
:
0
,
durationTime
:
0
,
fileFormat
:
''
,
qualityLevel
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
videoBitrate
:
0
,
videoCodec
:
''
,
videoFrameWidth
:
0
,
videoFrameHeight
:
0
,
videoFrameRate
:
0
};
export
const
audioRecorderPara1
=
{
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
audioEncoderMime
:
media
.
CodecMimeType
.
AUDIO_AAC
,
bitrate
:
96000
,
sampleRate
:
48000
,
channel
:
2
};
export
const
audioRecorderPara2
=
{
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
audioEncoderMime
:
media
.
CodecMimeType
.
AUDIO_AAC
,
bitrate
:
192000
,
sampleRate
:
48000
,
channel
:
2
};
export
const
audioRecorderAbnormalAll
=
{
outputFormat
:
'
aaa
'
,
audioEncoderMime
:
'
aaa
'
,
bitrate
:
655360
,
sampleRate
:
655360
,
channel
:
0
};
export
const
audioRecorderAbnormalFormatType
=
{
outputFormat
:
'
aaa
'
,
audioEncoderMime
:
media
.
CodecMimeType
.
AUDIO_AAC
,
bitrate
:
96000
,
sampleRate
:
48000
,
channel
:
2
};
export
const
audioRecorderAbnormalCodecMimeType
=
{
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
audioEncoderMime
:
'
aaa
'
,
bitrate
:
96000
,
sampleRate
:
48000
,
channel
:
2
};
export
const
audioRecorderAbnormalBitrate
=
{
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
audioEncoderMime
:
media
.
CodecMimeType
.
AUDIO_AAC
,
bitrate
:
655360
,
sampleRate
:
48000
,
channel
:
2
};
export
const
audioRecorderAbnormalSampleRate
=
{
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
audioEncoderMime
:
media
.
CodecMimeType
.
AUDIO_AAC
,
bitrate
:
96000
,
sampleRate
:
655360
,
channel
:
2
};
export
const
audioRecorderAbnormalSampleChannel
=
{
outputFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
audioEncoderMime
:
media
.
CodecMimeType
.
AUDIO_AAC
,
bitrate
:
96000
,
sampleRate
:
4800
,
channel
:
0
};
export
function
checkVideoCapsArray
(
videoCapsArray
)
{
let
expectProfile
=
{
audioBitrate
:
0
,
audioChannels
:
0
,
audioCodec
:
''
,
audioSampleRate
:
0
,
durationTime
:
0
,
fileFormat
:
''
,
qualityLevel
:
0
,
videoBitrate
:
0
,
videoCodec
:
''
,
videoFrameWidth
:
0
,
videoFrameHeight
:
0
,
videoFrameRate
:
0
,
};
expect
(
Object
.
keys
(
expectProfile
).
length
).
assertEqual
(
Object
.
keys
(
videoCapsArray
).
length
);
let
keys
=
Object
.
keys
(
videoCapsArray
);
if
(
keys
.
length
!=
0
)
{
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
let
key
=
keys
[
i
];
expect
(
videoCapsArray
[
key
]).
assertEqual
(
expectProfile
[
key
]);
console
.
info
(
'
check videoCapsArray success
'
);
}
}
else
{
console
.
info
(
'
check videoCapsArray failed
'
);
}
}
export
function
checkAudioArray
(
audioCapsArray
,
done
)
{
expect
(
audioCapsArray
.
length
).
assertEqual
(
audioRecorderCapsArray
.
length
);
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
expect
(
audioCapsArray
[
i
].
outputFormat
).
assertEqual
(
audioRecorderCapsArray
[
i
].
outputFormat
);
expect
(
audioCapsArray
[
i
].
audioEncoderMime
).
assertEqual
(
audioRecorderCapsArray
[
i
].
audioEncoderMime
);
for
(
let
j
=
0
;
j
<
audioCapsArray
[
i
].
sampleRates
.
length
;
j
++
)
{
expect
(
audioCapsArray
[
i
].
sampleRates
[
j
]).
assertEqual
(
audioRecorderCapsArray
[
i
].
sampleRates
[
j
]);
}
expect
(
audioCapsArray
[
i
].
bitrateRange
.
min
).
assertEqual
(
audioRecorderCapsArray
[
i
].
bitrateRange
.
min
);
expect
(
audioCapsArray
[
i
].
bitrateRange
.
max
).
assertEqual
(
audioRecorderCapsArray
[
i
].
bitrateRange
.
max
);
expect
(
audioCapsArray
[
i
].
channelRange
.
min
).
assertEqual
(
audioRecorderCapsArray
[
i
].
channelRange
.
min
);
expect
(
audioCapsArray
[
i
].
channelRange
.
max
).
assertEqual
(
audioRecorderCapsArray
[
i
].
channelRange
.
max
);
}
done
();
}
export
function
checkVideoArray
(
videoCapsArray
,
done
)
{
expect
(
videoCapsArray
.
length
).
assertEqual
(
videoRecorderCapsArray
.
length
);
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
expect
(
videoCapsArray
[
i
].
audioEncoderMime
).
assertEqual
(
videoRecorderCapsArray
[
i
].
audioRecorderCaps
.
audioEncoderMime
);
for
(
let
j
=
0
;
j
<
videoCapsArray
[
i
].
audioSampleRates
.
length
;
j
++
)
{
expect
(
videoCapsArray
[
i
].
audioSampleRates
[
j
]).
assertEqual
(
videoRecorderCapsArray
[
i
].
audioRecorderCaps
.
sampleRates
[
j
]);
}
expect
(
videoCapsArray
[
i
].
audioBitrateRange
.
min
).
assertEqual
(
videoRecorderCapsArray
[
i
].
audioRecorderCaps
.
bitrateRange
.
min
);
expect
(
videoCapsArray
[
i
].
audioBitrateRange
.
max
).
assertEqual
(
videoRecorderCapsArray
[
i
].
audioRecorderCaps
.
bitrateRange
.
max
);
expect
(
videoCapsArray
[
i
].
audioChannelRange
.
min
).
assertEqual
(
videoRecorderCapsArray
[
i
].
audioRecorderCaps
.
channelRange
.
min
);
expect
(
videoCapsArray
[
i
].
audioChannelRange
.
max
).
assertEqual
(
videoRecorderCapsArray
[
i
].
audioRecorderCaps
.
channelRange
.
max
);
expect
(
videoCapsArray
[
i
].
outputFormat
).
assertEqual
(
videoRecorderCapsArray
[
i
].
outputFormat
);
expect
(
videoCapsArray
[
i
].
videoWidthRange
.
min
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoWidthRange
.
min
);
expect
(
videoCapsArray
[
i
].
videoWidthRange
.
max
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoWidthRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoBitrateRange
.
min
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoBitrateRange
.
min
);
expect
(
videoCapsArray
[
i
].
videoBitrateRange
.
max
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoBitrateRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoFramerateRange
.
min
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoFramerateRange
.
min
);
expect
(
videoCapsArray
[
i
].
videoFramerateRange
.
max
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoFramerateRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoHeightRange
.
min
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoHeightRange
.
min
);
expect
(
videoCapsArray
[
i
].
videoHeightRange
.
max
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoHeightRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoEncoderMime
).
assertEqual
(
videoRecorderCapsArray
[
i
].
videoEncoderMime
);
}
done
();
}
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
*
as
base
from
'
./ProfileTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ProfileTestCallback
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
function
()
{
console
.
info
(
'
afterAll case
'
);
})
async
function
getAudioRecorderCapsTest
(
done
)
{
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getAudioRecorderCaps
((
err
,
audioCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getAudioRecorderCaps success
'
);
if
(
typeof
(
audioCapsArray
)
!=
'
undefined
'
)
{
base
.
checkAudioArray
(
audioCapsArray
,
done
);
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
async
function
getVideoRecorderCapsTest
(
done
)
{
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCapsTest success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
base
.
checkVideoArray
(
videoCapsArray
,
done
);
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
async
function
callbackGetVideoProfile
(
sourceId
,
qualityLevel
,
expectProfile
,
done
)
{
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
sourceId
,
qualityLevel
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderProfile success
'
);
expect
(
Object
.
keys
(
expectProfile
).
length
).
assertEqual
(
Object
.
keys
(
videoCapsArray
).
length
);
let
keys
=
Object
.
keys
(
videoCapsArray
);
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
let
key
=
keys
[
i
];
expect
(
videoCapsArray
[
key
]).
assertEqual
(
expectProfile
[
key
]);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
})
}
async
function
callbackAudioRecoderConfigSupported
(
audioProfile
,
done
)
{
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
isAudioRecoderConfigSupported
(
audioProfile
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
true
);
console
.
info
(
'
isAudioRecoderConfigSupported: success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
})
}
async
function
callbackHasVideoProfile
(
sourceId
,
qualityLevel
,
done
)
{
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
sourceId
,
qualityLevel
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
true
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
})
}
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0100
* @tc.name : test getAudioRecorderCaps
* @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
getAudioRecorderCapsTest
(
done
);
console
.
info
(
"
test getAudioRecorderCaps success
"
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0200
* @tc.name : test getVideoRecorderCapsTest
* @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/
audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
getVideoRecorderCapsTest
(
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0300
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
base
.
recorderQualityLowPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0400
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_HIGH
,
base
.
recorderQualityHighPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0500
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_QCIF
,
base
.
recorderQualityQcifPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0600
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 3
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_CIF
,
base
.
recorderQualityCifPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0700
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 4
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_480P
,
base
.
recorderQuality480PPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0800
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 5
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_720P
,
base
.
recorderQuality720PPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0900
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 6
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_1080P
,
base
.
recorderQuality1080PPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1000
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 7
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_QVGA
,
base
.
recorderQualityQvgaPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1100
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackGetVideoProfile
(
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
base
.
recorderQualityLowParaSourceId1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1200
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAudioRecoderConfigSupported
(
base
.
audioRecorderPara1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1300
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
callbackAudioRecoderConfigSupported
(
base
.
audioRecorderPara2
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1400
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test hasVideoRecorderProfile
'
);
callbackHasVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
})
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js
0 → 100644
浏览文件 @
a0f24507
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* Distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* Limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
*
as
base
from
'
./ProfileTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ProfileTestPromise
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
function
()
{
console
.
info
(
'
afterAll case
'
);
})
async
function
getAudioRecorderCapsTest
(
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getAudioRecorderCaps
().
then
(
async
(
audioCapsArray
)
=>
{
console
.
info
(
'
getAudioRecorderCaps success
'
);
if
(
typeof
(
audioCapsArray
)
!=
'
undefined
'
)
{
base
.
checkAudioArray
(
audioCapsArray
,
done
);
}
else
{
console
.
info
(
'
audioCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
async
function
getVideoRecorderCapsTest
(
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
().
then
(
async
(
videoCapsArray
)
=>
{
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
base
.
checkVideoArray
(
videoCapsArray
,
done
);
}
else
{
console
.
info
(
'
audioCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
async
function
promiseGetVideoProfile
(
sourceId
,
qualityLevel
,
expectProfile
,
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
sourceId
,
qualityLevel
).
then
(
async
(
videoCapsArray
)
=>
{
console
.
info
(
'
getVideoRecorderProfile success
'
);
expect
(
Object
.
keys
(
expectProfile
).
length
).
assertEqual
(
Object
.
keys
(
videoCapsArray
).
length
);
let
keys
=
Object
.
keys
(
videoCapsArray
);
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
let
key
=
keys
[
i
];
expect
(
videoCapsArray
[
key
]).
assertEqual
(
expectProfile
[
key
]);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
async
function
promiseAudioRecoderConfigSupported
(
audioProfile
,
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
isAudioRecoderConfigSupported
(
audioProfile
).
then
(
async
(
ean
)
=>
{
console
.
info
(
'
isAudioRecoderConfigSupported: success
'
+
ean
);
expect
(
ean
).
assertEqual
(
true
);
console
.
info
(
'
isAudioRecoderConfigSupported: success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
async
function
promiseHasVideoProfile
(
sourceId
,
qualityLevel
,
done
)
{
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
sourceId
,
qualityLevel
).
then
(
async
(
ean
)
=>
{
expect
(
ean
).
assertEqual
(
true
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is undefined
'
);
expect
().
assertFail
();
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0100
* @tc.name : test getAudioRecorderCaps
* @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
getAudioRecorderCapsTest
(
done
);
console
.
info
(
"
test getAudioRecorderCaps success
"
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0200
* @tc.name : test getVideoRecorderCapsTest
* @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/
audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
getVideoRecorderCapsTest
(
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0300
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
base
.
recorderQualityLowPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0400
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_HIGH
,
base
.
recorderQualityHighPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0500
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_QCIF
,
base
.
recorderQualityQcifPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0600
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 3
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_CIF
,
base
.
recorderQualityCifPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0700
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 4
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_480P
,
base
.
recorderQuality480PPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0800
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 5
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_720P
,
base
.
recorderQuality720PPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0900
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 6
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_1080P
,
base
.
recorderQuality1080PPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1000
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 7
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_QVGA
,
base
.
recorderQualityQvgaPara
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1100
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseGetVideoProfile
(
1
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
base
.
recorderQualityLowParaSourceId1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1200
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAudioRecoderConfigSupported
(
base
.
audioRecorderPara1
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1300
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getAudioRecorderCaps
"
);
promiseAudioRecoderConfigSupported
(
base
.
audioRecorderPara2
,
done
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1400
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
test hasVideoRecorderProfile
'
);
promiseHasVideoProfile
(
0
,
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
done
);
})
})
multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
a0f24507
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"entry_MainAbility"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Empty Ability"
}
]
}
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
a0f24507
6.6 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录