From 80ae7fc3a6f39c01870811a392472083847fa91e Mon Sep 17 00:00:00 2001 From: zljzero Date: Tue, 6 Jun 2023 21:42:35 +0800 Subject: [PATCH] sign Signed-off-by: zljzero --- .../src/main/js/test/AVSession.test.js | 70 +++++++++++++++++++ .../main/js/test/AVSessionCallback.test.js | 7 +- .../main/js/test/AVSessionErrorCode.test.js | 7 +- 3 files changed, 72 insertions(+), 12 deletions(-) diff --git a/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js b/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js index 82c721b1c..2362398a9 100644 --- a/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js +++ b/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js @@ -1817,6 +1817,76 @@ export default function AVSession() { }) + /* * + * @tc.number : SUB_MULTIMEDIA_AVSESSION_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.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(); + }) + /* * * @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPAUSE_0100 diff --git a/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionCallback.test.js b/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionCallback.test.js index bb0695ec8..78a80b093 100644 --- a/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionCallback.test.js +++ b/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionCallback.test.js @@ -59,12 +59,7 @@ export default function AVSessionCallback() { 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(); - }); + controller = await session.getController(); }) afterEach(async function (done) { diff --git a/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js b/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js index abc6fde62..03ebf8454 100644 --- a/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js +++ b/multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js @@ -59,12 +59,7 @@ export default function AVSessionErrorCode() { 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(); - }); + controller = await session.getController(); }) afterEach(async function (done) { -- GitLab