Commit 2c7994a2 authored by Benjamin REIS's avatar Benjamin REIS

add first_invite_generating conference tester

parent 352aa556
...@@ -60,7 +60,7 @@ void RemoteConference::removeParticipant (const shared_ptr<const Participant> &p ...@@ -60,7 +60,7 @@ void RemoteConference::removeParticipant (const shared_ptr<const Participant> &p
} }
string RemoteConference::getResourceLists (const list<const Address> &addresses) { string RemoteConference::getResourceLists (const list<Address> &addresses) {
ResourceLists rl = ResourceLists(); ResourceLists rl = ResourceLists();
ListType l = ListType(); ListType l = ListType();
for (const auto &addr : addresses) { for (const auto &addr : addresses) {
......
...@@ -39,7 +39,7 @@ public: ...@@ -39,7 +39,7 @@ public:
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override; std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override; void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
std::string getResourceLists (const std::list<const Address> &addresses); std::string getResourceLists (const std::list<Address> &addresses);
protected: protected:
/* ConferenceListener */ /* ConferenceListener */
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "linphone/core.h" #include "linphone/core.h"
#include "private.h" #include "private.h"
#include "liblinphone_tester.h" #include "liblinphone_tester.h"
#include "conference/conference-listener.h"
#include "conference/local-conference.h" #include "conference/local-conference.h"
#include "conference/remote-conference.h" #include "conference/remote-conference.h"
...@@ -46,15 +45,14 @@ static const string sarahAddr = "sip:sarah-bache@sip.linphone.org"; ...@@ -46,15 +45,14 @@ static const string sarahAddr = "sip:sarah-bache@sip.linphone.org";
static const string bobName = "Le Bricoleur"; static const string bobName = "Le Bricoleur";
static const string sarahName = "Sarah"; static const string sarahName = "Sarah";
void first_invite_parsing () { static void check_first_invite(LinphoneCore *core, const Address &address, string invite) {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LocalConference localConf(core, address);
Address marieIdentity(linphone_address_as_string_uri_only(marie->identity)); list<Address> addresses = localConf.parseResourceLists(invite);
LocalConference localConf(marie->lc, marieIdentity);
list<Address> addresses = localConf.parseResourceLists(firstInvite);
BC_ASSERT_EQUAL(addresses.size(), 5, int, "%d"); BC_ASSERT_EQUAL(addresses.size(), 5, int, "%d");
if (addresses.size() != 5) if (addresses.size() != 5)
goto end; return;
BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == aliceAddr); BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == aliceAddr);
BC_ASSERT_TRUE(addresses.front().getDisplayName().empty());
addresses.pop_front(); addresses.pop_front();
BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == bobAddr); BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == bobAddr);
...@@ -62,21 +60,57 @@ void first_invite_parsing () { ...@@ -62,21 +60,57 @@ void first_invite_parsing () {
addresses.pop_front(); addresses.pop_front();
BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == johnAddr); BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == johnAddr);
BC_ASSERT_TRUE(addresses.front().getDisplayName().empty());
addresses.pop_front(); addresses.pop_front();
BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == anneAddr); BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == anneAddr);
BC_ASSERT_TRUE(addresses.front().getDisplayName().empty());
addresses.pop_front(); addresses.pop_front();
BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == sarahAddr); BC_ASSERT_TRUE(addresses.front().asStringUriOnly() == sarahAddr);
BC_ASSERT_TRUE(addresses.front().getDisplayName() == sarahName); BC_ASSERT_TRUE(addresses.front().getDisplayName() == sarahName);
addresses.pop_front(); addresses.pop_front();
}
void first_invite_parsing () {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
const Address marieIdentity(linphone_address_as_string_uri_only(marie->identity));
check_first_invite(marie->lc, marieIdentity, firstInvite);
linphone_core_manager_destroy(marie);
}
void first_invite_serializing() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
const Address marieIdentity(linphone_address_as_string_uri_only(marie->identity));
RemoteConference remoteConf(marie->lc, marieIdentity);
list<Address> addresses = list<Address>();
string xmlBody;
Address aliceIdentity(aliceAddr);
Address bobIdentity(bobAddr);
Address johnIdentity(johnAddr);
Address anneIdentity(anneAddr);
Address sarahIdentity(sarahAddr);
bobIdentity.setDisplayName(bobName);
sarahIdentity.setDisplayName(sarahName);
addresses.push_back(aliceIdentity);
addresses.push_back(bobIdentity);
addresses.push_back(johnIdentity);
addresses.push_back(anneIdentity);
addresses.push_back(sarahIdentity);
xmlBody = remoteConf.getResourceLists(addresses);
check_first_invite(marie->lc, marieIdentity, xmlBody);
end: end:
linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie);
} }
test_t conference_tests[] = { test_t conference_tests[] = {
TEST_NO_TAG("First invite parsing", first_invite_parsing) TEST_NO_TAG("First invite parsing", first_invite_parsing),
TEST_NO_TAG("First invite serializing", first_invite_serializing)
}; };
test_suite_t conference_test_suite = { test_suite_t conference_test_suite = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment