Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
997583a2
Commit
997583a2
authored
2 years ago
by
Aline Gondim Santos
Browse files
Options
Downloads
Patches
Plain Diff
recorder: add test for single person rdv
GitLab:
#691
Change-Id: Ic6f019c5230cdf13e5a0aec97eaec508c8908980
parent
89d9f125
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/unitTest/call/recorder.cpp
+62
-0
62 additions, 0 deletions
test/unitTest/call/recorder.cpp
with
62 additions
and
0 deletions
test/unitTest/call/recorder.cpp
+
62
−
0
View file @
997583a2
...
...
@@ -87,12 +87,14 @@ private:
void
registerSignalHandlers
();
void
testRecordCall
();
void
testRecordAudioOnlyCall
();
void
testRecordCallOnePersonRdv
();
void
testStopCallWhileRecording
();
void
testDaemonPreference
();
CPPUNIT_TEST_SUITE
(
RecorderTest
);
CPPUNIT_TEST
(
testRecordCall
);
CPPUNIT_TEST
(
testRecordAudioOnlyCall
);
CPPUNIT_TEST
(
testRecordCallOnePersonRdv
);
CPPUNIT_TEST
(
testStopCallWhileRecording
);
CPPUNIT_TEST
(
testDaemonPreference
);
CPPUNIT_TEST_SUITE_END
();
...
...
@@ -177,6 +179,7 @@ RecorderTest::registerSignalHandlers()
void
RecorderTest
::
testRecordCall
()
{
JAMI_INFO
(
"Start testRecordCall"
);
registerSignalHandlers
();
auto
aliceAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
aliceId
);
auto
bobAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
bobId
);
...
...
@@ -221,11 +224,13 @@ RecorderTest::testRecordCall()
Manager
::
instance
().
hangupCall
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
state
==
"OVER"
;
}));
JAMI_INFO
(
"End testRecordCall"
);
}
void
RecorderTest
::
testRecordAudioOnlyCall
()
{
JAMI_INFO
(
"Start testRecordAudioOnlyCall"
);
registerSignalHandlers
();
auto
aliceAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
aliceId
);
auto
bobAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
bobId
);
...
...
@@ -263,11 +268,63 @@ RecorderTest::testRecordAudioOnlyCall()
Manager
::
instance
().
hangupCall
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
state
==
"OVER"
;
}));
JAMI_INFO
(
"End testRecordAudioOnlyCall"
);
}
void
RecorderTest
::
testRecordCallOnePersonRdv
()
{
JAMI_INFO
(
"Start testRecordCallOnePersonRdv"
);
registerSignalHandlers
();
auto
aliceAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
aliceId
);
auto
bobAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
bobId
);
auto
bobUri
=
bobAccount
->
getUsername
();
try
{
bobAccount
->
editConfig
(
[
&
](
AccountConfig
&
config
)
{
config
.
isRendezVous
=
true
;
});
}
catch
(...)
{}
CPPUNIT_ASSERT
(
bobAccount
->
config
().
isRendezVous
);
recordedFile
.
clear
();
JAMI_INFO
(
"Start call between Alice and Bob"
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
mediaList
;
std
::
map
<
std
::
string
,
std
::
string
>
mediaAttributeA
=
{{
libjami
::
Media
::
MediaAttributeKey
::
MEDIA_TYPE
,
libjami
::
Media
::
MediaAttributeValue
::
AUDIO
},
{
libjami
::
Media
::
MediaAttributeKey
::
ENABLED
,
TRUE_STR
},
{
libjami
::
Media
::
MediaAttributeKey
::
MUTED
,
FALSE_STR
},
{
libjami
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
}};
mediaList
.
emplace_back
(
mediaAttributeA
);
auto
callId
=
libjami
::
placeCallWithMedia
(
aliceId
,
bobUri
,
mediaList
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
!
bobCall
.
callId
.
empty
();
}));
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
mediaStatus
==
libjami
::
Media
::
MediaNegotiationStatusEvents
::
NEGOTIATION_SUCCESS
;
}));
CPPUNIT_ASSERT
(
!
libjami
::
getIsRecording
(
aliceId
,
callId
));
libjami
::
toggleRecording
(
aliceId
,
callId
);
// Stop recorder after a few seconds
std
::
this_thread
::
sleep_for
(
5s
);
CPPUNIT_ASSERT
(
libjami
::
getIsRecording
(
aliceId
,
callId
));
libjami
::
toggleRecording
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
!
libjami
::
getIsRecording
(
aliceId
,
callId
));
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
!
recordedFile
.
empty
();
}));
Manager
::
instance
().
hangupCall
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
state
==
"OVER"
&&
!
recordedFile
.
empty
();
}));
JAMI_INFO
(
"End testRecordCallOnePersonRdv"
);
}
void
RecorderTest
::
testStopCallWhileRecording
()
{
JAMI_INFO
(
"Start testStopCallWhileRecording"
);
registerSignalHandlers
();
auto
aliceAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
aliceId
);
auto
bobAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
bobId
);
...
...
@@ -303,14 +360,17 @@ RecorderTest::testStopCallWhileRecording()
// Hangup call
std
::
this_thread
::
sleep_for
(
5s
);
CPPUNIT_ASSERT
(
libjami
::
getIsRecording
(
aliceId
,
callId
));
Manager
::
instance
().
hangupCall
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
state
==
"OVER"
&&
!
recordedFile
.
empty
();
}));
JAMI_INFO
(
"End testStopCallWhileRecording"
);
}
void
RecorderTest
::
testDaemonPreference
()
{
JAMI_INFO
(
"Start testDaemonPreference"
);
registerSignalHandlers
();
auto
aliceAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
aliceId
);
auto
bobAccount
=
Manager
::
instance
().
getAccount
<
JamiAccount
>
(
bobId
);
...
...
@@ -337,10 +397,12 @@ RecorderTest::testDaemonPreference()
// Let record some seconds
std
::
this_thread
::
sleep_for
(
5s
);
CPPUNIT_ASSERT
(
libjami
::
getIsRecording
(
aliceId
,
callId
));
Manager
::
instance
().
hangupCall
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
state
==
"OVER"
&&
!
recordedFile
.
empty
();
}));
JAMI_INFO
(
"End testDaemonPreference"
);
}
}
// namespace test
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment