提交 f1f38af3 编写于 作者: D durui

枚举覆盖

Signed-off-by: Ndurui <durui15@huawei.com>
上级 785e3d66
...@@ -31,12 +31,12 @@ export default function AVSession() { ...@@ -31,12 +31,12 @@ export default function AVSession() {
let context = featureAbility.getContext(); let context = featureAbility.getContext();
let castControlCommandType = 'play'; let castControlCommandType = 'play';
let deviceInfo = { let deviceInfo = {
castCategory : 0, castCategory: 0,
deviceId : "deviceId", deviceId: "deviceId",
deviceName : "deviceName", deviceName: "deviceName",
} }
let outputDeviceInfo = { let outputDeviceInfo = {
devices : [ deviceInfo ], devices: [deviceInfo],
} }
function sleep(ms) { function sleep(ms) {
...@@ -73,7 +73,7 @@ export default function AVSession() { ...@@ -73,7 +73,7 @@ export default function AVSession() {
}); });
controller = await session.getController(); controller = await session.getController();
}); });
afterEach(async function (done) { afterEach(async function (done) {
...@@ -677,7 +677,7 @@ export default function AVSession() { ...@@ -677,7 +677,7 @@ export default function AVSession() {
it('SUB_MULTIMEDIA_AVSESSION_SETAVPLAYBACKSTATE_PROMISE_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AVSESSION_SETAVPLAYBACKSTATE_PROMISE_0100', 0, async function (done) {
let PlaybackState1 = { let PlaybackState1 = {
state: avSession.PlaybackState.PLAYBACK_STATE_PLAY, state: avSession.PlaybackState.PLAYBACK_STATE_PLAY,
activeItemId : 0, activeItemId: 0,
}; };
await session.setAVPlaybackState(PlaybackState1).then(() => { await session.setAVPlaybackState(PlaybackState1).then(() => {
console.info('TestLog: Set State successfully'); console.info('TestLog: Set State successfully');
...@@ -1458,7 +1458,7 @@ export default function AVSession() { ...@@ -1458,7 +1458,7 @@ export default function AVSession() {
}); });
await sleep(500); await sleep(500);
try{ try {
session.deactivate((err) => { session.deactivate((err) => {
if (err) { if (err) {
console.info(`TestLog: Deactivate session error: code: ${err.code}, message: ${err.message}`); console.info(`TestLog: Deactivate session error: code: ${err.code}, message: ${err.message}`);
...@@ -1488,7 +1488,7 @@ export default function AVSession() { ...@@ -1488,7 +1488,7 @@ export default function AVSession() {
done(); done();
}) })
/* * /* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAY_0100 * @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAY_0100
...@@ -1828,75 +1828,75 @@ export default function AVSession() { ...@@ -1828,75 +1828,75 @@ export default function AVSession() {
}) })
/* * /* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100 * @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100
* @tc.name : OFFPLAY_0100 * @tc.name : OFFPLAY_0100
* @tc.desc : Testing offPlay callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100', 0, async function (done) {
function callback1() {
console.info('TestLog: Play command registration1 success');
expect(false).assertTrue();
}
function callback2() {
console.info('TestLog: Play command registration2 success');
expect(false).assertTrue();
}
session.on('play', callback1);
session.on('play', callback2);
session.off('play');
await controller.sendControlCommand({ command: 'play' }).then(() => {
console.info('TestLog: Controller send command successfully');
}).catch((err) => {
console.info(`TestLog: Controller send command error: code: ${err.code}, message: ${err.message}`);
expect(true).assertTrue();
});
await sleep(500);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200
* @tc.name : OFFPLAY_0200
* @tc.desc : Testing offPlay callback * @tc.desc : Testing offPlay callback
* @tc.size : MediumTest * @tc.size : MediumTest
* @tc.type : Function * @tc.type : Function
* @tc.level : Level2 * @tc.level : Level2
*/ */
it('SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200', 0, async function (done) {
function callback1() { function callback1() {
console.info('TestLog: Play command registration1 success'); console.info('TestLog: Play command registration1 success');
expect(false).assertTrue(); expect(false).assertTrue();
} }
function callback2() { function callback2() {
console.info('TestLog: Play command registration2 success'); console.info('TestLog: Play command registration2 success');
expect(false).assertTrue(); expect(true).assertTrue();
} }
session.on('play', callback1); session.on('play', callback1);
session.on('play', callback2); session.on('play', callback2);
session.off('play'); session.off('play', callback1);
await controller.sendControlCommand({ command: 'play' }).then(() => { await controller.sendControlCommand({ command: 'play' }).then(() => {
console.info('TestLog: Controller send command successfully'); console.info('TestLog: Controller send command successfully');
}).catch((err) => { }).catch((err) => {
console.info(`TestLog: Controller send command error: code: ${err.code}, message: ${err.message}`); console.info(`TestLog: Controller send command error: code: ${err.code}, message: ${err.message}`);
expect(true).assertTrue(); expect(false).assertTrue();
}); });
await sleep(500); await sleep(500);
done(); done();
}) })
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200
* @tc.name : OFFPLAY_0200
* @tc.desc : Testing offPlay callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0200', 0, async function (done) {
function callback1() {
console.info('TestLog: Play command registration1 success');
expect(false).assertTrue();
}
function callback2() {
console.info('TestLog: Play command registration2 success');
expect(true).assertTrue();
}
session.on('play', callback1);
session.on('play', callback2);
session.off('play', callback1);
await controller.sendControlCommand({ command: 'play' }).then(() => {
console.info('TestLog: Controller send command successfully');
}).catch((err) => {
console.info(`TestLog: Controller send command error: code: ${err.code}, message: ${err.message}`);
expect(false).assertTrue();
});
await sleep(500);
done();
})
/* * /* *
...@@ -2752,9 +2752,9 @@ export default function AVSession() { ...@@ -2752,9 +2752,9 @@ export default function AVSession() {
if (!data.isRemote) { if (!data.isRemote) {
expect(true).assertTrue(); expect(true).assertTrue();
} else { } else {
console.info(avSession.OutputDeviceInfo.isRemote); console.info(avSession.OutputDeviceInfo.isRemote);
console.info(avSession.OutputDeviceInfo.audioDeviceId.size); console.info(avSession.OutputDeviceInfo.audioDeviceId.size);
console.info(avSession.OutputDeviceInfo.deviceName.size); console.info(avSession.OutputDeviceInfo.deviceName.size);
console.info('getOutputDevice successfully'); console.info('getOutputDevice successfully');
console.info('Get device information failed'); console.info('Get device information failed');
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -2863,8 +2863,8 @@ export default function AVSession() { ...@@ -2863,8 +2863,8 @@ export default function AVSession() {
* @tc.level : Level2 * @tc.level : Level2
*/ */
it('SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_CALLBACK_0100', 0, async function (done) {
let keyItem = {code: 0x49, pressedTime: 123456789, deviceId: 0}; let keyItem = { code: 0x49, pressedTime: 123456789, deviceId: 0 };
let event = {action: 2, key: keyItem, keys: [keyItem]}; let event = { action: 2, key: keyItem, keys: [keyItem] };
try { try {
controller.sendAVKeyEvent(event, (err, data) => { controller.sendAVKeyEvent(event, (err, data) => {
if (err) { if (err) {
...@@ -2891,8 +2891,8 @@ export default function AVSession() { ...@@ -2891,8 +2891,8 @@ export default function AVSession() {
* @tc.level : Level2 * @tc.level : Level2
*/ */
it('SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_PROMISE_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AVSESSION_SENDAVKEYEVENT_PROMISE_0100', 0, async function (done) {
let keyItem = {code: 0x49, pressedTime: 123456789, deviceId: 0}; let keyItem = { code: 0x49, pressedTime: 123456789, deviceId: 0 };
let event = {action: 2, key: keyItem, keys: [keyItem]}; let event = { action: 2, key: keyItem, keys: [keyItem] };
await controller.sendAVKeyEvent(event).then(() => { await controller.sendAVKeyEvent(event).then(() => {
console.info('sendAVKeyEvent Successfully'); console.info('sendAVKeyEvent Successfully');
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -2914,7 +2914,7 @@ export default function AVSession() { ...@@ -2914,7 +2914,7 @@ export default function AVSession() {
it('SUB_MULTIMEDIA_AVSESSION_GETREALPLAYBACKPOSITIONSYNC_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AVSESSION_GETREALPLAYBACKPOSITIONSYNC_0100', 0, async function (done) {
let realPosition = -1; let realPosition = -1;
try { try {
realPosition= controller.getRealPlaybackPositionSync(); realPosition = controller.getRealPlaybackPositionSync();
} catch (err) { } catch (err) {
console.info(`TestLog: getRealPlaybackPositionSync error: code: ${err.code}, message: ${err.message}`); console.info(`TestLog: getRealPlaybackPositionSync error: code: ${err.code}, message: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
......
...@@ -33,9 +33,6 @@ export default function AVSessionControllerJsTest() { ...@@ -33,9 +33,6 @@ export default function AVSessionControllerJsTest() {
let receivedParam2 = null; let receivedParam2 = null;
let receivedExtras = null; let receivedExtras = null;
let receivedExtras2 = null; let receivedExtras2 = null;
// let value = Uint8Array = resourceManager.getRawFileContent('IMAGE_URI');
// let imageSource = imageImageSource = image.createImageSource(value.buffer);
// let imagePixel = image.PixelMap = imageSource.createPixelMap({desiredSize:{width: 150, height: 150}});
const INVALID_STRING = "invalid string"; const INVALID_STRING = "invalid string";
const UPDATE_LYRICS_EVENT = "dynamic_lyrics"; const UPDATE_LYRICS_EVENT = "dynamic_lyrics";
const UPDATE_LYRICS_WANT_PARAMS = { const UPDATE_LYRICS_WANT_PARAMS = {
...@@ -58,17 +55,16 @@ export default function AVSessionControllerJsTest() { ...@@ -58,17 +55,16 @@ export default function AVSessionControllerJsTest() {
mediaId: QUEUE_ITEM_KEY_WORD, mediaId: QUEUE_ITEM_KEY_WORD,
title: QUEUE_ITEM_KEY_WORD, title: QUEUE_ITEM_KEY_WORD,
extras: EXTRAS, extras: EXTRAS,
// icon: undefined,
iconUri: "iconUri", iconUri: "iconUri",
mediaSize: 10, mediaSize: 10,
albumTitle: "albumTitle", albumTitle: "albumTitle",
albumCoverUri : "albumCoverUri", albumCoverUri: "albumCoverUri",
lyricContent : "lyricContent", lyricContent: "lyricContent",
lyricUri : "lyricUri", lyricUri: "lyricUri",
mediaUri : "mediaUri", mediaUri: "mediaUri",
startPosition : 0, startPosition: 0,
creditsPosition : 0, creditsPosition: 0,
appName : "appName" appName: "appName"
}; };
const QUEUE_ITEM_DESCRIPTION_ERROR = { const QUEUE_ITEM_DESCRIPTION_ERROR = {
mediaId: QUEUE_ITEM_KEY_WORD, mediaId: QUEUE_ITEM_KEY_WORD,
...@@ -78,13 +74,13 @@ export default function AVSessionControllerJsTest() { ...@@ -78,13 +74,13 @@ export default function AVSessionControllerJsTest() {
iconUri: "iconUri", iconUri: "iconUri",
mediaSize: 10, mediaSize: 10,
albumTitle: "albumTitle", albumTitle: "albumTitle",
albumCoverUri : "albumCoverUri", albumCoverUri: "albumCoverUri",
lyricContent : "lyricContent", lyricContent: "lyricContent",
lyricUri : "lyricUri", lyricUri: "lyricUri",
mediaUri : "mediaUri", mediaUri: "mediaUri",
startPosition : 0, startPosition: 0,
creditsPosition : 0, creditsPosition: 0,
appName : "appName" appName: "appName"
}; };
const QUEUE_ITEM = { const QUEUE_ITEM = {
itemId: QUEUE_ITEM_ID, itemId: QUEUE_ITEM_ID,
...@@ -107,7 +103,7 @@ export default function AVSessionControllerJsTest() { ...@@ -107,7 +103,7 @@ export default function AVSessionControllerJsTest() {
expect().assertFail(); expect().assertFail();
}); });
session.activate(); session.activate();
controller = await session.getController(); controller = await session.getController();
console.info(TAG + "Create session and controller finished, beforeAll called"); console.info(TAG + "Create session and controller finished, beforeAll called");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册