diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-02-11 05:11:53 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-02-22 13:09:26 +0100 |
commit | 058be5c29730ef6276f3c00dbde75e2464c29f3a (patch) | |
tree | 4e4b5402c47184cd117e0c42f52a4efa8c7a08ec /tests | |
parent | 87b20311b0ae075c0a99a09b24a10b0aa3706351 (diff) |
Add "starting" values for recording status
As starting the recording can take some time "starting" values were
added to signal that an audio or video recording is starting. The
status will be changed from NONE to STARTING_VIDEO/AUDIO by the
Nextcloud server when the request to start the recording succeeds, and
then the recording status will be set to VIDEO or AUDIO by the recording
server once the recording actually started.
Stopping the recording, on the other hand, should be quite fast, so no
STOPPING status were added.
The system messages were also adjusted to be sent only once the
recording really started or stopped.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/features/callapi/recording.feature | 12 | ||||
-rw-r--r-- | tests/php/Chat/SystemMessage/ListenerTest.php | 117 |
2 files changed, 105 insertions, 24 deletions
diff --git a/tests/integration/features/callapi/recording.feature b/tests/integration/features/callapi/recording.feature index eff03accd..0755a7129 100644 --- a/tests/integration/features/callapi/recording.feature +++ b/tests/integration/features/callapi/recording.feature @@ -18,7 +18,7 @@ Feature: callapi/recording | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} | And user "participant1" is participant of the following unordered rooms (v4) | type | name | callRecording | - | 2 | room1 | 0 | + | 2 | room1 | 3 | And recording server sent started request for "video" recording in room "room1" as "participant1" with 200 Then user "participant1" sees the following system messages in room "room1" with 200 (v1) | room | actorType | actorId | actorDisplayName | systemMessage | @@ -61,7 +61,7 @@ Feature: callapi/recording | room1 | {"type":"start","start":{"status":2,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} | And user "participant1" is participant of the following unordered rooms (v4) | type | name | callRecording | - | 2 | room1 | 0 | + | 2 | room1 | 4 | And recording server sent started request for "audio" recording in room "room1" as "participant1" with 200 Then user "participant1" sees the following system messages in room "room1" with 200 (v1) | room | actorType | actorId | actorDisplayName | systemMessage | @@ -102,10 +102,6 @@ Feature: callapi/recording And recording server received the following requests | token | data | | room1 | {"type":"start","start":{"status":2,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} | - And user "participant1" starts "audio" recording in room "room1" with 200 (v1) - And recording server received the following requests - | token | data | - | room1 | {"type":"start","start":{"status":2,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} | And recording server sent started request for "audio" recording in room "room1" as "participant1" with 200 And user "participant1" starts "audio" recording in room "room1" with 400 (v1) Then the response error matches with "recording" @@ -131,10 +127,6 @@ Feature: callapi/recording And recording server received the following requests | token | data | | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} | - And user "participant1" starts "video" recording in room "room1" with 200 (v1) - And recording server received the following requests - | token | data | - | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} | And recording server sent started request for "video" recording in room "room1" as "participant1" with 200 And user "participant1" starts "video" recording in room "room1" with 400 (v1) Then the response error matches with "recording" diff --git a/tests/php/Chat/SystemMessage/ListenerTest.php b/tests/php/Chat/SystemMessage/ListenerTest.php index 3e073a244..91dd198ae 100644 --- a/tests/php/Chat/SystemMessage/ListenerTest.php +++ b/tests/php/Chat/SystemMessage/ListenerTest.php @@ -322,6 +322,34 @@ class ListenerTest extends TestCase { public function callRecordingChangeProvider() { return [ [ + Room::RECORDING_VIDEO_STARTING, + Room::RECORDING_NONE, + null, + null, + null, + ], + [ + Room::RECORDING_VIDEO_STARTING, + Room::RECORDING_NONE, + Attendee::ACTOR_USERS, + 'alice', + null, + ], + [ + Room::RECORDING_VIDEO, + Room::RECORDING_VIDEO_STARTING, + null, + null, + ['message' => 'recording_started', 'parameters' => []], + ], + [ + Room::RECORDING_VIDEO, + Room::RECORDING_VIDEO_STARTING, + Attendee::ACTOR_USERS, + 'alice', + ['message' => 'recording_started', 'parameters' => []], + ], + [ Room::RECORDING_VIDEO, Room::RECORDING_NONE, null, @@ -336,6 +364,34 @@ class ListenerTest extends TestCase { ['message' => 'recording_started', 'parameters' => []], ], [ + Room::RECORDING_AUDIO_STARTING, + Room::RECORDING_NONE, + null, + null, + null, + ], + [ + Room::RECORDING_AUDIO_STARTING, + Room::RECORDING_NONE, + Attendee::ACTOR_USERS, + 'alice', + null, + ], + [ + Room::RECORDING_AUDIO, + Room::RECORDING_AUDIO_STARTING, + null, + null, + ['message' => 'audio_recording_started', 'parameters' => []], + ], + [ + Room::RECORDING_AUDIO, + Room::RECORDING_AUDIO_STARTING, + Attendee::ACTOR_USERS, + 'alice', + ['message' => 'audio_recording_started', 'parameters' => []], + ], + [ Room::RECORDING_AUDIO, Room::RECORDING_NONE, null, @@ -351,6 +407,20 @@ class ListenerTest extends TestCase { ], [ Room::RECORDING_NONE, + Room::RECORDING_VIDEO_STARTING, + null, + null, + null, + ], + [ + Room::RECORDING_NONE, + Room::RECORDING_VIDEO_STARTING, + Attendee::ACTOR_USERS, + 'bob', + null, + ], + [ + Room::RECORDING_NONE, Room::RECORDING_VIDEO, null, null, @@ -365,6 +435,20 @@ class ListenerTest extends TestCase { ], [ Room::RECORDING_NONE, + Room::RECORDING_AUDIO_STARTING, + null, + null, + null, + ], + [ + Room::RECORDING_NONE, + Room::RECORDING_AUDIO_STARTING, + Attendee::ACTOR_USERS, + 'bob', + null, + ], + [ + Room::RECORDING_NONE, Room::RECORDING_AUDIO, null, null, @@ -389,7 +473,7 @@ class ListenerTest extends TestCase { * @param string|null $actorId * @param array $expectedMessage */ - public function testAfterCallRecordingSet(int $newStatus, int $oldStatus, ?string $actorType, ?string $actorId, array $expectedMessage): void { + public function testAfterCallRecordingSet(int $newStatus, int $oldStatus, ?string $actorType, ?string $actorId, ?array $expectedMessage): void { $this->mockLoggedInUser('logged_in_user'); $room = $this->createMock(Room::class); @@ -416,19 +500,24 @@ class ListenerTest extends TestCase { $event = new ModifyRoomEvent($room, 'callRecording', $newStatus, $oldStatus, $participant); - $this->chatManager->expects($this->once()) - ->method('addSystemMessage') - ->with( - $room, - $expectedActorType, - $expectedActorId, - json_encode($expectedMessage), - $this->dummyTime, - false, - SELF::DUMMY_REFERENCE_ID, - null, - false - ); + if ($expectedMessage !== null) { + $this->chatManager->expects($this->once()) + ->method('addSystemMessage') + ->with( + $room, + $expectedActorType, + $expectedActorId, + json_encode($expectedMessage), + $this->dummyTime, + false, + SELF::DUMMY_REFERENCE_ID, + null, + false + ); + } else { + $this->chatManager->expects($this->never()) + ->method('addSystemMessage'); + } $this->dispatch(Room::EVENT_AFTER_SET_CALL_RECORDING, $event); } |