Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
838f3009
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看板
提交
838f3009
编写于
7月 09, 2022
作者:
N
NOBUGGERS
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
recorder profile xts testcase Signed-off-by: NOBUGGERS <ruanmeng@huawei.com>
Signed-off-by:
N
NOBUGGERS
<
ruanmeng@huawei.com
>
上级
0da8a211
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
0 addition
and
2233 deletion
+0
-2233
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileFuncCallbackTest.test.js
...rProfile/src/main/js/test/ProfileFuncCallbackTest.test.js
+0
-113
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileFuncPromiseTest.test.js
...erProfile/src/main/js/test/ProfileFuncPromiseTest.test.js
+0
-75
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/bak/ProfileAbnormalTest.test.js
...rProfile/src/main/js/test/bak/ProfileAbnormalTest.test.js
+0
-401
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/bak/ProfileTest.test.js
.../recorderProfile/src/main/js/test/bak/ProfileTest.test.js
+0
-788
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/bak/ProfileTestPromise.test.js
...erProfile/src/main/js/test/bak/ProfileTestPromise.test.js
+0
-856
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/profileTest.rar
...standard/recorderProfile/src/main/js/test/profileTest.rar
+0
-0
未找到文件。
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileFuncCallbackTest.test.js
已删除
100644 → 0
浏览文件 @
0da8a211
/*
* 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
{
checkAudioArray
,
checkVideoArray
}
from
'
./ProfileTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ProfileFuncCallbackTest
'
,
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
'
)
{
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
'
)
{
checkVideoArray
(
videoCapsArray
,
done
);
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0100
* @tc.name : 01.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 111
"
);
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0200
* @tc.name : 02.test getVideoRecorderCapsTest
* @tc.desc : audioEncoderMime/sampleRates/bitrateRange/channelRange
* @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
);
})
})
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileFuncPromiseTest.test.js
已删除
100644 → 0
浏览文件 @
0da8a211
/*
* 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
{
checkAudioArray
,
checkVideoArray
}
from
'
./ProfileTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ProfileFuncPromiseTest
'
,
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
)
{
await
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
await
mediaCaps
.
getAudioRecorderCaps
().
then
(
async
(
audioCapsArray
)
=>
{
console
.
info
(
'
getAudioRecorderCaps success
'
);
if
(
typeof
(
audioCapsArray
)
!=
'
undefined
'
)
{
return
audioCapsArray
;
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
expect
().
assertFail
();
done
();
}
})
}
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0100
* @tc.name : 01.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
"
);
let
audioCapsArray
=
getAudioRecorderCapsTest
(
done
);
checkAudioArray
(
audioCapsArray
,
done
);
console
.
info
(
"
test getAudioRecorderCaps 111
"
);
})
})
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/bak/ProfileAbnormalTest.test.js
已删除
100644 → 0
浏览文件 @
0da8a211
/*
* 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
'
describe
(
'
VideoRecorderProfileAbnormalCallback
'
,
function
()
{
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0100
* @tc.name : 01.test getVideoRecorderProfile
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
-
1
,
0
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0200
* @tc.name : 02.test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
0
,
-
1
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0300
* @tc.name : 03.test getVideoRecorderProfile
* @tc.desc : sourceId 100000 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
100000
,
0
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0400
* @tc.name : 04.test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 100000
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
0
,
100000
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0500
* @tc.name : 05.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test isAudioRecoderConfigSupported
"
);
let
audioProfile
=
{
"
outputFormat
"
:
'
aaa
'
,
"
audioEncoderMime
"
:
media
.
CodecMimeType
.
AUDIO_AAC
,
"
bitrate
"
:
8000
,
"
sampleRate
"
:
500
,
"
channel
"
:
1
,
}
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 not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0600
* @tc.name : 06.test hasVideoRecorderProfile
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
-
1
,
0
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0700
* @tc.name : 07.test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
0
,
-
1
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0800
* @tc.name : 08.test hasVideoRecorderProfile
* @tc.desc : sourceId 100000 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
100000
,
0
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0900
* @tc.name : 09.test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 100000
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
0
,
100000
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1000
* @tc.name : 10.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test isAudioRecoderConfigSupported
"
);
let
audioProfile
=
{
"
outputFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
"
audioEncoderMime
"
:
'
aaa
'
,
"
bitrate
"
:
8000
,
"
sampleRate
"
:
500
,
"
channel
"
:
1
,
}
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 not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1100
* @tc.name : 11.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test isAudioRecoderConfigSupported
"
);
let
audioProfile
=
{
"
outputFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
"
audioEncoderMime
"
:
media
.
CodecMimeType
.
AUDIO_AAC
,
"
bitrate
"
:
1000000
,
"
sampleRate
"
:
500
,
"
channel
"
:
1
,
}
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 not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1200
* @tc.name : 12.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test isAudioRecoderConfigSupported
"
);
let
audioProfile
=
{
"
outputFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
"
audioEncoderMime
"
:
media
.
CodecMimeType
.
AUDIO_AAC
,
"
bitrate
"
:
8000
,
"
sampleRate
"
:
1000000
,
"
channel
"
:
1
,
}
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 not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1300
* @tc.name : 13.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_ABNORMAL_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test isAudioRecoderConfigSupported
"
);
let
audioProfile
=
{
"
outputFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
"
audioEncoderMime
"
:
media
.
CodecMimeType
.
AUDIO_AAC
,
"
bitrate
"
:
8000
,
"
sampleRate
"
:
500
,
"
channel
"
:
0
,
}
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 not defined
'
);
done
();
}
})
})
})
\ No newline at end of file
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/bak/ProfileTest.test.js
已删除
100644 → 0
浏览文件 @
0da8a211
/*
* 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
'
describe
(
'
VideoRecorderProfileFuncCallback
'
,
function
()
{
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0100
* @tc.name : 0100.test getAudioRecorderCaps
* @tc.desc : outputFormat
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
expectFormat
=
[
"
m4a
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].outputFormat:
'
+
audioCapsArray
[
i
].
outputFormat
);
expect
(
audioCapsArray
[
i
].
outputFormat
).
assertEqual
(
expectFormat
[
0
]);
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0200
* @tc.name : 0200.test getAudioRecorderCaps
* @tc.desc : audioEncoderMime
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
let
expectAudioEncoderMime
=
[
"
audio/mp4a-latm
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].audioEncoderMime:
'
+
audioCapsArray
[
i
].
audioEncoderMime
);
expect
(
audioCapsArray
[
i
].
audioEncoderMime
).
assertEqual
(
expectAudioEncoderMime
[
0
]);
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0300
* @tc.name : 0300.test getAudioRecorderCaps
* @tc.desc : sampleRates
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
let
expectSampleRates
=
[
8000
,
11025
,
12000
,
16000
,
22050
,
24000
,
32000
,
44100
,
48000
,
64000
,
88200
,
96000
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].sampleRates:
'
+
JSON
.
stringify
(
audioCapsArray
[
i
].
sampleRates
));
expect
(
JSON
.
stringify
(
audioCapsArray
[
i
].
sampleRates
)
==
JSON
.
stringify
(
expectSampleRates
))
.
assertTrue
();
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0400
* @tc.name : 0400.test getAudioRecorderCaps
* @tc.desc : bitrateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
expectBitrateRangeMin
=
[
"
1
"
];
let
expectBitrateRangeMax
=
[
"
384000
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].bitrateRange.min:
'
+
audioCapsArray
[
i
].
bitrateRange
.
min
);
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].bitrateRange.max:
'
+
audioCapsArray
[
i
].
bitrateRange
.
max
);
expect
(
audioCapsArray
[
i
].
bitrateRange
.
min
.
toString
()).
assertEqual
(
expectBitrateRangeMin
[
0
].
toString
());
expect
(
audioCapsArray
[
i
].
bitrateRange
.
max
.
toString
()).
assertEqual
(
expectBitrateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0500
* @tc.name : 0500.test getAudioRecorderCaps
* @tc.desc : channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
let
expectChannelRangeMin
=
[
"
1
"
];
let
expectChannelRangeMax
=
[
"
2
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].channelRange.min:
'
+
audioCapsArray
[
i
].
channelRange
.
min
);
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].channelRange.max:
'
+
audioCapsArray
[
i
].
channelRange
.
max
);
expect
(
audioCapsArray
[
i
].
channelRange
.
min
.
toString
()).
assertEqual
(
expectChannelRangeMin
[
0
].
toString
());
expect
(
audioCapsArray
[
i
].
channelRange
.
max
.
toString
()).
assertEqual
(
expectChannelRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0600
* @tc.name : 0600.test getVideoRecorderCaps
* @tc.desc : outputFormat
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
let
expectFormat
=
[
"
mp4
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].outputFormat:
'
+
videoCapsArray
[
i
].
outputFormat
);
expect
(
videoCapsArray
[
i
].
outputFormat
).
assertEqual
(
expectFormat
[
0
]);
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0700
* @tc.name : 0700.test getVideoRecorderCaps
* @tc.desc : audioEncoderMime
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
let
expectAudioEncoderMime
=
[
"
audio/mp4a-latm
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioEncoderMime:
'
+
videoCapsArray
[
i
].
audioEncoderMime
);
expect
(
videoCapsArray
[
i
].
audioEncoderMime
).
assertEqual
(
expectAudioEncoderMime
[
0
]);
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0800
* @tc.name : 0800.test getVideoRecorderCaps
* @tc.desc : audioSampleRates
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
let
expectSampleRates
=
[
8000
,
11025
,
12000
,
16000
,
22050
,
24000
,
32000
,
44100
,
48000
,
64000
,
88200
,
96000
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].sampleRates:
'
+
typeof
(
videoCapsArray
[
i
].
audioSampleRates
));
expect
(
JSON
.
stringify
(
videoCapsArray
[
i
].
audioSampleRates
)
==
JSON
.
stringify
(
expectSampleRates
)
).
assertTrue
();
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0900
* @tc.name : 0900.test getVideoRecorderCaps
* @tc.desc : videoEncoderMime
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
let
expectVideoEncoderMime
=
[
"
video/mp4v-es
"
,
"
video/avc
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoEncoderMime:
'
+
videoCapsArray
[
i
].
videoEncoderMime
);
expect
(
videoCapsArray
[
i
].
videoEncoderMime
).
assertEqual
(
expectVideoEncoderMime
[
i
]);
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1000
* @tc.name : 1000.test getVideoRecorderCaps
* @tc.desc : audioBitrateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
let
expectAudioBitrateRangeMin
=
[
"
1
"
];
let
expectAudioBitrateRangeMax
=
[
"
384000
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioBitrateRange.min:
'
+
videoCapsArray
[
i
].
audioBitrateRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioBitrateRange.max:
'
+
videoCapsArray
[
i
].
audioBitrateRange
.
max
);
expect
(
videoCapsArray
[
i
].
audioBitrateRange
.
min
.
toString
()).
assertEqual
(
expectAudioBitrateRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
audioBitrateRange
.
max
.
toString
()).
assertEqual
(
expectAudioBitrateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1100
* @tc.name : 1100.test getVideoRecorderCaps
* @tc.desc : audioChannelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
let
expectAudioChannelRangeMin
=
[
"
1
"
];
let
expectAudioChannelRangeMax
=
[
"
2
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioChannelRange.min:
'
+
videoCapsArray
[
i
].
audioChannelRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioChannelRange.max:
'
+
videoCapsArray
[
i
].
audioChannelRange
.
max
);
expect
(
videoCapsArray
[
i
].
audioChannelRange
.
min
.
toString
()).
assertEqual
(
expectAudioChannelRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
audioChannelRange
.
max
.
toString
()).
assertEqual
(
expectAudioChannelRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1200
* @tc.name : 1200.test getVideoRecorderCaps
* @tc.desc : videoBitrateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1200
'
,
0
,
async
function
(
done
)
{
let
expectVideoBitrateRangeMin
=
[
"
1
"
];
let
expectVideoBitrateRangeMax
=
[
"
3000000
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoBitrateRange.min:
'
+
videoCapsArray
[
i
].
videoBitrateRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoBitrateRange.max:
'
+
videoCapsArray
[
i
].
videoBitrateRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoBitrateRange
.
min
.
toString
()).
assertEqual
(
expectVideoBitrateRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoBitrateRange
.
max
.
toString
()).
assertEqual
(
expectVideoBitrateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1300
* @tc.name : 1300.test getVideoRecorderCaps
* @tc.desc : videoFramerateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
let
expectVideoFramerateRangeMin
=
[
"
1
"
];
let
expectVideoFramerateRangeMax
=
[
"
30
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoFramerateRange.min:
'
+
videoCapsArray
[
i
].
videoFramerateRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoFramerateRange.max:
'
+
videoCapsArray
[
i
].
videoFramerateRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoFramerateRange
.
min
.
toString
()).
assertEqual
(
expectVideoFramerateRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoFramerateRange
.
max
.
toString
()).
assertEqual
(
expectVideoFramerateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1400
* @tc.name : 1400.test getVideoRecorderCaps
* @tc.desc : videoWidthRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1400
'
,
0
,
async
function
(
done
)
{
let
expectVideoWidthRangeMin
=
[
"
2
"
];
let
expectVideoWidthRangeMax
=
[
"
1920
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoWidthRange.min:
'
+
videoCapsArray
[
i
].
videoWidthRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoWidthRange.max:
'
+
videoCapsArray
[
i
].
videoWidthRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoWidthRange
.
min
.
toString
()).
assertEqual
(
expectVideoWidthRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoWidthRange
.
max
.
toString
()).
assertEqual
(
expectVideoWidthRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1500
* @tc.name : 1500.test getVideoRecorderCaps
* @tc.desc : videoHeightRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1500
'
,
0
,
async
function
(
done
)
{
let
expectVideoHeightRangeMin
=
[
"
2
"
];
let
expectVideoHeightRangeMax
=
[
"
1080
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderCaps
((
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderCaps success
'
);
if
(
typeof
(
videoCapsArray
)
!=
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoHeightRange.min:
'
+
videoCapsArray
[
i
].
videoHeightRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoHeightRange.max:
'
+
videoCapsArray
[
i
].
videoHeightRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoHeightRange
.
min
.
toString
()).
assertEqual
(
expectVideoHeightRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoHeightRange
.
max
.
toString
()).
assertEqual
(
expectVideoHeightRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1600
* @tc.name : 1600.test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1600
'
,
0
,
async
function
(
done
)
{
let
expectProfile
=
{
"
audioBitrate
"
:
0
,
"
audioChannels
"
:
0
,
"
audioCodec
"
:
media
.
CodecMimeType
.
VIDEO_AVC
,
"
audioSampleRate
"
:
44100
,
"
durationTime
"
:
10030
,
"
fileFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
"
qualityLevel
"
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
"
videoBitrate
"
:
0
,
"
videoCodec
"
:
media
.
CodecMimeType
.
VIDEO_H263
,
"
videoFrameWidth
"
:
480
,
"
videoFrameHeight
"
:
720
,
"
videoFrameRate
"
:
44100
,
}
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
0
,
0
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderProfile success
'
);
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
expect
(
videoCapsArray
[
i
]).
assertEqual
(
expectProfile
[
i
]);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1700
* @tc.name : 1700.test getVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1700
'
,
0
,
async
function
(
done
)
{
let
expectProfile
=
{
"
audioBitrate
"
:
0
,
"
audioChannels
"
:
0
,
"
audioCodec
"
:
media
.
CodecMimeType
.
VIDEO_AVC
,
"
audioSampleRate
"
:
44100
,
"
durationTime
"
:
10030
,
"
fileFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
"
qualityLevel
"
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
"
videoBitrate
"
:
0
,
"
videoCodec
"
:
media
.
CodecMimeType
.
VIDEO_H263
,
"
videoFrameWidth
"
:
480
,
"
videoFrameHeight
"
:
720
,
"
videoFrameRate
"
:
44100
,
}
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
1
,
0
,
(
err
,
videoCapsArray
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getVideoRecorderProfile success
'
);
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
expect
(
videoCapsArray
[
i
]).
assertEqual
(
expectProfile
[
i
]);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1800
* @tc.name : 1800.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test isAudioRecoderConfigSupported
"
);
let
audioProfile
=
{
"
outputFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
"
audioEncoderMime
"
:
media
.
CodecMimeType
.
AUDIO_AAC
,
"
bitrate
"
:
8000
,
"
sampleRate
"
:
500
,
"
channel
"
:
1
,
}
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 not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1900
* @tc.name : 1900.test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_1900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
0
,
0
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
true
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_2000
* @tc.name : 2000.test hasVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_CALLBACK_2000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
((
err
,
mediaCaps
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
1
,
0
,
(
err
,
ean
)
=>
{
expect
(
err
).
assertUndefined
();
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
})
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/bak/ProfileTestPromise.test.js
已删除
100644 → 0
浏览文件 @
0da8a211
/*
* 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
'
describe
(
'
VideoRecorderProfileFuncCallback
'
,
function
()
{
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0100
* @tc.name : 01.test getAudioRecorderCaps
* @tc.desc : outputFormat
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
expectFormat
=
[
"
m4a
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].outputFormat:
'
+
audioCapsArray
[
i
].
outputFormat
);
expect
(
audioCapsArray
[
i
].
outputFormat
).
assertEqual
(
expectFormat
[
0
]);
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0200
* @tc.name : 02.test getAudioRecorderCaps
* @tc.desc : audioEncoderMime
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
let
expectAudioEncoderMime
=
[
"
audio/mp4a-latm
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].audioEncoderMime:
'
+
audioCapsArray
[
i
].
audioEncoderMime
);
expect
(
audioCapsArray
[
i
].
audioEncoderMime
).
assertEqual
(
expectAudioEncoderMime
[
0
]);
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0300
* @tc.name : 03.test getAudioRecorderCaps
* @tc.desc : sampleRates
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
let
expectSampleRates
=
[
8000
,
11025
,
12000
,
16000
,
22050
,
24000
,
32000
,
44100
,
48000
,
64000
,
88200
,
96000
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].sampleRates:
'
+
typeof
(
audioCapsArray
[
i
].
sampleRates
));
expect
(
JSON
.
stringify
(
audioCapsArray
[
i
].
sampleRates
)
==
JSON
.
stringify
(
expectSampleRates
))
.
assertTrue
();
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0400
* @tc.name : 04.test getAudioRecorderCaps
* @tc.desc : bitrateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0400
'
,
0
,
async
function
(
done
)
{
let
expectBitrateRangeMin
=
[
"
1
"
];
let
expectBitrateRangeMax
=
[
"
384000
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].bitrateRange.min:
'
+
audioCapsArray
[
i
].
bitrateRange
.
min
);
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].bitrateRange.max:
'
+
audioCapsArray
[
i
].
bitrateRange
.
max
);
expect
(
audioCapsArray
[
i
].
bitrateRange
.
min
.
toString
()).
assertEqual
(
expectBitrateRangeMin
[
0
].
toString
());
expect
(
audioCapsArray
[
i
].
bitrateRange
.
max
.
toString
()).
assertEqual
(
expectBitrateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0500
* @tc.name : 05.test getAudioRecorderCaps
* @tc.desc : channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0500
'
,
0
,
async
function
(
done
)
{
let
expectChannelRangeMin
=
[
"
1
"
];
let
expectChannelRangeMax
=
[
"
2
"
];
console
.
info
(
"
test getAudioRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
audioCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].channelRange.min:
'
+
audioCapsArray
[
i
].
channelRange
.
min
);
console
.
info
(
'
audioCapsArray[
'
+
i
+
'
].channelRange.max:
'
+
audioCapsArray
[
i
].
channelRange
.
max
);
expect
(
audioCapsArray
[
i
].
channelRange
.
min
.
toString
()).
assertEqual
(
expectChannelRangeMin
[
0
].
toString
());
expect
(
audioCapsArray
[
i
].
channelRange
.
max
.
toString
()).
assertEqual
(
expectChannelRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
audioCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0600
* @tc.name : 06.test getVideoRecorderCaps
* @tc.desc : outputFormat
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0600
'
,
0
,
async
function
(
done
)
{
let
expectFormat
=
[
"
mp4
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].outputFormat:
'
+
videoCapsArray
[
i
].
outputFormat
);
expect
(
videoCapsArray
[
i
].
outputFormat
).
assertEqual
(
expectFormat
[
0
]);
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0700
* @tc.name : 07.test getVideoRecorderCaps
* @tc.desc : audioEncoderMime
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0700
'
,
0
,
async
function
(
done
)
{
let
expectAudioEncoderMime
=
[
"
audio/mp4a-latm
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioEncoderMime:
'
+
videoCapsArray
[
i
].
audioEncoderMime
);
expect
(
videoCapsArray
[
i
].
audioEncoderMime
).
assertEqual
(
expectAudioEncoderMime
[
0
]);
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0800
* @tc.name : 08.test getVideoRecorderCaps
* @tc.desc : audioSampleRates
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0800
'
,
0
,
async
function
(
done
)
{
let
expectSampleRates
=
[
8000
,
11025
,
12000
,
16000
,
22050
,
24000
,
32000
,
44100
,
48000
,
64000
,
88200
,
96000
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].sampleRates:
'
+
typeof
(
videoCapsArray
[
i
].
audioSampleRates
));
expect
(
JSON
.
stringify
(
videoCapsArray
[
i
].
audioSampleRates
)
==
JSON
.
stringify
(
expectSampleRates
)
).
assertTrue
();
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0900
* @tc.name : 09.test getVideoRecorderCaps
* @tc.desc : videoEncoderMime
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_0900
'
,
0
,
async
function
(
done
)
{
let
expectVideoEncoderMime
=
[
"
video/mp4v-es
"
,
"
video/avc
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoEncoderMime:
'
+
videoCapsArray
[
i
].
videoEncoderMime
);
expect
(
videoCapsArray
[
i
].
videoEncoderMime
).
assertEqual
(
expectVideoEncoderMime
[
i
]);
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1000
* @tc.name : 10.test getVideoRecorderCaps
* @tc.desc : audioBitrateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1000
'
,
0
,
async
function
(
done
)
{
let
expectAudioBitrateRangeMin
=
[
"
1
"
];
let
expectAudioBitrateRangeMax
=
[
"
384000
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioBitrateRange.min:
'
+
videoCapsArray
[
i
].
audioBitrateRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioBitrateRange.max:
'
+
videoCapsArray
[
i
].
audioBitrateRange
.
max
);
expect
(
videoCapsArray
[
i
].
audioBitrateRange
.
min
.
toString
()).
assertEqual
(
expectAudioBitrateRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
audioBitrateRange
.
max
.
toString
()).
assertEqual
(
expectAudioBitrateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1100
* @tc.name : 11.test getVideoRecorderCaps
* @tc.desc : audioChannelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1100
'
,
0
,
async
function
(
done
)
{
let
expectAudioChannelRangeMin
=
[
"
1
"
];
let
expectAudioChannelRangeMax
=
[
"
2
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioChannelRange.min:
'
+
videoCapsArray
[
i
].
audioChannelRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].audioChannelRange.max:
'
+
videoCapsArray
[
i
].
audioChannelRange
.
max
);
expect
(
videoCapsArray
[
i
].
audioChannelRange
.
min
.
toString
()).
assertEqual
(
expectAudioChannelRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
audioChannelRange
.
max
.
toString
()).
assertEqual
(
expectAudioChannelRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1200
* @tc.name : 12.test getVideoRecorderCaps
* @tc.desc : videoBitrateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1200
'
,
0
,
async
function
(
done
)
{
let
expectVideoBitrateRangeMin
=
[
"
1
"
];
let
expectVideoBitrateRangeMax
=
[
"
3000000
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoBitrateRange.min:
'
+
videoCapsArray
[
i
].
videoBitrateRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoBitrateRange.max:
'
+
videoCapsArray
[
i
].
videoBitrateRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoBitrateRange
.
min
.
toString
()).
assertEqual
(
expectVideoBitrateRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoBitrateRange
.
max
.
toString
()).
assertEqual
(
expectVideoBitrateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1300
* @tc.name : 13.test getVideoRecorderCaps
* @tc.desc : videoFramerateRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1300
'
,
0
,
async
function
(
done
)
{
let
expectVideoFramerateRangeMin
=
[
"
1
"
];
let
expectVideoFramerateRangeMax
=
[
"
30
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoFramerateRange.min:
'
+
videoCapsArray
[
i
].
videoFramerateRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoFramerateRange.max:
'
+
videoCapsArray
[
i
].
videoFramerateRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoFramerateRange
.
min
.
toString
()).
assertEqual
(
expectVideoFramerateRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoFramerateRange
.
max
.
toString
()).
assertEqual
(
expectVideoFramerateRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1400
* @tc.name : 14.test getVideoRecorderCaps
* @tc.desc : videoWidthRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1400
'
,
0
,
async
function
(
done
)
{
let
expectVideoWidthRangeMin
=
[
"
2
"
];
let
expectVideoWidthRangeMax
=
[
"
1920
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoWidthRange.min:
'
+
videoCapsArray
[
i
].
videoWidthRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoWidthRange.max:
'
+
videoCapsArray
[
i
].
videoWidthRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoWidthRange
.
min
.
toString
()).
assertEqual
(
expectVideoWidthRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoWidthRange
.
max
.
toString
()).
assertEqual
(
expectVideoWidthRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1500
* @tc.name : 15.test getVideoRecorderCaps
* @tc.desc : videoHeightRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1500
'
,
0
,
async
function
(
done
)
{
let
expectVideoHeightRangeMin
=
[
"
2
"
];
let
expectVideoHeightRangeMax
=
[
"
1080
"
];
console
.
info
(
"
test getVideoRecorderCaps
"
);
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
'
)
{
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoHeightRange.min:
'
+
videoCapsArray
[
i
].
videoHeightRange
.
min
);
console
.
info
(
'
videoCapsArray[
'
+
i
+
'
].videoHeightRange.max:
'
+
videoCapsArray
[
i
].
videoHeightRange
.
max
);
expect
(
videoCapsArray
[
i
].
videoHeightRange
.
min
.
toString
()).
assertEqual
(
expectVideoHeightRangeMin
[
0
].
toString
());
expect
(
videoCapsArray
[
i
].
videoHeightRange
.
max
.
toString
()).
assertEqual
(
expectVideoHeightRangeMax
[
0
].
toString
());
}
}
else
{
console
.
info
(
'
videoCaps is not defined
'
);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1600
* @tc.name : 16.test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1600
'
,
0
,
async
function
(
done
)
{
let
expectProfile
=
{
"
audioBitrate
"
:
0
,
"
audioChannels
"
:
0
,
"
audioCodec
"
:
media
.
CodecMimeType
.
VIDEO_AVC
,
"
audioSampleRate
"
:
44100
,
"
durationTime
"
:
10030
,
"
fileFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
"
qualityLevel
"
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
"
videoBitrate
"
:
0
,
"
videoCodec
"
:
media
.
CodecMimeType
.
VIDEO_H263
,
"
videoFrameWidth
"
:
480
,
"
videoFrameHeight
"
:
720
,
"
videoFrameRate
"
:
44100
,
}
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
0
,
0
).
then
(
async
(
videoCapsArray
)
=>
{
console
.
info
(
'
getVideoRecorderProfile success
'
);
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
expect
(
videoCapsArray
[
i
]).
assertEqual
(
expectProfile
[
i
]);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1700
* @tc.name : 17.test getVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1700
'
,
0
,
async
function
(
done
)
{
let
expectProfile
=
{
"
audioBitrate
"
:
0
,
"
audioChannels
"
:
0
,
"
audioCodec
"
:
media
.
CodecMimeType
.
VIDEO_AVC
,
"
audioSampleRate
"
:
44100
,
"
durationTime
"
:
10030
,
"
fileFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
"
qualityLevel
"
:
media
.
VideoRecorderQualityLevel
.
RECORDER_QUALITY_LOW
,
"
videoBitrate
"
:
0
,
"
videoCodec
"
:
media
.
CodecMimeType
.
VIDEO_H263
,
"
videoFrameWidth
"
:
480
,
"
videoFrameHeight
"
:
720
,
"
videoFrameRate
"
:
44100
,
}
console
.
info
(
"
test getVideoRecorderProfile
"
);
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
getVideoRecorderProfile
(
1
,
0
).
then
(
async
(
videoCapsArray
)
=>
{
console
.
info
(
'
getVideoRecorderProfile success
'
);
for
(
let
i
=
0
;
i
<
videoCapsArray
.
length
;
i
++
)
{
expect
(
videoCapsArray
[
i
]).
assertEqual
(
expectProfile
[
i
]);
}
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1800
* @tc.name : 18.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test isAudioRecoderConfigSupported
"
);
let
audioProfile
=
{
"
outputFormat
"
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
"
audioEncoderMime
"
:
media
.
CodecMimeType
.
AUDIO_AAC
,
"
bitrate
"
:
8000
,
"
sampleRate
"
:
500
,
"
channel
"
:
1
,
}
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
isAudioRecoderConfigSupported
(
audioProfile
).
then
(
async
(
ean
)
=>
{
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
isAudioRecoderConfigSupported: success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1900
* @tc.name : 19.test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_1900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
0
,
0
).
then
(
async
(
ean
)
=>
{
expect
(
ean
).
assertEqual
(
true
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_2000
* @tc.name : 20.test hasVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_PROFILE_FUNCTION_PROMISE_2000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
test hasVideoRecorderProfile
"
);
media
.
getMediaCapability
().
then
(
async
(
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
mediaCaps
.
hasVideoRecorderProfile
(
1
,
0
).
then
(
async
(
ean
)
=>
{
expect
(
ean
).
assertEqual
(
false
);
console
.
info
(
'
hasVideoRecorderProfile success
'
);
done
();
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
done
();
}
},
err
=>
{
expect
(
err
).
assertUndefined
();
done
();
})
})
})
multimedia/media/media_js_standard/recorderProfile/src/main/js/test/profileTest.rar
已删除
100644 → 0
浏览文件 @
0da8a211
文件已删除
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录