Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c76403dd
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看板
未验证
提交
c76403dd
编写于
3月 07, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7843 【媒体子系统】增加try catch捕获UiDriver异常
Merge pull request !7843 from 秦莉文/monthly_20221018
上级
f13340eb
e965b127
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
5818 addition
and
5793 deletion
+5818
-5793
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
...dard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
+15
-10
multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
...angeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
+1357
-1352
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
...dard/audioManager/src/main/js/test/AudioFramework.test.js
+4395
-4390
multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js
..._js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js
+14
-9
multimedia/media/media_js_standard/MediaTestBase.js
multimedia/media/media_js_standard/MediaTestBase.js
+37
-32
未找到文件。
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
浏览文件 @
c76403dd
...
...
@@ -449,15 +449,20 @@ export default function audioCapturer() {
})
}
async
function
driveFn
()
{
console
.
info
(
`come in driveFn`
);
let
driver
=
await
UiDriver
.
create
();
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
);
try
{
let
driver
=
await
UiDriver
.
create
()
console
.
info
(
`case come in driveFn 222`
)
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
)
await
sleep
(
100
);
console
.
info
(
`UiDriver start`
);
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'
允许
'
));
console
.
info
(
`button is
${
JSON
.
stringify
(
button
)}
`
);
await
sleep
(
100
);
await
button
.
click
();
}
catch
(
err
)
{
console
.
info
(
'
err is
'
+
err
);
return
;
}
}
beforeAll
(
async
function
()
{
...
...
multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
浏览文件 @
c76403dd
...
...
@@ -19,7 +19,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from
import
{
UiDriver
,
BY
}
from
'
@ohos.UiTest
'
export
default
function
audioCapturerChange
()
{
describe
(
'
audioCapturerChange
'
,
function
()
{
describe
(
'
audioCapturerChange
'
,
function
()
{
let
audioStreamManager
;
let
audioStreamManagerCB
;
let
Tag
=
"
AFCapLog
"
;
...
...
@@ -37,15 +37,20 @@ describe('audioCapturerChange', function () {
})
}
async
function
driveFn
()
{
console
.
info
(
`come in driveFn`
);
let
driver
=
await
UiDriver
.
create
();
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
);
try
{
let
driver
=
await
UiDriver
.
create
()
console
.
info
(
`case come in driveFn 222`
)
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
)
await
sleep
(
100
);
console
.
info
(
`UiDriver start`
);
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'
允许
'
));
console
.
info
(
`button is
${
JSON
.
stringify
(
button
)}
`
);
await
sleep
(
100
);
await
button
.
click
();
}
catch
(
err
)
{
console
.
info
(
'
err is
'
+
err
);
return
;
}
}
beforeAll
(
async
function
()
{
...
...
@@ -1638,5 +1643,5 @@ describe('audioCapturerChange', function () {
});
})
})
})
}
\ No newline at end of file
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
浏览文件 @
c76403dd
...
...
@@ -20,7 +20,7 @@ import { UiDriver, BY } from '@ohos.UiTest'
export
default
function
audioFramework
()
{
describe
(
'
audioFramework
'
,
function
()
{
describe
(
'
audioFramework
'
,
function
()
{
let
TagFrmwk
=
"
AudioFrameworkTest
"
;
console
.
info
(
`
${
TagFrmwk
}
: Create AudioManger Object JS Framework`
);
let
audioManager
=
null
;
...
...
@@ -105,15 +105,20 @@ describe('audioFramework', function () {
})
}
async
function
driveFn
()
{
console
.
info
(
`come in driveFn`
);
let
driver
=
await
UiDriver
.
create
();
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
);
try
{
let
driver
=
await
UiDriver
.
create
()
console
.
info
(
`case come in driveFn 222`
)
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
)
await
sleep
(
100
);
console
.
info
(
`UiDriver start`
);
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'
允许
'
));
console
.
info
(
`button is
${
JSON
.
stringify
(
button
)}
`
);
await
sleep
(
100
);
await
button
.
click
();
}
catch
(
err
)
{
console
.
info
(
'
err is
'
+
err
);
return
;
}
}
beforeAll
(
async
function
()
{
...
...
@@ -3580,15 +3585,15 @@ describe('audioFramework', function () {
});
await
audioManager
.
isDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
).
then
(
function
(
value
)
{
if
(
flag
==
true
&&
value
==
false
)
{
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
expect
(
true
).
assertTrue
();
}
else
if
(
flag
==
false
&&
value
==
true
)
{
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : fail :
${
value
}
flag is
${
flag
}
`
);
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : fail :
${
value
}
flag is
${
flag
}
`
);
expect
(
false
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
...
...
@@ -3637,7 +3642,7 @@ describe('audioFramework', function () {
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300
'
,
2
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300
'
,
2
,
async
function
(
done
)
{
let
flag
=
true
let
outputDeviceDescription
=
await
audioManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
);
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300 outputDeviceDescription is
${
JSON
.
stringify
(
outputDeviceDescription
)}
`
);
...
...
@@ -3656,14 +3661,14 @@ describe('audioFramework', function () {
console
.
error
(
`
${
TagFrmwk
}
: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
false
&&
flag
==
true
)
{
console
.
info
(
`
${
TagFrmwk
}
: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
console
.
info
(
`
${
TagFrmwk
}
: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
expect
(
true
).
assertTrue
();
}
else
if
(
value
==
true
&&
flag
==
false
)
{
console
.
info
(
`
${
TagFrmwk
}
: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
console
.
info
(
`
${
TagFrmwk
}
: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :
${
value
}
flag is
${
flag
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300
${
TagFrmwk
}
: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :
${
value
}
flag is
${
flag
}
`
);
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300
${
TagFrmwk
}
: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :
${
value
}
flag is
${
flag
}
`
);
expect
(
false
).
assertTrue
();
}
done
();
...
...
@@ -4675,7 +4680,7 @@ describe('audioFramework', function () {
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0100
'
,
2
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0100
'
,
2
,
async
function
(
done
)
{
let
AudioRoutingManager
=
audioManager
.
getRoutingManager
();
AudioRoutingManager
.
getDevices
(
1
,
(
err
,
value
)
=>
{
// Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG
...
...
@@ -4709,7 +4714,7 @@ describe('audioFramework', function () {
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0200
'
,
2
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0200
'
,
2
,
async
function
(
done
)
{
let
AudioRoutingManager
=
audioManager
.
getRoutingManager
();
AudioRoutingManager
.
getDevices
(
2
,
(
err
,
value
)
=>
{
// Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG
...
...
@@ -4914,5 +4919,5 @@ describe('audioFramework', function () {
await
sleep
(
50
);
done
();
})
})
})
}
multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js
浏览文件 @
c76403dd
...
...
@@ -40,15 +40,20 @@ describe('audioVoip', function () {
})
}
async
function
driveFn
()
{
console
.
info
(
`come in driveFn`
);
let
driver
=
await
UiDriver
.
create
();
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
);
try
{
let
driver
=
await
UiDriver
.
create
()
console
.
info
(
`case come in driveFn 222`
)
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
)
await
sleep
(
100
);
console
.
info
(
`UiDriver start`
);
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'
允许
'
));
console
.
info
(
`button is
${
JSON
.
stringify
(
button
)}
`
);
await
sleep
(
100
);
await
button
.
click
();
}
catch
(
err
)
{
console
.
info
(
'
err is
'
+
err
);
return
;
}
}
beforeAll
(
async
function
()
{
...
...
multimedia/media/media_js_standard/MediaTestBase.js
浏览文件 @
c76403dd
...
...
@@ -14,7 +14,7 @@
*/
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
{
expect
}
from
'
deccjsunit/index
'
import
{
expect
}
from
'
deccjsunit/index
'
import
router
from
'
@system.router
'
import
mediaLibrary
from
'
@ohos.multimedia.mediaLibrary
'
import
fileio
from
'
@ohos.fileio
'
...
...
@@ -31,6 +31,7 @@ export async function getPermission(permissionNames) {
export
async
function
driveFn
(
num
)
{
console
.
info
(
`case come in driveFn 111`
)
try
{
let
driver
=
await
UiDriver
.
create
()
console
.
info
(
`case come in driveFn 222`
)
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
)
...
...
@@ -43,6 +44,10 @@ export async function driveFn(num) {
await
button
.
click
()
}
await
msleepAsync
(
2000
)
}
catch
(
err
)
{
console
.
info
(
'
err is
'
+
err
);
return
;
}
}
// File operation
...
...
@@ -50,7 +55,7 @@ export async function getFileDescriptor(fileName) {
let
fileDescriptor
=
undefined
;
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
console
.
log
(
'
case getRawFileDescriptor success fileName:
'
+
fileName
);
}).
catch
(
error
=>
{
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
...
...
@@ -61,7 +66,7 @@ export async function getFileDescriptor(fileName) {
export
async
function
closeFileDescriptor
(
fileName
)
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(()
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(()
=>
{
console
.
log
(
'
case closeRawFileDescriptor
'
+
fileName
);
}).
catch
(
error
=>
{
console
.
log
(
'
case closeRawFileDescriptor err:
'
+
error
);
...
...
@@ -98,7 +103,7 @@ export async function closeFdNumber(fdNumber) {
// wait synchronously
export
function
msleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
// wait asynchronously
...
...
@@ -127,19 +132,19 @@ export function catchCallback(error) {
export
function
checkDescription
(
actualDescription
,
descriptionKey
,
descriptionValue
)
{
for
(
let
i
=
0
;
i
<
descriptionKey
.
length
;
i
++
)
{
let
property
=
actualDescription
[
descriptionKey
[
i
]];
console
.
info
(
'
case key is
'
+
descriptionKey
[
i
]);
console
.
info
(
'
case actual value is
'
+
property
);
console
.
info
(
'
case hope value is
'
+
descriptionValue
[
i
]);
console
.
info
(
'
case key is
'
+
descriptionKey
[
i
]);
console
.
info
(
'
case actual value is
'
+
property
);
console
.
info
(
'
case hope value is
'
+
descriptionValue
[
i
]);
expect
(
property
).
assertEqual
(
descriptionValue
[
i
]);
}
}
export
function
printDescription
(
obj
)
{
let
description
=
""
;
for
(
let
i
in
obj
)
{
for
(
let
i
in
obj
)
{
let
property
=
obj
[
i
];
console
.
info
(
'
case key is
'
+
i
);
console
.
info
(
'
case value is
'
+
property
);
console
.
info
(
'
case key is
'
+
i
);
console
.
info
(
'
case value is
'
+
property
);
description
+=
i
+
"
=
"
+
property
+
"
\n
"
;
}
}
...
...
@@ -167,8 +172,8 @@ export async function clearRouter() {
export
async
function
getFd
(
pathName
)
{
let
fdObject
=
{
fileAsset
:
null
,
fdNumber
:
null
fileAsset
:
null
,
fdNumber
:
null
}
let
displayName
=
pathName
;
const
mediaTest
=
mediaLibrary
.
getMediaLibrary
();
...
...
@@ -179,8 +184,8 @@ export async function getFd(pathName) {
if
(
dataUri
!=
undefined
)
{
let
args
=
dataUri
.
id
.
toString
();
let
fetchOp
=
{
selections
:
fileKeyObj
.
ID
+
"
=?
"
,
selectionArgs
:
[
args
],
selections
:
fileKeyObj
.
ID
+
"
=?
"
,
selectionArgs
:
[
args
],
}
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
fdObject
.
fileAsset
=
await
fetchFileResult
.
getAllObject
();
...
...
@@ -192,8 +197,8 @@ export async function getFd(pathName) {
export
async
function
getAudioFd
(
pathName
)
{
let
fdObject
=
{
fileAsset
:
null
,
fdNumber
:
null
fileAsset
:
null
,
fdNumber
:
null
}
let
displayName
=
pathName
;
const
mediaTest
=
mediaLibrary
.
getMediaLibrary
();
...
...
@@ -204,8 +209,8 @@ export async function getAudioFd(pathName) {
if
(
dataUri
!=
undefined
)
{
let
args
=
dataUri
.
id
.
toString
();
let
fetchOp
=
{
selections
:
fileKeyObj
.
ID
+
"
=?
"
,
selectionArgs
:
[
args
],
selections
:
fileKeyObj
.
ID
+
"
=?
"
,
selectionArgs
:
[
args
],
}
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
fdObject
.
fileAsset
=
await
fetchFileResult
.
getAllObject
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录