Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ad02e8b3
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看板
提交
ad02e8b3
编写于
12月 06, 2022
作者:
W
wTong6
提交者:
wTong888
12月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
b6a2c905
from
https://gitee.com/wTong6/xts_acts/pulls/6804
modify avsession acts Signed-off-by:
N
wTong6
<
wangtong94@huawei.com
>
上级
2fa6396c
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
4 addition
and
4440 deletion
+4
-4440
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js
...ndard/avsessionManager/src/main/js/test/AVSession.test.js
+4
-1
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionController.test.js
...ssionManager/src/main/js/test/AVSessionController.test.js
+0
-1738
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionControllerCallback.test.js
...ager/src/main/js/test/AVSessionControllerCallback.test.js
+0
-790
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManager.test.js
...vsessionManager/src/main/js/test/AVSessionManager.test.js
+0
-1167
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManagerCallback.test.js
...Manager/src/main/js/test/AVSessionManagerCallback.test.js
+0
-740
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/List.test.js
...s_standard/avsessionManager/src/main/js/test/List.test.js
+0
-4
未找到文件。
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js
浏览文件 @
ad02e8b3
...
...
@@ -1317,6 +1317,9 @@ export default function AVSession() {
console
.
info
(
'
TestLog: AVSessionTest : Set LaunchAbility failed
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
((
error
)
=>
{
console
.
info
(
`TestLog: compare LaunchAbility error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionController.test.js
已删除
100755 → 0
浏览文件 @
2fa6396c
/*
* 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
avSession
from
'
@ohos.multimedia.avsession
'
;
import
{
afterAll
,
afterEach
,
beforeAll
,
beforeEach
,
describe
,
expect
,
it
}
from
'
@ohos/hypium
'
;
import
WantAgent
from
'
@ohos.wantAgent
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
export
default
function
Controller
()
{
describe
(
'
Controller
'
,
function
()
{
let
tag
=
'
ApplicationA
'
;
let
type
=
'
audio
'
;
let
session
;
let
controller
;
let
keyItem
=
{
code
:
10
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
let
PlaybackState
=
{
state
:
avSession
.
PlaybackState
.
PLAYBACK_STATE_PLAY
,
speed
:
2.0
,
position
:{
elapsedTime
:
10
,
updateTime
:(
new
Date
()).
getTime
()},
bufferedTime
:
1000
,
loopMode
:
avSession
.
LoopMode
.
LOOP_MODE_SINGLE
,
isFavorite
:
true
,
};
let
metadata
=
{
assetId
:
'
121278
'
,
title
:
'
lose yourself
'
,
artist
:
'
Eminem
'
,
author
:
'
ST
'
,
album
:
'
Slim shady
'
,
writer
:
'
ST
'
,
composer
:
'
ST
'
,
duration
:
2222
,
mediaImage
:
'
https://img2.baidu.com/it/u=3583435814,2833583486&fm=253&fmt=auto&app=138&f=JPEG?w=526&h=500
'
,
subtitle
:
'
8 Mile
'
,
description
:
'
Rap
'
,
lyric
:
'
https://lyric.tingmall.com/lyric/58/970/58970104-LRC-LRC.lrc?t=1649918948000
'
,
previousAssetId
:
'
121277
'
,
nextAssetId
:
'
121279
'
,
};
let
context
=
featureAbility
.
getContext
();
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
beforeAll
(
function
()
{
console
.
info
(
'
TestLog: Start Testing avSessionController Interfaces
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
TestLog: Init the avSession And Controller
'
);
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
avSession
.
createController
(
session
.
sessionId
).
then
((
data
)
=>
{
controller
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
})
afterEach
(
async
function
(
done
)
{
console
.
info
(
'
TestLog: Destroy the Session And Controller
'
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Controller Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
afterAll
(
function
()
{
console
.
info
(
'
TestLog: End Testing avSessionController Interfaces
'
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETSESSIONID_0100
* @tc.name : GETSESSIONID_0100
* @tc.desc : Testing get sessionId
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETSESSIONID_0100
'
,
0
,
async
function
(
done
)
{
if
(
controller
.
sessionId
.
length
===
64
)
{
console
.
info
(
'
TestLog: Get sessionId successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get sessionId failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETAVPLAYBACKSTATE_PROMISE_0100
* @tc.name : GETAVPLAYBACKSTATE_0100
* @tc.desc : Testing get playbackstate - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETAVPLAYBACKSTATE_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
session
.
setAVPlaybackState
(
PlaybackState
).
then
(()
=>
{
console
.
info
(
'
TestLog: Set playbackState successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Set playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
controller
.
getAVPlaybackState
().
then
((
data
)
=>
{
if
(
data
.
state
===
2
&&
data
.
speed
===
2.0
&&
data
.
isFavorite
===
true
&&
data
.
bufferedTime
===
1000
&&
data
.
loopMode
===
1
)
{
console
.
info
(
'
TestLog: Get playbackState successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get playbackState failed
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Get playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETAVMETADATA_PROMISE_0100
* @tc.name : GETAVMETADATA_0100
* @tc.desc : Testing get metadata -promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETAVMETADATA_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
session
.
setAVMetadata
(
metadata
).
then
(()
=>
{
console
.
info
(
'
TestLog: Set metadata successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Set metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
controller
.
getAVMetadata
().
then
((
data
)
=>
{
if
(
data
.
assetId
===
'
121278
'
&&
data
.
title
===
'
lose yourself
'
&&
data
.
artist
===
'
Eminem
'
&&
data
.
author
===
'
ST
'
&&
data
.
album
===
'
Slim shady
'
&&
data
.
writer
===
'
ST
'
&&
data
.
composer
===
'
ST
'
&&
data
.
duration
===
2222
&&
data
.
mediaImage
===
'
https://img2.baidu.com/it/u=3583435814,2833583486&fm=253&fmt=auto&app=138&f=JPEG?w=526&h=500
'
&&
data
.
subtitle
===
'
8 Mile
'
&&
data
.
description
===
'
Rap
'
&&
data
.
lyric
===
'
https://lyric.tingmall.com/lyric/58/970/58970104-LRC-LRC.lrc?t=1649918948000
'
)
{
console
.
info
(
'
TestLog: Get metadata successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get metadata failed
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Get Metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CONTROLLERSENDEVENT_PROMISE_0100
* @tc.name : CONTROLLERSENDEVENT_0100
* @tc.desc : Testing send AVKeyEvent - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CONTROLLERSENDEVENT_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
handleKeyEvent
'
,
(
callback
)
=>
{
if
(
callback
.
action
===
2
)
{
console
.
info
(
'
TestLog: Get AVKeyEvent successfully
'
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: Get AVKeyEvent error
'
);
}
});
await
controller
.
sendAVKeyEvent
(
event
).
then
(()
=>
{
console
.
info
(
'
TestLog: Send AVKeyEvent
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send AVKeyEvent error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Controller send AVKeyEvent successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Controller send AVKeyEvent failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETLAUNCHABILITY_PROMISE_0100
* @tc.name : GETLAUNCHABILITY_0100
* @tc.desc : Testing get LaunchAbility - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETLAUNCHABILITY_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
com.example.myapplication.MainAbility
'
}
],
operationType
:
WantAgent
.
OperationType
.
START_ABILITIES
,
requestCode
:
0
,
wantAgentFlags
:
[
WantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
]
};
let
agent
;
await
WantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
callback
)
=>
{
agent
=
callback
;
});
await
session
.
setLaunchAbility
(
agent
).
then
(()
=>
{
console
.
info
(
'
TestLog: Set LaunchAbility
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Set LaunchAbility error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
let
wantagent
;
await
controller
.
getLaunchAbility
().
then
((
data
)
=>
{
wantagent
=
data
;
console
.
info
(
'
TestLog: Get launchAbility
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Get LaunchAbility error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
WantAgent
.
equal
(
agent
,
wantagent
).
then
((
bool
)
=>
{
if
(
bool
)
{
console
.
info
(
'
TestLog: Get LaunchAbility successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get LaunchAbility failed
'
);
expect
(
false
).
assertTrue
();
}
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETREALPLAYBACKPOSITIONSYNC_0100
* @tc.name : GETREALPLAYBACKPOSITIONSYNC_0100
* @tc.desc : Testing get position
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETREALPLAYBACKPOSITIONSYNC_0100
'
,
0
,
async
function
(
done
)
{
controller
.
on
(
'
playbackStateChange
'
,
'
all
'
,
(
callback
)
=>
{
console
.
info
(
`TestLog: Current elapsedTime is :
${
callback
.
position
.
elapsedTime
}
`
);
console
.
info
(
`TestLog: Current updateTime is :
${
callback
.
position
.
updateTime
}
`
);
});
let
changeState
=
{
position
:{
elapsedTime
:
20
,
updateTime
:(
new
Date
()).
getTime
()},
};
await
session
.
setAVPlaybackState
(
changeState
).
then
(()
=>
{
console
.
info
(
'
TestLog: Set playbackState successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Set playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
1000
);
let
position
=
controller
.
getRealPlaybackPositionSync
();
if
(
position
>
20
)
{
console
.
info
(
`TestLog: Get realPosition successfully and position is:
${
position
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get realPosition failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_PROMISE_0100
* @tc.name : CONTROLLERISACTIVE_0100
* @tc.desc : Testing session active -promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
controller
.
isActive
().
then
((
data
)
=>
{
if
(
data
)
{
console
.
info
(
'
TestLog: session is active
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: session is directive
'
);
expect
(
false
).
assertTrue
();
}
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_PROMISE_0200
* @tc.name : CONTROLLERISACTIVE_0200
* @tc.desc : Testing session active - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
await
session
.
deactivate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Set session deactivate successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Set deactivate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
await
sleep
(
500
);
await
controller
.
isActive
().
then
((
data
)
=>
{
if
(
data
)
{
console
.
info
(
'
TestLog: session is active
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: session is directive
'
);
expect
(
true
).
assertTrue
();
}
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_DESTROYCONTROLLER_PROMISE_0100
* @tc.name : DESTROYCONTROLLER_0100
* @tc.desc : Testing destroy the controller - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_DESTROYCONTROLLER_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Controller destroy successfully
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETVALIDCOMMAND_PROMISE_0100
* @tc.name : GETVALIDCOMMAND_0100
* @tc.desc : Testing get valid command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETVALIDCOMMAND_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
});
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
TestLog: Pause command callback registration successful
'
);
});
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
TestLog: Stop command callback registration successful
'
);
});
await
controller
.
getValidCommands
().
then
((
data
)
=>
{
if
(
data
.
length
===
3
&&
data
[
0
]
===
'
play
'
)
{
console
.
info
(
'
TestLog: Get valid command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get valid command failed
'
);
console
.
info
(
`TestLog: Valid command size is:
${
data
.
length
}
`
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
data
[
i
]);
}
expect
(
false
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Get valid command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0100
* @tc.name : SENDCONTROLCOMMAND_0100
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Get play command successfully
'
);
flag
=
true
;
});
await
controller
.
sendControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send play command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send play command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send play command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send play command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0200
* @tc.name : SENDCONTROLCOMMAND_0200
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
TestLog: Get pause command successfully
'
);
flag
=
true
;
});
await
controller
.
sendControlCommand
({
command
:
'
pause
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send pause command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send pause command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send pause command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send pause command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0300
* @tc.name : SENDCONTROLCOMMAND_0300
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
TestLog: Get stop command successfully
'
);
flag
=
true
;
});
await
controller
.
sendControlCommand
({
command
:
'
stop
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send stop command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send stop command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send stop command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send stop command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0400
* @tc.name : SENDCONTROLCOMMAND_0400
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0400
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
TestLog: Get playNext command successfully
'
);
flag
=
true
;
});
await
controller
.
sendControlCommand
({
command
:
'
playNext
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send playNext command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send playNext command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send playNext command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send playNext command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0500
* @tc.name : SENDCONTROLCOMMAND_0500
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0500
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
TestLog: Get playPrevious command successfully
'
);
flag
=
true
;
});
await
controller
.
sendControlCommand
({
command
:
'
playPrevious
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send playPrevious command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send playPrevious command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send playPrevious command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send playPrevious command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0600
* @tc.name : SENDCONTROLCOMMAND_0600
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0600
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
fastForward
'
,
()
=>
{
console
.
info
(
'
TestLog: Get fastForward command successfully
'
);
flag
=
true
;
});
await
controller
.
sendControlCommand
({
command
:
'
fastForward
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send fastForward command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send fastForward command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send fastForward command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send fastForward command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0700
* @tc.name : SENDCONTROLCOMMAND_0700
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0700
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
rewind
'
,
()
=>
{
console
.
info
(
'
TestLog: Get rewind command successfully
'
);
flag
=
true
;
});
await
controller
.
sendControlCommand
({
command
:
'
rewind
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send rewind command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send rewind command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send rewind command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send rewind command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0800
* @tc.name : SENDCONTROLCOMMAND_0800
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0800
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
seek
'
,
(
callback
)
=>
{
if
(
callback
===
10
)
{
console
.
info
(
'
TestLog: Get seek command successfully
'
);
flag
=
true
;
}
});
await
controller
.
sendControlCommand
({
command
:
'
seek
'
,
parameter
:
10
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send seek command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send seek command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send seek command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send seek command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0900
* @tc.name : SENDCONTROLCOMMAND_0900
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_0900
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
setSpeed
'
,
(
callback
)
=>
{
if
(
callback
===
2.6
)
{
console
.
info
(
'
TestLog: Get setSpeed command successfully
'
);
flag
=
true
;
}
});
await
controller
.
sendControlCommand
({
command
:
'
setSpeed
'
,
parameter
:
2.6
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send setSpeed command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send setSpeed command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send setSpeed command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send setSpeed command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_1000
* @tc.name : SENDCONTROLCOMMAND_1000
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_1000
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
setLoopMode
'
,
(
callback
)
=>
{
if
(
callback
===
1
)
{
console
.
info
(
'
TestLog: Get setLoopMode command successfully
'
);
flag
=
true
;
}
});
await
controller
.
sendControlCommand
({
command
:
'
setLoopMode
'
,
parameter
:
avSession
.
LoopMode
.
LOOP_MODE_SINGLE
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send setLoopMode command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send setLoopMode command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send setLoopMode command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send setLoopMode command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_1100
* @tc.name : SENDCONTROLCOMMAND_1100
* @tc.desc : Testing send control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_PROMISE_1100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
toggleFavorite
'
,
(
callback
)
=>
{
if
(
callback
===
'
false
'
)
{
console
.
info
(
'
TestLog: Get toggleFavorite command successfully
'
);
flag
=
true
;
}
});
await
controller
.
sendControlCommand
({
command
:
'
toggleFavorite
'
,
parameter
:
'
false
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send toggleFavorite command
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send toggleFavorite command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send toggleFavorite command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send toggleFavorite command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONWRONGCALLBACK_0100
* @tc.name : ONWRONGCALLBACK_0100
* @tc.desc : Testing wrong callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONWRONGCALLBACK_0100
'
,
0
,
function
(
done
)
{
try
{
controller
.
on
(
'
wrongCall
'
,
()
=>
{
console
.
info
(
'
TestLog: Wrong callback registration successful
'
);
});
}
catch
(
err
)
{
console
.
info
(
`TestLog: Wrong callback registration error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
done
();
}
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONMETADATACHANGE_0100
* @tc.name : ONMETADATACHANGE_0100
* @tc.desc : Testing metadata change callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONMETADATACHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
filter
=
[
'
title
'
,
'
author
'
,
'
artist
'
];
let
flag
=
false
;
controller
.
on
(
'
metadataChange
'
,
filter
,
(
callback
)
=>
{
if
(
callback
.
title
===
'
love yourself
'
&&
callback
.
artist
===
'
Justin Biber
'
)
{
console
.
info
(
'
TestLog: Metadata filter set successful
'
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: Metadata filter set error
'
);
}
});
let
changedata
=
{
assetId
:
'
9526
'
,
title
:
'
love yourself
'
,
artist
:
'
Justin Biber
'
,
author
:
'
St
'
,
};
await
session
.
setAVMetadata
(
changedata
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change metadata successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Metadata change callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Metadata change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONMETADATACHANGE_0200
* @tc.name : ONMETADATACHANGE_0200
* @tc.desc : Testing metadata change callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONMETADATACHANGE_0200
'
,
0
,
async
function
(
done
)
{
let
filter
=
[
'
title
'
,
'
author
'
,
'
artist
'
];
let
flag
=
true
;
controller
.
on
(
'
metadataChange
'
,
filter
,
(
callback
)
=>
{
if
(
callback
.
album
===
'
HhHhHHH
'
&&
callback
.
writer
===
'
ST
'
)
{
console
.
info
(
'
TestLog: Metadata filter set failed
'
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: Metadata filter set error
'
);
flag
=
false
;
}
});
let
changedata
=
{
assetId
:
'
9527
'
,
album
:
'
HhHhHHH
'
,
writer
:
'
ST
'
,
composer
:
'
ST
'
,
duration
:
2222
,
mediaImage
:
'
aaa
'
,
};
await
session
.
setAVMetadata
(
changedata
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change metadata successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Metadata change callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Metadata change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONMETADATACHANGE_0300
* @tc.name : ONMETADATACHANGE_0300
* @tc.desc : Testing metadata change callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONMETADATACHANGE_0300
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
controller
.
on
(
'
metadataChange
'
,
'
all
'
,
(
callback
)
=>
{
if
(
callback
.
album
===
'
HhHhHHH
'
&&
callback
.
writer
===
'
ST
'
)
{
console
.
info
(
'
TestLog: Metadata filter set successful
'
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: Metadata filter set error
'
);
}
});
let
changedata
=
{
assetId
:
'
9527
'
,
title
:
'
love yourself
'
,
artist
:
'
Justin Biber
'
,
author
:
'
St
'
,
album
:
'
HhHhHHH
'
,
writer
:
'
ST
'
,
composer
:
'
ST
'
,
duration
:
2222
,
mediaImage
:
'
aaa
'
,
};
await
session
.
setAVMetadata
(
changedata
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change metadata successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Metadata change callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Metadata change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAYBACKSTATECHANGE_0100
* @tc.name : ONPLAYBACKSTATECHANGE_0100
* @tc.desc : Testing playbackState change callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONPLAYBACKSTATECHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
controller
.
on
(
'
playbackStateChange
'
,
'
all
'
,
(
callback
)
=>
{
if
(
callback
.
isFavorite
===
false
&&
callback
.
speed
===
3.0
)
{
console
.
info
(
'
TestLog: PlaybackState filter set successful
'
);
console
.
info
(
`TestLog: Current speed is :
${
callback
.
speed
}
`
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: PlaybackState filter set error
'
);
}
});
let
changestate
=
{
speed
:
3.0
,
isFavorite
:
false
,};
await
session
.
setAVPlaybackState
(
changestate
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change playbackState successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: PlaybackState change callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: PlaybackState change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAYBACKSTATECHANGE_0200
* @tc.name : ONPLAYBACKSTATECHANGE_0200
* @tc.desc : Testing playbackState change callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONPLAYBACKSTATECHANGE_0200
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
let
filter
=
[
'
speed
'
,
'
isFavorite
'
];
controller
.
on
(
'
playbackStateChange
'
,
filter
,
(
callback
)
=>
{
if
(
callback
.
isFavorite
===
false
&&
callback
.
speed
===
3.0
)
{
console
.
info
(
'
TestLog: PlaybackState filter set successful
'
);
console
.
info
(
`TestLog: Current speed is :
${
callback
.
speed
}
`
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: PlaybackState filter set error
'
);
}
});
let
changestate
=
{
speed
:
3.0
,
isFavorite
:
false
,};
await
session
.
setAVPlaybackState
(
changestate
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change playbackState successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: PlaybackState changed callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: PlaybackState changed callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAYBACKSTATECHANGE_0300
* @tc.name : ONPLAYBACKSTATECHANGE_0300
* @tc.desc : Testing playbackState change callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONPLAYBACKSTATECHANGE_0300
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
let
filter
=
[
'
speed
'
,
'
isFavorite
'
];
controller
.
on
(
'
playbackStateChange
'
,
filter
,
(
callback
)
=>
{
if
(
callback
.
bufferedTime
===
1000
)
{
console
.
info
(
'
TestLog: PlaybackState filter set failed
'
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: PlaybackState filter set error
'
);
flag
=
false
;
}
});
let
changestate
=
{
bufferedTime
:
1000
,
loopMode
:
avSession
.
LoopMode
.
LOOP_MODE_SINGLE
,};
await
session
.
setAVPlaybackState
(
changestate
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change playbackState successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: PlaybackState change callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: PlaybackState change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONSESSIONDESTROY_0100
* @tc.name : ONSESSIONDESTROY_0100
* @tc.desc : Testing session destroy Callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONSESSIONDESTROY_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
controller
.
on
(
'
sessionDestroy
'
,
()
=>
{
console
.
info
(
'
TestLog: Session destroy successfully
'
);
flag
=
true
;
});
await
session
.
destroy
();
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: onSessionDestroy callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: onSessionDestroy callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONACTIVESTATECHANGE_0100
* @tc.name : ONACTIVESTATECHANGE_0100
* @tc.desc : Testing active State callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONACTIVESTATECHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
controller
.
on
(
'
activeStateChange
'
,
(
callback
)
=>
{
if
(
callback
)
{
console
.
info
(
'
TestLog: Active state change successful
'
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: Active state change error
'
);
}
});
await
session
.
activate
();
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: ActiveStateChange callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: ActiveStateChange callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONVALIDCOMMANDCHANGE_0100
* @tc.name : ONVALIDCOMMANDCHANGE_0100
* @tc.desc : Testing valid command change callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONVALIDCOMMANDCHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
controller
.
on
(
'
validCommandChange
'
,
(
callback
)
=>
{
if
(
callback
.
length
>
0
&&
callback
[
0
]
===
'
play
'
)
{
console
.
info
(
'
TestLog: Valid command change successfully
'
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: Get valid command failed
'
);
console
.
info
(
`TestLog: Valid command size is:
${
callback
.
length
}
`
);
for
(
var
i
=
0
;
i
<
callback
.
length
;
i
++
)
{
console
.
info
(
callback
[
i
]);
}
console
.
info
(
'
TestLog: Valid Command change error
'
);
}
});
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: ValidCommandChange callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: ValidCommandChange callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFMETADATACHANGE_0100
* @tc.name : OFFMETADATACHANGE_0100
* @tc.desc : Testing metadata change callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFMETADATACHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
(
data
)
{
if
(
data
.
title
===
'
love yourself
'
&&
data
.
artist
===
'
Justin Biber
'
)
{
console
.
info
(
'
TestLog: MetadataChange command registration1 success
'
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: Metadata set error
'
);
flag
=
false
;
}
}
function
callback2
(
data
)
{
if
(
data
.
title
===
'
love yourself
'
&&
data
.
artist
===
'
Justin Biber
'
)
{
console
.
info
(
'
TestLog: MetadataChange command registration2 success
'
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: Metadata set error
'
);
flag
=
false
;
}
}
controller
.
on
(
'
metadataChange
'
,
'
all
'
,
callback1
);
controller
.
on
(
'
metadataChange
'
,
'
all
'
,
callback2
);
controller
.
off
(
'
metadataChange
'
);
let
changedata
=
{
assetId
:
'
9527
'
,
title
:
'
love yourself
'
,
artist
:
'
Justin Biber
'
,
author
:
'
St
'
,
album
:
'
HhHhHHH
'
,
writer
:
'
ST
'
,
composer
:
'
ST
'
,
duration
:
2222
,
mediaImage
:
'
aaa
'
,
};
await
session
.
setAVMetadata
(
changedata
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change metadata successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: metadataChanged callback unRegistration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: metadataChanged callback unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFMETADATACHANGE_0200
* @tc.name : OFFMETADATACHANGE_0200
* @tc.desc : Testing metadata change callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFMETADATACHANGE_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
(
data
)
{
if
(
data
.
title
===
'
love yourself
'
&&
data
.
artist
===
'
Justin Biber
'
)
{
console
.
info
(
'
TestLog: MetadataChange command registration1 success
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Metadata set error
'
);
expect
(
false
).
assertTrue
();
}
}
function
callback2
(
data
)
{
if
(
data
.
title
===
'
love yourself
'
&&
data
.
artist
===
'
Justin Biber
'
)
{
console
.
info
(
'
TestLog: MetadataChange command registration2 success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Metadata set error
'
);
expect
(
false
).
assertTrue
();
}
}
controller
.
on
(
'
metadataChange
'
,
'
all
'
,
callback1
);
controller
.
on
(
'
metadataChange
'
,
'
all
'
,
callback2
);
controller
.
off
(
'
metadataChange
'
,
callback1
);
let
changedata
=
{
assetId
:
'
9527
'
,
title
:
'
love yourself
'
,
artist
:
'
Justin Biber
'
,
author
:
'
St
'
,
album
:
'
HhHhHHH
'
,
writer
:
'
ST
'
,
composer
:
'
ST
'
,
duration
:
2222
,
mediaImage
:
'
aaa
'
,
};
await
session
.
setAVMetadata
(
changedata
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change metadata successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAYBACKSTATECHANGE_0100
* @tc.name : OFFPLAYBACKSTATECHANGE_0100
* @tc.desc : Testing playbackState change callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFPLAYBACKSTATECHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
(
data
)
{
if
(
data
.
isFavorite
===
false
&&
data
.
speed
===
3.0
)
{
console
.
info
(
'
TestLog: PlaybackState set successful
'
);
console
.
info
(
`TestLog: Current speed is :
${
data
.
speed
}
`
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: PlaybackState set error
'
);
flag
=
false
;
}
}
function
callback2
(
data
)
{
if
(
data
.
isFavorite
===
false
&&
data
.
speed
===
3.0
)
{
console
.
info
(
'
TestLog: PlaybackState set successful
'
);
console
.
info
(
`TestLog: Current speed is :
${
data
.
speed
}
`
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: PlaybackState set error
'
);
flag
=
false
;
}
}
controller
.
on
(
'
playbackStateChange
'
,
'
all
'
,
callback1
);
controller
.
on
(
'
playbackStateChange
'
,
'
all
'
,
callback2
);
controller
.
off
(
'
playbackStateChange
'
);
let
changestate
=
{
speed
:
3.0
,
isFavorite
:
false
,};
await
session
.
setAVPlaybackState
(
changestate
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change playbackState successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: playbackStateChanged callback unRegistration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: playbackStateChanged callback unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAYBACKSTATECHANGE_0200
* @tc.name : OFFPLAYBACKSTATECHANGE_0200
* @tc.desc : Testing playbackState change callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFPLAYBACKSTATECHANGE_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
(
data
)
{
if
(
data
.
isFavorite
===
false
&&
data
.
speed
===
3.0
)
{
console
.
info
(
'
TestLog: PlaybackState set successful
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: PlaybackState set error
'
);
expect
(
false
).
assertTrue
();
}
}
function
callback2
(
data
)
{
if
(
data
.
isFavorite
===
false
&&
data
.
speed
===
3.0
)
{
console
.
info
(
'
TestLog: PlaybackState set successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: PlaybackState set error
'
);
expect
(
false
).
assertTrue
();
}
}
controller
.
on
(
'
playbackStateChange
'
,
'
all
'
,
callback1
);
controller
.
on
(
'
playbackStateChange
'
,
'
all
'
,
callback2
);
controller
.
off
(
'
playbackStateChange
'
,
callback1
);
let
changestate
=
{
speed
:
3.0
,
isFavorite
:
false
,};
await
session
.
setAVPlaybackState
(
changestate
).
then
(()
=>
{
console
.
info
(
'
TestLog: Change playbackState successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Change playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0100
* @tc.name : OFFSESSIONDESTROY_0100
* @tc.desc : Testing session destroy Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
()
{
console
.
info
(
'
TestLog: SessionDestory command registration1 success
'
);
flag
=
false
;
}
function
callback2
()
{
console
.
info
(
'
TestLog: SessionDestory command registration2 success
'
);
flag
=
false
;
}
controller
.
on
(
'
sessionDestroy
'
,
callback1
);
controller
.
on
(
'
sessionDestroy
'
,
callback2
);
controller
.
off
(
'
sessionDestroy
'
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Destory session successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Destory session error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: SessionDestroy callback unRegistration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: SessionDestroy callback unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0200
* @tc.name : OFFSESSIONDESTROY_0200
* @tc.desc : Testing session destroy Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
()
{
console
.
info
(
'
TestLog: SessionDestory command registration1 success
'
);
expect
(
false
).
assertTrue
;
}
function
callback2
()
{
console
.
info
(
'
TestLog: SessionDestory command registration2 success
'
);
expect
(
true
).
assertTrue
;
}
controller
.
on
(
'
sessionDestroy
'
,
callback1
);
controller
.
on
(
'
sessionDestroy
'
,
callback2
);
controller
.
off
(
'
sessionDestroy
'
,
callback1
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Destory session successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Destory session error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFACTIVESTATECHANGE_0100
* @tc.name : OFFACTIVESTATECHANGE_0100
* @tc.desc : Testing active State callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFACTIVESTATECHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
(
data
)
{
if
(
data
)
{
console
.
info
(
'
TestLog: ActiveStateChange command registration1 success
'
);
flag
=
false
;
}
}
function
callback2
(
data
)
{
if
(
data
)
{
console
.
info
(
'
TestLog: ActiveStateChange command registration2 success
'
);
flag
=
false
;
}
}
controller
.
on
(
'
activeStateChange
'
,
callback1
);
controller
.
on
(
'
activeStateChange
'
,
callback2
);
controller
.
off
(
'
activeStateChange
'
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: activeStateChange command unRegistration success
'
)
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: activeStateChange command unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFACTIVESTATECHANGE_0200
* @tc.name : OFFACTIVESTATECHANGE_0200
* @tc.desc : Testing active State callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFACTIVESTATECHANGE_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
(
data
)
{
if
(
data
)
{
console
.
info
(
'
TestLog: ActiveStateChange command registration1 success
'
);
expect
(
false
).
assertTrue
();
}
}
function
callback2
(
data
)
{
if
(
data
)
{
console
.
info
(
'
TestLog: ActiveStateChange command registration1 success
'
);
expect
(
true
).
assertTrue
();
}
}
controller
.
on
(
'
activeStateChange
'
,
callback1
);
controller
.
on
(
'
activeStateChange
'
,
callback2
);
controller
.
off
(
'
activeStateChange
'
,
callback1
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFVALIDCOMMANDCHANGE_0100
* @tc.name : OFFVALIDCOMMANDCHANGE_0100
* @tc.desc : Testing valid command change callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFVALIDCOMMANDCHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
(
data
)
{
if
(
data
.
length
>
0
&&
data
[
0
]
===
'
play
'
)
{
console
.
info
(
'
TestLog: Valid command change successfully
'
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: Get valid command failed
'
);
flag
=
false
;
}
}
function
callback2
(
data
)
{
if
(
data
.
length
>
0
&&
data
[
0
]
===
'
play
'
)
{
console
.
info
(
'
TestLog: Valid command change successfully
'
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: Get valid command failed
'
);
flag
=
false
;
}
}
controller
.
on
(
'
validCommandChange
'
,
callback1
);
controller
.
on
(
'
validCommandChange
'
,
callback2
);
controller
.
off
(
'
validCommandChange
'
);
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Valid command changed callback unRegistration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Valid command changed callback unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFVALIDCOMMANDCHANGE_0200
* @tc.name : OFFVALIDCOMMANDCHANGE_0200
* @tc.desc : Testing valid command change callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFVALIDCOMMANDCHANGE_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
(
data
)
{
if
(
data
.
length
>
0
&&
data
[
0
]
===
'
play
'
)
{
console
.
info
(
'
TestLog: Valid command change successfully
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get valid command failed
'
);
expect
(
false
).
assertTrue
();
}
}
function
callback2
(
data
)
{
if
(
data
.
length
>
0
&&
data
[
0
]
===
'
play
'
)
{
console
.
info
(
'
TestLog: Valid command change successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get valid command failed
'
);
expect
(
false
).
assertTrue
();
}
}
controller
.
on
(
'
validCommandChange
'
,
callback1
);
controller
.
on
(
'
validCommandChange
'
,
callback2
);
controller
.
off
(
'
validCommandChange
'
,
callback1
);
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0100
* @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_0100
'
,
0
,
async
function
(
done
)
{
controller
.
on
(
'
outputDeviceChange
'
,
(
callback
)
=>
{
if
(
!
callback
.
isRemote
)
{
console
.
info
(
'
outputDeviceChange callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
outputDeviceChange callback registration fail
'
);
expect
(
false
).
assertTrue
();
}
});
controller
.
off
(
'
outputDeviceChange
'
);
controller
.
getOutputDevice
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`Get device information BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
!
value
.
isRemote
)
{
console
.
info
(
'
Get device information successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Get device information failed
'
);
expect
(
false
).
assertTrue
();
}
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_PROMISE_0100
* @tc.name : GETOUTPUTDEVICE_PROMISE_0100
* @tc.desc : Testing get output device
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
controller
.
getOutputDevice
().
then
((
value
)
=>
{
console
.
info
(
'
Get device information successfully
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
info
(
`Get device BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
})
done
();
})
})
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionControllerCallback.test.js
已删除
100644 → 0
浏览文件 @
2fa6396c
/*
* 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
avSession
from
'
@ohos.multimedia.avsession
'
;
import
{
afterAll
,
afterEach
,
beforeAll
,
beforeEach
,
describe
,
expect
,
it
}
from
'
@ohos/hypium
'
;
import
WantAgent
from
'
@ohos.wantAgent
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
export
default
function
ControllerCallback
()
{
describe
(
'
ControllerCallback
'
,
function
()
{
let
tag
=
'
ApplicationA
'
;
let
type
=
'
audio
'
;
let
session
;
let
controller
;
let
keyItem
=
{
code
:
10
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
let
PlaybackState
=
{
state
:
avSession
.
PlaybackState
.
PLAYBACK_STATE_PLAY
,
speed
:
2.0
,
position
:{
elapsedTime
:
10
,
updateTime
:(
new
Date
()).
getTime
()},
bufferedTime
:
1000
,
loopMode
:
avSession
.
LoopMode
.
LOOP_MODE_SINGLE
,
isFavorite
:
true
,
};
let
metadata
=
{
assetId
:
'
121278
'
,
title
:
'
lose yourself
'
,
artist
:
'
Eminem
'
,
author
:
'
ST
'
,
album
:
'
Slim shady
'
,
writer
:
'
ST
'
,
composer
:
'
ST
'
,
duration
:
2222
,
mediaImage
:
'
https://img2.baidu.com/it/u=3583435814,2833583486&fm=253&fmt=auto&app=138&f=JPEG?w=526&h=500
'
,
subtitle
:
'
8 Mile
'
,
description
:
'
Rap
'
,
lyric
:
'
https://lyric.tingmall.com/lyric/58/970/58970104-LRC-LRC.lrc?t=1649918948000
'
,
previousAssetId
:
'
121277
'
,
nextAssetId
:
'
121279
'
,
};
let
context
=
featureAbility
.
getContext
();
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
beforeAll
(
function
()
{
console
.
info
(
'
TestLog: Start Testing AVSessionController Interfaces
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
TestLog: Init the AVSession And Controller
'
);
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activated error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
avSession
.
createController
(
session
.
sessionId
).
then
((
data
)
=>
{
controller
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
})
afterEach
(
async
function
(
done
)
{
console
.
info
(
'
TestLog: Destroy the Session And Controller
'
);
await
session
.
destroy
();
await
controller
.
destroy
();
done
();
})
afterAll
(
function
()
{
console
.
info
(
'
TestLog: End Testing AVSessionController Interfaces
'
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETAVPLAYBACKSTATE_CALLBACK_0100
* @tc.name : GETAVPLAYBACKSTATE_0100
* @tc.desc : Testing get playbackstate - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETAVPLAYBACKSTATE_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
session
.
setAVPlaybackState
(
PlaybackState
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Set playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Set playbackState successfully
'
);
}
});
await
sleep
(
500
);
controller
.
getAVPlaybackState
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Get playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
.
state
===
2
&&
value
.
speed
===
2.0
&&
value
.
isFavorite
===
true
&&
value
.
bufferedTime
===
1000
&&
value
.
loopMode
===
1
)
{
console
.
info
(
'
TestLog: Get playbackState successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get playbackState failed
'
);
expect
(
false
).
assertTrue
();
}
})
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETAVMETADATA_CALLBACK_0100
* @tc.name : GETAVMETADATA_0100
* @tc.desc : Testing get metadata - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETAVMETADATA_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
session
.
setAVMetadata
(
metadata
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Set playbackState error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Set playbackState successfully
'
);
}
});
await
sleep
(
500
);
controller
.
getAVMetadata
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Get Metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
.
assetId
===
'
121278
'
&&
value
.
title
===
'
lose yourself
'
&&
value
.
artist
===
'
Eminem
'
&&
value
.
author
===
'
ST
'
&&
value
.
album
===
'
Slim shady
'
&&
value
.
writer
===
'
ST
'
&&
value
.
composer
===
'
ST
'
&&
value
.
duration
===
2222
&&
value
.
mediaImage
===
'
https://img2.baidu.com/it/u=3583435814,2833583486&fm=253&fmt=auto&app=138&f=JPEG?w=526&h=500
'
&&
value
.
subtitle
===
'
8 Mile
'
&&
value
.
description
===
'
Rap
'
&&
value
.
lyric
===
'
https://lyric.tingmall.com/lyric/58/970/58970104-LRC-LRC.lrc?t=1649918948000
'
)
{
console
.
info
(
'
TestLog: Get metadata successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get metadata failed
'
);
expect
(
false
).
assertTrue
();
}
})
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CONTROLLERSENDEVENT_CALLBACK_0100
* @tc.name : CONTROLLERSENDEVENT_0100
* @tc.desc : Testing send AVKeyEvent - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CONTROLLERSENDEVENT_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
handleKeyEvent
'
,
(
callback
)
=>
{
if
(
callback
.
action
===
2
)
{
console
.
info
(
'
TestLog: Get AVKeyEvent successfully
'
);
flag
=
true
;
}
else
{
console
.
info
(
'
TestLog: Get AVKeyEvent error
'
);
}
});
controller
.
sendAVKeyEvent
(
event
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send AVKeyEvent error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send AVKeyEvent
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Controller send AVKeyEvent successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Controller send AVKeyEvent failed
'
);
expect
(
false
).
assertTrue
();
}
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETLAUNCHABILITY_CALLBACK_0100
* @tc.name : GETLAUNCHABILITY_0100
* @tc.desc : Testing get LaunchAbility - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETLAUNCHABILITY_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
com.example.myapplication.MainAbility
'
}
],
operationType
:
WantAgent
.
OperationType
.
START_ABILITIES
,
requestCode
:
0
,
wantAgentFlags
:
[
WantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
]
};
let
agent
;
await
WantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
callback
)
=>
{
agent
=
callback
;
});
session
.
setLaunchAbility
(
agent
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Set launchAbility error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Set launchAbility successfully
'
);
}
});
await
sleep
(
500
);
let
wantagent
;
controller
.
getLaunchAbility
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get launchAbility
'
);
wantagent
=
value
;
}
});
await
sleep
(
500
);
await
WantAgent
.
equal
(
agent
,
wantagent
).
then
((
bool
)
=>
{
if
(
bool
)
{
console
.
info
(
'
AVSessionTest : Get LaunchAbility successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AVSessionTest : Get LaunchAbility failed
'
);
expect
(
false
).
assertTrue
();
}
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_CALLBACK_0100
* @tc.name : CONTROLLERISACTIVE_0100
* @tc.desc : Testing session active - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
controller
.
isActive
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: isActive error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
)
{
console
.
info
(
'
TestLog: session is active
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: session is directive
'
);
expect
(
false
).
assertTrue
();
}
})
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_CALLBACK_0200
* @tc.name : CONTROLLERISACTIVE_0200
* @tc.desc : Testing session active - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CONTROLLERISACTIVE_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
await
session
.
deactivate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Set session deactivate successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Set deactivate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
controller
.
isActive
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: isActive error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
)
{
console
.
info
(
'
TestLog: session is active
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: session is directive
'
);
expect
(
true
).
assertTrue
();
}
})
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_DESTROYCONTROLLER_CALLBACK_0100
* @tc.name : DESTROYCONTROLLER_0100
* @tc.desc : Testing destroy the controller - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_DESTROYCONTROLLER_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
controller
.
destroy
((
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Controller destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Controller destroy successfully
'
);
expect
(
true
).
assertTrue
();
}
})
await
sleep
(
500
);
avSession
.
createController
(
session
.
sessionId
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Controller created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
controller
=
value
;
}
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETVALIDCOMMAND_CALLBACK_0100
* @tc.name : GETVALIDCOMMAND_0100
* @tc.desc : Testing get valid command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETVALIDCOMMAND_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
});
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
TestLog: Pause command callback registration successful
'
);
});
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
TestLog: Stop command callback registration successful
'
);
});
controller
.
getValidCommands
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Get valid command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
.
length
===
3
&&
value
[
0
]
===
'
play
'
)
{
console
.
info
(
'
TestLog: Get valid command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get valid command failed
'
);
expect
(
false
).
assertTrue
();
}
})
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0100
* @tc.name : SENDCONTROLCOMMAND_0100
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Get play command successfully
'
);
flag
=
true
;
});
controller
.
sendControlCommand
({
command
:
'
play
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send play command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send play command
'
);
}
done
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send play command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send play command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0200
* @tc.name : SENDCONTROLCOMMAND_0200
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
TestLog: Get pause command successfully
'
);
flag
=
true
;
});
controller
.
sendControlCommand
({
command
:
'
pause
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send pause command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send pause command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send pause command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send pause command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0300
* @tc.name : SENDCONTROLCOMMAND_0300
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
TestLog: Get stop command successfully
'
);
flag
=
true
;
});
controller
.
sendControlCommand
({
command
:
'
stop
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send stop command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send stop command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send stop command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send stop command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0400
* @tc.name : SENDCONTROLCOMMAND_0400
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
TestLog: Get playNext command successfully
'
);
flag
=
true
;
});
controller
.
sendControlCommand
({
command
:
'
playNext
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send playNext command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send playNext command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send playNext command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send playNext command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0500
* @tc.name : SENDCONTROLCOMMAND_0500
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
TestLog: Get playPrevious command successfully
'
);
flag
=
true
;
});
controller
.
sendControlCommand
({
command
:
'
playPrevious
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send playPrevious command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send playPrevious command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send playPrevious command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send playPrevious command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0600
* @tc.name : SENDCONTROLCOMMAND_0600
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
fastForward
'
,
()
=>
{
console
.
info
(
'
TestLog: Get fastForward command successfully
'
);
flag
=
true
;
});
controller
.
sendControlCommand
({
command
:
'
fastForward
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send fastForward command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send fastForward command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send fastForward command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send fastForward command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0700
* @tc.name : SENDCONTROLCOMMAND_0700
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
rewind
'
,
()
=>
{
console
.
info
(
'
TestLog: Get rewind command successfully
'
);
flag
=
true
;
});
controller
.
sendControlCommand
({
command
:
'
rewind
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send rewind command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send rewind command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send rewind command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send rewind command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0800
* @tc.name : SENDCONTROLCOMMAND_0800
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
seek
'
,
(
callback
)
=>
{
if
(
callback
===
10
)
{
console
.
info
(
'
TestLog: Get seek command successfully
'
);
flag
=
true
;
}
});
controller
.
sendControlCommand
({
command
:
'
seek
'
,
parameter
:
10
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send seek command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send seek command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send seek command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send seek command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0900
* @tc.name : SENDCONTROLCOMMAND_0900
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
setSpeed
'
,
(
callback
)
=>
{
if
(
callback
===
2.6
)
{
console
.
info
(
'
TestLog: Get setSpeed command successfully
'
);
flag
=
true
;
}
});
controller
.
sendControlCommand
({
command
:
'
setSpeed
'
,
parameter
:
2.6
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send setSpeed command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send setSpeed command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send setSpeed command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send setSpeed command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_1000
* @tc.name : SENDCONTROLCOMMAND_1000
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
setLoopMode
'
,
(
callback
)
=>
{
if
(
callback
===
1
)
{
console
.
info
(
'
TestLog: Get setLoopMode command successfully
'
);
flag
=
true
;
}
});
controller
.
sendControlCommand
({
command
:
'
setLoopMode
'
,
parameter
:
avSession
.
LoopMode
.
LOOP_MODE_SINGLE
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send setLoopMode command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send setLoopMode command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send setLoopMode command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send setLoopMode command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_1100
* @tc.name : SENDCONTROLCOMMAND_1100
* @tc.desc : Testing send control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDCONTROLCOMMAND_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
let
flag
=
false
;
session
.
on
(
'
toggleFavorite
'
,
(
callback
)
=>
{
if
(
callback
===
'
false
'
)
{
console
.
info
(
'
TestLog: Get toggleFavorite command successfully
'
);
flag
=
true
;
}
});
controller
.
sendControlCommand
({
command
:
'
toggleFavorite
'
,
parameter
:
'
false
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send toggleFavorite command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send toggleFavorite command
'
);
}
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Send toggleFavorite command successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send toggleFavorite command failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
})
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManager.test.js
浏览文件 @
ad02e8b3
...
...
@@ -22,15 +22,6 @@ export default function AVSessionManager() {
let
tag
=
'
ApplicationA
'
;
let
type
=
'
audio
'
;
let
session
;
let
controller
;
let
id
=
'
9527
'
;
let
sessionId
;
let
pid
=
100
;
let
uid
=
200
;
let
audioDevices
;
let
sessionToken
;
let
keyItem
=
{
code
:
10
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
let
context
=
featureAbility
.
getContext
();
function
sleep
(
ms
)
{
...
...
@@ -119,1163 +110,5 @@ export default function AVSessionManager() {
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETALLSESSIONDESCRIPTORS_PROMISE_0100
* @tc.name : GETALLSESSIONDESCRIPTORS_0100
* @tc.desc : Testing get sessionDescriptors - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETALLSESSIONDESCRIPTORS_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
'
ApplicationB
'
,
type
).
then
((
data
)
=>
{
session
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
avSession
.
getAllSessionDescriptors
().
then
((
descriptors
)
=>
{
if
(
descriptors
[
0
].
isActive
===
false
&&
descriptors
[
0
].
type
===
'
audio
'
&&
descriptors
[
0
].
sessionTag
===
'
ApplicationB
'
)
{
console
.
info
(
'
TestLog: Get AllSessionDescriptors successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get AllSessionDescriptors failed
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Get AllSessionDescriptors error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_PROMISE_0100
* @tc.name : CREATECONTROLLER_0100
* @tc.desc : Testing creat session controller - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createController
(
id
).
then
((
controller
)
=>
{
if
(
controller
.
sessionId
.
length
===
64
)
{
console
.
info
(
'
TestLog: Controller create successfully
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Controller create failed
'
);
expect
(
true
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_PROMISE_0200
* @tc.name : CREATECONTROLLER_0200
* @tc.desc : Testing creat session controller - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: avSession create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
avSession
.
createController
(
session
.
sessionId
).
then
((
data
)
=>
{
controller
=
data
;
if
(
controller
.
sessionId
===
session
.
sessionId
)
{
console
.
info
(
'
TestLog: Controller create successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Controller create failed
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: controller Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: controller Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONWRONGCALLBACK_0100
* @tc.name : ONWRONGCALLBACK_0100
* @tc.desc : Testing wrong callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONWRONGCALLBACK_0100
'
,
0
,
function
(
done
)
{
try
{
avSession
.
on
(
'
wrongCall
'
,
()
=>
{
console
.
info
(
'
TestLog: Wrong callback registration successful
'
);
expect
(
false
).
assertTrue
();
});
}
catch
(
err
)
{
console
.
info
(
`TestLog: Wrong callback registration error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
done
();
}
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONSESSIONCREATE_0100
* @tc.name : ONSESSIONCREATE_0100
* @tc.desc : Testing session create Callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONSESSIONCREATE_0100
'
,
0
,
async
function
(
done
)
{
let
newSessionId
;
avSession
.
on
(
'
sessionCreate
'
,
(
descriptor
)
=>
{
console
.
info
(
`TestLog: descriptor.sessionId =
${
descriptor
.
sessionId
}
`
);
newSessionId
=
descriptor
.
sessionId
;
});
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
console
.
info
(
'
TestLog: Session create successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
newSessionId
===
session
.
sessionId
)
{
console
.
info
(
'
TestLog: sessionId equels
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: sessionId not equels
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONSESSIONDESTROY_0100
* @tc.name : ONSESSIONDESTROY_0100
* @tc.desc : Testing session destroy Callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONSESSIONDESTROY_0100
'
,
0
,
async
function
(
done
)
{
avSession
.
on
(
'
sessionDestroy
'
,
(
callback
)
=>
{
if
(
callback
.
sessionId
===
session
.
sessionId
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
destroy callback registration successful`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Session destroy callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONTOPSESSIONCHANGE_0100
* @tc.name : ONTOPSESSIONCHANGE_0100
* @tc.desc : Testing top session change Callback registration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONTOPSESSIONCHANGE_0100
'
,
0
,
async
function
(
done
)
{
avSession
.
on
(
'
topSessionChange
'
,
(
callback
)
=>
{
if
(
callback
.
sessionId
.
length
===
64
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
is top session now`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Top session change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
});
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
console
.
info
(
'
TestLog: Session create successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
avSession
.
off
(
'
topSessionChange
'
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFSESSIONCREATE_0100
* @tc.name : OFFSESSIONCREATE_0100
* @tc.desc : Testing session create Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFSESSIONCREATE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
created`
);
flag
=
false
;
}
function
callback2
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
created`
);
flag
=
false
;
}
avSession
.
on
(
'
sessionCreate
'
,
callback1
);
avSession
.
on
(
'
sessionCreate
'
,
callback2
);
avSession
.
off
(
'
sessionCreate
'
);
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
console
.
info
(
'
TestLog: Session create successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Session created callback unRegistration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Session created callback unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0100
* @tc.name : OFFSESSIONDESTROY_0100
* @tc.desc : Testing session destroy Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
destroyed`
);
flag
=
false
;
}
function
callback2
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
destroyed`
);
flag
=
false
;
}
avSession
.
on
(
'
sessionDestroy
'
,
callback1
);
avSession
.
on
(
'
sessionDestroy
'
,
callback2
);
avSession
.
off
(
'
sessionDestroy
'
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session destroy successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Session destroy callback unRegistration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Session destroy callback unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFSESSIONCREATE_0200
* @tc.name : OFFSESSIONCREATE_0200
* @tc.desc : Testing session create Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFSESSIONCREATE_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
created`
);
expect
(
false
).
assertTrue
();
}
function
callback2
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
created`
);
expect
(
true
).
assertTrue
();
}
avSession
.
on
(
'
sessionCreate
'
,
callback1
);
avSession
.
on
(
'
sessionCreate
'
,
callback2
);
avSession
.
off
(
'
sessionCreate
'
,
callback1
);
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
console
.
info
(
'
TestLog: Session create successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
100
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0200
* @tc.name : OFFSESSIONDESTROY_0200
* @tc.desc : Testing session destroy Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFSESSIONDESTROY_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
destroyed`
);
expect
(
false
).
assertTrue
();
}
function
callback2
(
callback
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
destroyed`
);
expect
(
true
).
assertTrue
();
}
avSession
.
on
(
'
sessionDestroy
'
,
callback1
);
avSession
.
on
(
'
sessionDestroy
'
,
callback2
);
avSession
.
off
(
'
sessionDestroy
'
,
callback1
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session destroy successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFTOPSESSIONCHANGE_0100
* @tc.name : OFFTOPSESSIONCHANGE_0100
* @tc.desc : Testing top session change Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFTOPSESSIONCHANGE_0100
'
,
0
,
async
function
(
done
)
{
let
flag
=
true
;
function
callback1
(
callback
)
{
if
(
callback
.
sessionId
.
length
===
64
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
is top session now`
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: Top session change callback registration failed
'
);
flag
=
false
;
}
}
function
callback2
(
callback
)
{
if
(
callback
.
sessionId
.
length
===
64
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
is top session now`
);
flag
=
false
;
}
else
{
console
.
info
(
'
TestLog: Top session change callback registration failed
'
);
flag
=
false
;
}
}
avSession
.
on
(
'
topSessionChange
'
,
callback1
);
avSession
.
on
(
'
topSessionChange
'
,
callback2
);
avSession
.
off
(
'
topSessionChange
'
);
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
console
.
info
(
'
TestLog: Session create successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
if
(
flag
)
{
console
.
info
(
'
TestLog: Top session change callback unRegistration successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Top session change callback unRegistration failed
'
);
expect
(
false
).
assertTrue
();
}
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFTOPSESSIONCHANGE_0200
* @tc.name : OFFTOPSESSIONCHANGE_0200
* @tc.desc : Testing top session change Callback unRegistration
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFTOPSESSIONCHANGE_0200
'
,
0
,
async
function
(
done
)
{
function
callback1
(
callback
)
{
if
(
callback
.
sessionId
.
length
===
64
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
is top session now`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Top session change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
}
function
callback2
(
callback
)
{
if
(
callback
.
sessionId
.
length
===
64
)
{
console
.
info
(
`TestLog: Session:
${
callback
.
sessionId
}
is top session now`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Top session change callback registration failed
'
);
expect
(
false
).
assertTrue
();
}
}
avSession
.
on
(
'
topSessionChange
'
,
callback1
);
avSession
.
on
(
'
topSessionChange
'
,
callback2
);
avSession
.
off
(
'
topSessionChange
'
,
callback1
);
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
console
.
info
(
'
TestLog: Session create successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
avSession
.
off
(
'
topSessionChange
'
,
callback2
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMAVKEYEVENT_PROMISE_0100
* @tc.name : SENDSYSTEMAVKEYEVENT_0100
* @tc.desc : Testing send systemKeyEvent - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMAVKEYEVENT_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
handleKeyEvent
'
,
(
callback
)
=>
{
if
(
callback
.
action
===
2
)
{
console
.
info
(
'
TestLog: Send System keyEvent successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System keyEvent failed
'
);
expect
(
false
).
assertTrue
();
}
});
await
avSession
.
sendSystemAVKeyEvent
(
event
).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System KeyEvent
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System KeyEvent error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0100
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0100
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0200
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0200
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
TestLog: Pause command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
pause
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0300
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0300
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
TestLog: stop command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
stop
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0400
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0400
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0400
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
TestLog: playNext command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
playNext
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0500
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0500
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0500
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
TestLog: playPrevious command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
playPrevious
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0600
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0600
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0600
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
fastForward
'
,
()
=>
{
console
.
info
(
'
TestLog: fastForward command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
fastForward
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0700
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0700
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0700
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
rewind
'
,
()
=>
{
console
.
info
(
'
TestLog: rewind command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
rewind
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0800
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0800
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0800
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
seek
'
,
(
callback
)
=>
{
if
(
callback
===
10
)
{
console
.
info
(
'
TestLog: Get seek command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
seek
'
,
parameter
:
10
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0900
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0900
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_0900
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
setSpeed
'
,
(
callback
)
=>
{
if
(
callback
===
2.6
)
{
console
.
info
(
'
TestLog: Get setSpeed command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
setSpeed
'
,
parameter
:
2.6
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_1000
* @tc.name : SENDSYSTEMCONTROLCOMMAND_1000
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_1000
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
setLoopMode
'
,
(
callback
)
=>
{
if
(
callback
===
1
)
{
console
.
info
(
'
TestLog: Get setLoopMode command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
setLoopMode
'
,
parameter
:
avSession
.
LoopMode
.
LOOP_MODE_SINGLE
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_1100
* @tc.name : SENDSYSTEMCONTROLCOMMAND_1100
* @tc.desc : Testing send system control command - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_PROMISE_1100
'
,
0
,
async
function
(
done
)
{
await
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
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
session
.
on
(
'
toggleFavorite
'
,
(
callback
)
=>
{
if
(
callback
===
'
false
'
)
{
console
.
info
(
'
TestLog: Get toggleFavorite command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
avSession
.
sendSystemControlCommand
({
command
:
'
toggleFavorite
'
,
parameter
:
'
false
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0100
* @tc.name : CAST_AUDIO_PROMISE_0100
* @tc.desc : Testing cast audio
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
await
avSession
.
castAudio
(
sessionToken
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
Cast audio to remote
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0200
* @tc.name : CAST_AUDIO_PROMISE_0200
* @tc.desc : Testing cast audio with all session
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
await
avSession
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
Cast audio to remote
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0100
* @tc.name : CAST_AUDIO_CALLBACK_0100
* @tc.desc : Testing cast audio
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
avSession
.
castAudio
(
sessionToken
,
audioDevices
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Cast audio to remote device
'
);
}
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0200
* @tc.name : CAST_AUDIO_CALLBACK_0200
* @tc.desc : Testing cast audio
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
avSession
.
castAudio
(
'
all
'
,
audioDevices
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Cast audio to remote device
'
);
}
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
})
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManagerCallback.test.js
浏览文件 @
ad02e8b3
...
...
@@ -21,9 +21,6 @@ export default function AVSessionManagerCallback() {
describe
(
'
AVSessionManagerCallback
'
,
function
()
{
let
tag
=
'
ApplicationA
'
;
let
type
=
'
audio
'
;
let
id
=
9527
;
let
keyItem
=
{
code
:
10
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
let
context
=
featureAbility
.
getContext
();
function
sleep
(
ms
)
{
...
...
@@ -122,742 +119,5 @@ export default function AVSessionManagerCallback() {
done
();
});
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETALLSESSIONDESCRIPTORS_CALLBACK_0100
* @tc.name : GETALLSESSIONDESCRIPTORS_0100
* @tc.desc : Testing get sessionDescriptors - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETALLSESSIONDESCRIPTORS_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
'
ApplicationB
'
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session Created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
avSession
.
getAllSessionDescriptors
((
err
,
descriptors
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Get AllSessionDescriptors error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
descriptors
[
0
].
isActive
===
false
&&
descriptors
[
0
].
type
===
'
audio
'
&&
descriptors
[
0
].
sessionTag
===
'
ApplicationB
'
)
{
console
.
info
(
'
TestLog: Get AllSessionDescriptors successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Get AllSessionDescriptors failed
'
);
expect
(
false
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
console
.
info
(
`TestLog: AVSession :
${
session
.
sessionId
}
destroyed successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_CALLBACK_0100
* @tc.name : CREATECONTROLLER_0100
* @tc.desc : Testing creat session controller - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
avSession
.
createController
(
id
,
(
err
,
controller
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Controller created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
if
(
controller
.
sessionId
===
id
)
{
console
.
info
(
'
TestLog: Controller created successfully
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Controller created failed
'
);
expect
(
false
).
assertTrue
();
}
})
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_CALLBACK_0200
* @tc.name : CREATECONTROLLER_0200
* @tc.desc : Testing creat session controller - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CREATECONTROLLER_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
let
session
;
let
controller
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: AVSession created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
done
();
});
await
sleep
(
500
);
avSession
.
createController
(
session
.
sessionId
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Controller created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
.
sessionId
===
session
.
sessionId
)
{
console
.
info
(
'
TestLog: Controller created successfully
'
);
controller
=
value
;
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Controller created failed
'
);
expect
(
false
).
assertTrue
();
}
});
await
sleep
(
500
);
session
.
destroy
((
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: session destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: session destroy successfully
'
);
console
.
info
(
`TestLog: AVSession :
${
session
.
sessionId
}
destroyed successfully`
);
}
});
await
sleep
(
500
);
controller
.
destroy
((
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: controller destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: controller destroy successfully
'
);
}
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMAVKEYEVENT_CALLBACK_0100
* @tc.name : SENDSYSTEMAVKEYEVENT_0100
* @tc.desc : Testing send systemKeyEvent - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMAVKEYEVENT_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: AVSession created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
done
();
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
handleKeyEvent
'
,
(
callback
)
=>
{
if
(
callback
.
action
===
2
)
{
console
.
info
(
'
TestLog: Send System keyEvent successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System keyEvent failed
'
);
expect
(
false
).
assertTrue
();
}
});
avSession
.
sendSystemAVKeyEvent
(
event
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System KeyEvent error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System KeyEvent
'
);
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
console
.
info
(
`TestLog: AVSession :
${
session
.
sessionId
}
destroyed successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0100
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0100
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
play
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
console
.
info
(
`TestLog: AVSession :
${
session
.
sessionId
}
destroyed successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0200
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0200
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
TestLog: Pause command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
pause
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0300
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0300
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
TestLog: stop command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
stop
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0400
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0400
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
TestLog: playNext command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
playNext
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0500
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0500
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
TestLog: playPrevious command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
playPrevious
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0600
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0600
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
fastForward
'
,
()
=>
{
console
.
info
(
'
TestLog: fastForward command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
fastForward
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0700
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0700
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
rewind
'
,
()
=>
{
console
.
info
(
'
TestLog: rewind command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
rewind
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0800
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0800
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
seek
'
,
(
callback
)
=>
{
console
.
info
(
'
TestLog: seek command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
seek
'
,
parameter
:
10
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0900
* @tc.name : SENDSYSTEMCONTROLCOMMAND_0900
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
setSpeed
'
,
(
callback
)
=>
{
console
.
info
(
'
TestLog: setSpeed command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
setSpeed
'
,
parameter
:
2.6
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_1000
* @tc.name : SENDSYSTEMCONTROLCOMMAND_1000
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
setLoopMode
'
,
(
callback
)
=>
{
console
.
info
(
'
TestLog: setLoopMode command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
setLoopMode
'
,
parameter
:
avSession
.
LoopMode
.
LOOP_MODE_SINGLE
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_1100
* @tc.name : SENDSYSTEMCONTROLCOMMAND_1100
* @tc.desc : Testing send system control command - callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SENDSYSTEMCONTROLCOMMAND_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
let
session
;
avSession
.
createAVSession
(
context
,
tag
,
type
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Session created error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
session
=
value
;
}
});
await
sleep
(
500
);
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
session
.
on
(
'
toggleFavorite
'
,
(
callback
)
=>
{
console
.
info
(
'
TestLog: toggleFavorite command callback registration successful
'
);
});
avSession
.
sendSystemControlCommand
({
command
:
'
toggleFavorite
'
,
parameter
:
'
false
'
},
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`TestLog: Send System control command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Send System control command successfully
'
);
expect
(
true
).
assertTrue
();
}
});
await
sleep
(
500
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
})
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/List.test.js
浏览文件 @
ad02e8b3
...
...
@@ -13,19 +13,15 @@
* limitations under the License.
*/
import
AVSession
from
'
./AVSession.test.js
'
;
import
AVSessionController
from
'
./AVSessionController.test.js
'
;
import
AVSessionManager
from
'
./AVSessionManager.test.js
'
;
import
AVSessionCallback
from
'
./AVSessionCallback.test.js
'
;
import
AVSessionControllerCallback
from
'
./AVSessionControllerCallback.test.js
'
;
import
AVSessionManagerCallback
from
'
./AVSessionManagerCallback.test.js
'
;
import
AVSessionErrorCode
from
'
./AVSessionErrorCode.test
'
;
export
default
function
testsuite
()
{
AVSession
()
AVSessionController
()
AVSessionManager
()
AVSessionCallback
()
AVSessionControllerCallback
()
AVSessionManagerCallback
()
AVSessionErrorCode
()
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录