Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
d6ce9017
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看板
未验证
提交
d6ce9017
编写于
8月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9630 add avsession testcases
Merge pull request !9630 from 秦莉文/master
上级
73240601
a111d2a0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
182 addition
and
99 deletion
+182
-99
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js
...ndard/avsessionManager/src/main/js/test/AVSession.test.js
+112
-77
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionControllerJSTest.js
...sionManager/src/main/js/test/AVSessionControllerJSTest.js
+52
-1
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionEnum.test.js
...d/avsessionManager/src/main/js/test/AVSessionEnum.test.js
+10
-10
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js
...essionManager/src/main/js/test/AVSessionErrorCode.test.js
+1
-1
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManager.test.js
...vsessionManager/src/main/js/test/AVSessionManager.test.js
+7
-10
未找到文件。
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js
浏览文件 @
d6ce9017
...
@@ -29,6 +29,15 @@ export default function AVSession() {
...
@@ -29,6 +29,15 @@ export default function AVSession() {
let
keyItem
=
{
code
:
0x49
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
keyItem
=
{
code
:
0x49
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:
[
keyItem
]
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:
[
keyItem
]
};
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
let
castControlCommandType
=
'
play
'
;
let
deviceInfo
=
{
castCategory
:
0
,
deviceId
:
"
deviceId
"
,
deviceName
:
"
deviceName
"
,
}
let
outputDeviceInfo
=
{
devices
:
[
deviceInfo
],
}
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
@@ -50,6 +59,7 @@ export default function AVSession() {
...
@@ -50,6 +59,7 @@ export default function AVSession() {
console
.
info
(
'
TestLog: Init Session And Controller
'
);
console
.
info
(
'
TestLog: Init Session And Controller
'
);
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
session
=
data
;
session
.
sessionType
=
'
audio
'
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -63,8 +73,8 @@ export default function AVSession() {
...
@@ -63,8 +73,8 @@ export default function AVSession() {
});
});
controller
=
await
session
.
getController
();
controller
=
await
session
.
getController
();
});
});
})
afterEach
(
async
function
(
done
)
{
afterEach
(
async
function
(
done
)
{
console
.
info
(
'
TestLog: Destroy Session And Controller
'
);
console
.
info
(
'
TestLog: Destroy Session And Controller
'
);
...
@@ -667,6 +677,7 @@ export default function AVSession() {
...
@@ -667,6 +677,7 @@ export default function AVSession() {
it
(
'
SUB_MULTIMEDIA_AVSESSION_SETAVPLAYBACKSTATE_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AVSESSION_SETAVPLAYBACKSTATE_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
PlaybackState1
=
{
let
PlaybackState1
=
{
state
:
avSession
.
PlaybackState
.
PLAYBACK_STATE_PLAY
,
state
:
avSession
.
PlaybackState
.
PLAYBACK_STATE_PLAY
,
activeItemId
:
0
,
};
};
await
session
.
setAVPlaybackState
(
PlaybackState1
).
then
(()
=>
{
await
session
.
setAVPlaybackState
(
PlaybackState1
).
then
(()
=>
{
console
.
info
(
'
TestLog: Set State successfully
'
);
console
.
info
(
'
TestLog: Set State successfully
'
);
...
@@ -1447,7 +1458,7 @@ export default function AVSession() {
...
@@ -1447,7 +1458,7 @@ export default function AVSession() {
});
});
await
sleep
(
500
);
await
sleep
(
500
);
try
{
try
{
session
.
deactivate
((
err
)
=>
{
session
.
deactivate
((
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`TestLog: Deactivate session error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`TestLog: Deactivate session error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
...
@@ -1477,7 +1488,7 @@ export default function AVSession() {
...
@@ -1477,7 +1488,7 @@ export default function AVSession() {
done
();
done
();
})
})
/* *
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAY_0100
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAY_0100
...
@@ -1817,75 +1828,75 @@ export default function AVSession() {
...
@@ -1817,75 +1828,75 @@ export default function AVSession() {
})
})
/* *
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100
* @tc.name : OFFPLAY_0100
* @tc.name : OFFPLAY_0100
* @tc.desc : Testing offPlay callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100
'
,
0
,
async
function
(
done
)
{
function
callback1
()
{
console
.
info
(
'
TestLog: Play command registration1 success
'
);
expect
(
false
).
assertTrue
();
}
function
callback2
()
{
console
.
info
(
'
TestLog: Play command registration2 success
'
);
expect
(
false
).
assertTrue
();
}
session
.
on
(
'
play
'
,
callback1
);
session
.
on
(
'
play
'
,
callback2
);
session
.
off
(
'
play
'
);
await
controller
.
sendControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Controller send command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller send command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200
* @tc.name : OFFPLAY_0200
* @tc.desc : Testing offPlay callback
* @tc.desc : Testing offPlay callback
* @tc.size : MediumTest
* @tc.size : MediumTest
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
()
{
function
callback1
()
{
console
.
info
(
'
TestLog: Play command registration1 success
'
);
console
.
info
(
'
TestLog: Play command registration1 success
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
function
callback2
()
{
function
callback2
()
{
console
.
info
(
'
TestLog: Play command registration2 success
'
);
console
.
info
(
'
TestLog: Play command registration2 success
'
);
expect
(
false
).
assertTrue
();
expect
(
true
).
assertTrue
();
}
}
session
.
on
(
'
play
'
,
callback1
);
session
.
on
(
'
play
'
,
callback1
);
session
.
on
(
'
play
'
,
callback2
);
session
.
on
(
'
play
'
,
callback2
);
session
.
off
(
'
play
'
);
session
.
off
(
'
play
'
,
callback1
);
await
controller
.
sendControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
await
controller
.
sendControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Controller send command successfully
'
);
console
.
info
(
'
TestLog: Controller send command successfully
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller send command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`TestLog: Controller send command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
expect
(
false
).
assertTrue
();
});
});
await
sleep
(
500
);
await
sleep
(
500
);
done
();
done
();
})
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200
* @tc.name : OFFPLAY_0200
* @tc.desc : Testing offPlay callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
()
{
console
.
info
(
'
TestLog: Play command registration1 success
'
);
expect
(
false
).
assertTrue
();
}
function
callback2
()
{
console
.
info
(
'
TestLog: Play command registration2 success
'
);
expect
(
true
).
assertTrue
();
}
session
.
on
(
'
play
'
,
callback1
);
session
.
on
(
'
play
'
,
callback2
);
session
.
off
(
'
play
'
,
callback1
);
await
controller
.
sendControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Controller send command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller send command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
/* *
...
@@ -2741,9 +2752,9 @@ export default function AVSession() {
...
@@ -2741,9 +2752,9 @@ export default function AVSession() {
if
(
!
data
.
isRemote
)
{
if
(
!
data
.
isRemote
)
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
avSession
.
OutputDeviceInfo
.
isRemote
);
console
.
info
(
avSession
.
OutputDeviceInfo
.
isRemote
);
console
.
info
(
avSession
.
OutputDeviceInfo
.
audioDeviceId
.
size
);
console
.
info
(
avSession
.
OutputDeviceInfo
.
audioDeviceId
.
size
);
console
.
info
(
avSession
.
OutputDeviceInfo
.
deviceName
.
size
);
console
.
info
(
avSession
.
OutputDeviceInfo
.
deviceName
.
size
);
console
.
info
(
'
getOutputDevice successfully
'
);
console
.
info
(
'
getOutputDevice successfully
'
);
console
.
info
(
'
Get device information failed
'
);
console
.
info
(
'
Get device information failed
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -2779,6 +2790,29 @@ export default function AVSession() {
...
@@ -2779,6 +2790,29 @@ export default function AVSession() {
done
();
done
();
})
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0200
* @tc.name : GETOUTPUTDEVICE_CALLBACK_0100
* @tc.desc : Testing get output device
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
await
session
.
getOutputDevice
().
then
((
data
)
=>
{
if
(
data
.
devices
.
length
>
0
)
{
console
.
info
(
'
SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0200
'
+
JSON
.
stringify
(
data
.
devices
[
0
].
deviceid
))
console
.
info
(
'
SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0200
'
+
JSON
.
stringify
(
data
.
devices
[
0
].
deviceName
))
console
.
info
(
'
SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0200
'
+
JSON
.
stringify
(
data
.
devices
[
0
].
castCategory
))
expect
(
true
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
console
.
info
(
`Get device BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
})
done
();
})
/* *
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETCONTROLLER_PROMISE_0100
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETCONTROLLER_PROMISE_0100
* @tc.name : GETCONTROLLER_PROMISE_0100
* @tc.name : GETCONTROLLER_PROMISE_0100
...
@@ -2829,8 +2863,8 @@ export default function AVSession() {
...
@@ -2829,8 +2863,8 @@ export default function AVSession() {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
keyItem
=
{
code
:
0x49
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
keyItem
=
{
code
:
0x49
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:
[
keyItem
]
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:
[
keyItem
]
};
try
{
try
{
controller
.
sendAVKeyEvent
(
event
,
(
err
,
data
)
=>
{
controller
.
sendAVKeyEvent
(
event
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
...
@@ -2857,8 +2891,8 @@ export default function AVSession() {
...
@@ -2857,8 +2891,8 @@ export default function AVSession() {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
keyItem
=
{
code
:
0x49
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
keyItem
=
{
code
:
0x49
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:
[
keyItem
]
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:
[
keyItem
]
};
await
controller
.
sendAVKeyEvent
(
event
).
then
(()
=>
{
await
controller
.
sendAVKeyEvent
(
event
).
then
(()
=>
{
console
.
info
(
'
sendAVKeyEvent Successfully
'
);
console
.
info
(
'
sendAVKeyEvent Successfully
'
);
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
@@ -2880,7 +2914,7 @@ export default function AVSession() {
...
@@ -2880,7 +2914,7 @@ export default function AVSession() {
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETREALPLAYBACKPOSITIONSYNC_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETREALPLAYBACKPOSITIONSYNC_0100
'
,
0
,
async
function
(
done
)
{
let
realPosition
=
-
1
;
let
realPosition
=
-
1
;
try
{
try
{
realPosition
=
controller
.
getRealPlaybackPositionSync
();
realPosition
=
controller
.
getRealPlaybackPositionSync
();
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
`TestLog: getRealPlaybackPositionSync error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`TestLog: getRealPlaybackPositionSync error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -2939,4 +2973,5 @@ export default function AVSession() {
...
@@ -2939,4 +2973,5 @@ export default function AVSession() {
}
}
done
();
done
();
})
})
}
})
}
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionControllerJSTest.js
浏览文件 @
d6ce9017
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
import
avSession
from
'
@ohos.multimedia.avsession
'
;
import
avSession
from
'
@ohos.multimedia.avsession
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
//import image from '@ohos.multimedia.image';
//import resourceManager from '@ohos.resourceManager';
import
{
afterAll
,
afterEach
,
beforeAll
,
beforeEach
,
describe
,
expect
,
it
}
from
'
@ohos/hypium
'
;
import
{
afterAll
,
afterEach
,
beforeAll
,
beforeEach
,
describe
,
expect
,
it
}
from
'
@ohos/hypium
'
;
...
@@ -53,22 +55,55 @@ export default function AVSessionControllerJsTest() {
...
@@ -53,22 +55,55 @@ export default function AVSessionControllerJsTest() {
mediaId
:
QUEUE_ITEM_KEY_WORD
,
mediaId
:
QUEUE_ITEM_KEY_WORD
,
title
:
QUEUE_ITEM_KEY_WORD
,
title
:
QUEUE_ITEM_KEY_WORD
,
extras
:
EXTRAS
,
extras
:
EXTRAS
,
iconUri
:
"
iconUri
"
,
mediaSize
:
10
,
albumTitle
:
"
albumTitle
"
,
albumCoverUri
:
"
albumCoverUri
"
,
lyricContent
:
"
lyricContent
"
,
lyricUri
:
"
lyricUri
"
,
mediaUri
:
"
mediaUri
"
,
startPosition
:
0
,
creditsPosition
:
0
,
appName
:
"
appName
"
};
const
QUEUE_ITEM_DESCRIPTION_ERROR
=
{
mediaId
:
QUEUE_ITEM_KEY_WORD
,
title
:
QUEUE_ITEM_KEY_WORD
,
extras
:
EXTRAS
,
icon
:
undefined
,
iconUri
:
"
iconUri
"
,
mediaSize
:
10
,
albumTitle
:
"
albumTitle
"
,
albumCoverUri
:
"
albumCoverUri
"
,
lyricContent
:
"
lyricContent
"
,
lyricUri
:
"
lyricUri
"
,
mediaUri
:
"
mediaUri
"
,
startPosition
:
0
,
creditsPosition
:
0
,
appName
:
"
appName
"
};
};
const
QUEUE_ITEM
=
{
const
QUEUE_ITEM
=
{
itemId
:
QUEUE_ITEM_ID
,
itemId
:
QUEUE_ITEM_ID
,
description
:
QUEUE_ITEM_DESCRIPTION
description
:
QUEUE_ITEM_DESCRIPTION
}
}
const
QUEUE_ITEM_ERROR
=
{
itemId
:
QUEUE_ITEM_ID
,
description
:
QUEUE_ITEM_DESCRIPTION_ERROR
}
const
ITEMS_ARRAY
=
[
QUEUE_ITEM
];
const
ITEMS_ARRAY
=
[
QUEUE_ITEM
];
const
ITEMS_ARRAY_ERROR
=
[
QUEUE_ITEM_ERROR
];
const
QUEUE_TITLE
=
"
title
"
;
const
QUEUE_TITLE
=
"
title
"
;
const
SKIP_ITEM_ID
=
200
;
const
SKIP_ITEM_ID
=
200
;
beforeAll
(
async
function
()
{
beforeAll
(
async
function
()
{
session
=
await
avSession
.
createAVSession
(
featureAbility
.
getContext
(),
"
AVSessionDemo
"
,
'
audio
'
).
catch
((
err
)
=>
{
session
=
await
avSession
.
createAVSession
(
featureAbility
.
getContext
(),
"
AVSessionDemo
"
,
'
audio
'
).
catch
((
err
)
=>
{
console
.
error
(
TAG
+
"
Create AVSession error
"
+
JSON
.
stringify
(
err
));
console
.
error
(
TAG
+
"
Create AVSession error
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
session
.
activate
();
session
.
activate
();
controller
=
await
session
.
getController
();
controller
=
await
session
.
getController
();
console
.
info
(
TAG
+
"
Create session and controller finished, beforeAll called
"
);
console
.
info
(
TAG
+
"
Create session and controller finished, beforeAll called
"
);
...
@@ -1214,6 +1249,22 @@ export default function AVSessionControllerJsTest() {
...
@@ -1214,6 +1249,22 @@ export default function AVSessionControllerJsTest() {
done
();
done
();
})
})
/*
* @tc.name:SUB_MULTIMEDIA_SETAVQUEUEITEMS_0300
* @tc.desc:setAVQueueItems - error situation
* @tc.type: FUNC
* @tc.require: I6KTU4
*/
it
(
"
SUB_MULTIMEDIA_SETAVQUEUEITEMS_0300
"
,
0
,
async
function
(
done
)
{
await
session
.
setAVQueueItems
(
ITEMS_ARRAY_ERROR
).
catch
((
err
)
=>
{
console
.
error
(
TAG
+
"
SUB_MULTIMEDIA_SETAVQUEUEITEMS_0300 error
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
401
);
done
();
});
await
sleep
(
2000
);
console
.
info
(
TAG
+
"
SUB_MULTIMEDIA_SETAVQUEUEITEMS_0300 finished
"
);
done
();
})
/*
/*
* @tc.name:SUB_MULTIMEDIA_SETAVQUEUETITLE_0100
* @tc.name:SUB_MULTIMEDIA_SETAVQUEUETITLE_0100
* @tc.desc:setAVQueueTitle - callback
* @tc.desc:setAVQueueTitle - callback
...
...
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionEnum.test.js
浏览文件 @
d6ce9017
...
@@ -66,7 +66,7 @@ export default function AVSessionEnum() {
...
@@ -66,7 +66,7 @@ export default function AVSessionEnum() {
console
.
info
(
`AVCastCategory CATEGORY_LOCAL is
${
avSession
.
AVCastCategory
.
CATEGORY_LOCAL
}
`
);
console
.
info
(
`AVCastCategory CATEGORY_LOCAL is
${
avSession
.
AVCastCategory
.
CATEGORY_LOCAL
}
`
);
expect
(
avSession
.
AVCastCategory
.
CATEGORY_LOCAL
).
assertEqual
(
0
);
expect
(
avSession
.
AVCastCategory
.
CATEGORY_LOCAL
).
assertEqual
(
0
);
console
.
info
(
`AVCastCategory CATEGORY_REMOTE is
${
avSession
.
AVCastCategory
.
CATEGORY_REMOTE
}
`
);
console
.
info
(
`AVCastCategory CATEGORY_REMOTE is
${
avSession
.
AVCastCategory
.
CATEGORY_REMOTE
}
`
);
expect
(
avSession
.
AVCastCategory
.
CATEGORY_REMOTE
).
assertEqual
(
undefined
);
expect
(
avSession
.
AVCastCategory
.
CATEGORY_REMOTE
).
assertEqual
(
1
);
done
();
done
();
})
})
...
@@ -83,8 +83,8 @@ export default function AVSessionEnum() {
...
@@ -83,8 +83,8 @@ export default function AVSessionEnum() {
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_LOCAL
).
assertEqual
(
0
);
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_LOCAL
).
assertEqual
(
0
);
console
.
info
(
`DeviceType DEVICE_TYPE_TV is
${
avSession
.
DeviceType
.
DEVICE_TYPE_TV
}
`
);
console
.
info
(
`DeviceType DEVICE_TYPE_TV is
${
avSession
.
DeviceType
.
DEVICE_TYPE_TV
}
`
);
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_TV
).
assertEqual
(
2
);
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_TV
).
assertEqual
(
2
);
console
.
info
(
`DeviceType DEVICE_TYPE_SPEAKER is
${
avSession
.
DeviceType
.
DEVICE_TYPE_SPEAKER
}
`
);
console
.
info
(
`DeviceType DEVICE_TYPE_SPEAKER is
${
avSession
.
DeviceType
.
DEVICE_TYPE_S
MART_S
PEAKER
}
`
);
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_SPEAKER
).
assertEqual
(
3
);
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_S
MART_S
PEAKER
).
assertEqual
(
3
);
console
.
info
(
`DeviceType DEVICE_TYPE_BLUETOOTH is
${
avSession
.
DeviceType
.
DEVICE_TYPE_BLUETOOTH
}
`
);
console
.
info
(
`DeviceType DEVICE_TYPE_BLUETOOTH is
${
avSession
.
DeviceType
.
DEVICE_TYPE_BLUETOOTH
}
`
);
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_BLUETOOTH
).
assertEqual
(
10
);
expect
(
avSession
.
DeviceType
.
DEVICE_TYPE_BLUETOOTH
).
assertEqual
(
10
);
done
();
done
();
...
@@ -116,12 +116,12 @@ export default function AVSessionEnum() {
...
@@ -116,12 +116,12 @@ export default function AVSessionEnum() {
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level2
* @tc.level : Level2
*/
*/
//
it('SUB_MULTIMEDIA_AVSESSION_ERROR_CODE_ENUM_0100', 0, async function (done) {
it
(
'
SUB_MULTIMEDIA_AVSESSION_ERROR_CODE_ENUM_0100
'
,
0
,
async
function
(
done
)
{
//
console.info(`AVSessionErrorCode ERR_CODE_DEVICE_CONNECTION_FAILED is ${avSession.AVSessionErrorCode.ERR_CODE_DEVICE_CONNECTION_FAILED}`);
console
.
info
(
`AVSessionErrorCode ERR_CODE_DEVICE_CONNECTION_FAILED is
${
avSession
.
AVSessionErrorCode
.
ERR_CODE_DEVICE_CONNECTION_FAILED
}
`
);
// expect(avSession.AVSessionErrorCode.ERR_CODE_DEVICE_CONNECTION_FAILED).assertEqual(undefined
);
expect
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_DEVICE_CONNECTION_FAILED
).
assertEqual
(
6600108
);
//
console.info(`AVSessionErrorCode ERR_CODE_REMOTE_CONNECTION_NOT_EXIST is ${avSession.AVSessionErrorCode.ERR_CODE_REMOTE_CONNECTION_NOT_EXIST}`);
console
.
info
(
`AVSessionErrorCode ERR_CODE_REMOTE_CONNECTION_NOT_EXIST is
${
avSession
.
AVSessionErrorCode
.
ERR_CODE_REMOTE_CONNECTION_NOT_EXIST
}
`
);
//
expect(avSession.AVSessionErrorCode.ERR_CODE_REMOTE_CONNECTION_NOT_EXIST).assertEqual(6600109);
expect
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_REMOTE_CONNECTION_NOT_EXIST
).
assertEqual
(
6600109
);
//
done();
done
();
//
})
})
})
})
}
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js
浏览文件 @
d6ce9017
...
@@ -39,6 +39,7 @@ export default function AVSessionErrorCode() {
...
@@ -39,6 +39,7 @@ export default function AVSessionErrorCode() {
beforeAll
(
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
TestLog: Start Testing avSession Interfaces
'
);
console
.
info
(
'
TestLog: Start Testing avSession Interfaces
'
);
})
})
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
@@ -175,7 +176,6 @@ export default function AVSessionErrorCode() {
...
@@ -175,7 +176,6 @@ export default function AVSessionErrorCode() {
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_REMOTE_CONNECTION_ERR
);
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_REMOTE_CONNECTION_ERR
);
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
`Testing has failed BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Testing has failed BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
...
...
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManager.test.js
浏览文件 @
d6ce9017
...
@@ -30,12 +30,7 @@ export default function AVSessionManager() {
...
@@ -30,12 +30,7 @@ export default function AVSessionManager() {
beforeAll
(
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
TestLog: Init Session And Controller
'
);
console
.
info
(
'
TestLog: Init Session And Controller
'
);
// avSession.createAVSession(context, tag, type).then((data) => {
// session = data;
// }).catch((err) => {
// console.info(`TestLog: Session create error: code: ${err.code}, message: ${err.message}`);
// expect(false).assertTrue();
// });
})
})
beforeEach
(
function
()
{
beforeEach
(
function
()
{
...
@@ -187,10 +182,12 @@ export default function AVSessionManager() {
...
@@ -187,10 +182,12 @@ export default function AVSessionManager() {
console
.
info
(
`CreateAVSession 111BusinessError: code: `
);
console
.
info
(
`CreateAVSession 111BusinessError: code: `
);
let
aVCastController
;
let
aVCastController
;
console
.
info
(
`CreateAVSession 333BusinessError: code: `
);
console
.
info
(
`CreateAVSession 333BusinessError: code: `
);
aVCastController
=
await
currentAVSession
.
getAVCastController
().
catch
((
err
)
=>
{
aVCastController
=
await
currentAVSession
.
getAVCastController
((
err
,
data
)
=>
{
console
.
error
(
`getAVCastController BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
if
(
err
)
{
expect
(
err
.
code
==
6600101
).
assertTrue
();
console
.
error
(
`getAVCastController BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
done
();
expect
(
err
.
code
==
6600101
).
assertTrue
();
done
();
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`getAVCastController BusinessError: code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`getAVCastController BusinessError: code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录