forked from mirrors/linphone-iphone
Fix 'Conference event' tester
This commit is contained in:
parent
47da8088e3
commit
fe37c2892b
9 changed files with 173 additions and 107 deletions
|
|
@ -56,6 +56,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
conference/conference-listener.h
|
||||
conference/conference.h
|
||||
conference/local-conference.h
|
||||
conference/local-conference-event-handler-p.h
|
||||
conference/local-conference-event-handler.h
|
||||
conference/params/call-session-params-p.h
|
||||
conference/params/call-session-params.h
|
||||
|
|
@ -64,6 +65,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
conference/participant-p.h
|
||||
conference/participant.h
|
||||
conference/remote-conference.h
|
||||
conference/remote-conference-event-handler-p.h
|
||||
conference/remote-conference-event-handler.h
|
||||
conference/session/call-session-listener.h
|
||||
conference/session/call-session-p.h
|
||||
|
|
|
|||
51
src/conference/local-conference-event-handler-p.h
Normal file
51
src/conference/local-conference-event-handler-p.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* local-conference-event-handler-p.h
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
#define _LOCAL_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "local-conference-event-handler.h"
|
||||
#include "object/object-p.h"
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class LocalConferenceEventHandlerPrivate : public ObjectPrivate {
|
||||
public:
|
||||
void notifyFullState (const std::string ¬ify, LinphoneEvent *lev);
|
||||
void notifyAllExcept (const std::string ¬ify, const Address &addr);
|
||||
void notifyAll (const std::string ¬ify);
|
||||
std::string createNotifyFullState ();
|
||||
std::string createNotifyParticipantAdded (const Address &addr);
|
||||
std::string createNotifyParticipantRemoved (const Address &addr);
|
||||
std::string createNotifyParticipantAdmined (const Address &addr, bool isAdmin);
|
||||
std::string createNotifySubjectChanged ();
|
||||
|
||||
private:
|
||||
LinphoneCore *core = nullptr;
|
||||
LocalConference *conf = nullptr;
|
||||
|
||||
void sendNotify (const std::string ¬ify, const Address &addr);
|
||||
L_DECLARE_PUBLIC(LocalConferenceEventHandler);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "conference/local-conference.h"
|
||||
#include "conference/participant-p.h"
|
||||
#include "local-conference-event-handler.h"
|
||||
#include "local-conference-event-handler-p.h"
|
||||
#include "object/object-p.h"
|
||||
|
||||
#include "private.h"
|
||||
|
|
@ -34,27 +34,9 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
using namespace Xsd::ConferenceInfo;
|
||||
|
||||
class LocalConferenceEventHandlerPrivate : public ObjectPrivate {
|
||||
public:
|
||||
void notifyFullState (string notify, LinphoneEvent *lev);
|
||||
void notifyAllExcept (string notify, const Address &addr);
|
||||
void notifyAll (string notify);
|
||||
string createNotifyFullState ();
|
||||
string createNotifyParticipantAdded (const Address &addr);
|
||||
string createNotifyParticipantRemoved (const Address &addr);
|
||||
string createNotifyParticipantAdmined (const Address &addr, bool isAdmin);
|
||||
string createNotifySubjectChanged ();
|
||||
|
||||
LinphoneCore *core = nullptr;
|
||||
LocalConference *conf = nullptr;
|
||||
|
||||
private:
|
||||
void sendNotify (string notify, const Address &addr);
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void doNotify (string notify, LinphoneEvent *lev) {
|
||||
static void doNotify (const string ¬ify, LinphoneEvent *lev) {
|
||||
LinphoneContent *content = linphone_core_create_content(lev->lc);
|
||||
linphone_content_set_buffer(content, notify.c_str(), strlen(notify.c_str()));
|
||||
linphone_event_notify(lev, content);
|
||||
|
|
@ -72,18 +54,18 @@ static string createNotify (ConferenceType confInfo) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LocalConferenceEventHandlerPrivate::notifyFullState (string notify, LinphoneEvent *lev) {
|
||||
void LocalConferenceEventHandlerPrivate::notifyFullState (const string ¬ify, LinphoneEvent *lev) {
|
||||
doNotify(notify, lev);
|
||||
}
|
||||
|
||||
void LocalConferenceEventHandlerPrivate::notifyAllExcept (string notify, const Address &addr) {
|
||||
void LocalConferenceEventHandlerPrivate::notifyAllExcept (const string ¬ify, const Address &addr) {
|
||||
for (const auto &participant : conf->getParticipants()) {
|
||||
if (participant->getPrivate()->isSubscribedToConferenceEventPackage() && (addr != participant->getAddress()))
|
||||
sendNotify(notify, addr);
|
||||
}
|
||||
}
|
||||
|
||||
void LocalConferenceEventHandlerPrivate::notifyAll (string notify) {
|
||||
void LocalConferenceEventHandlerPrivate::notifyAll (const string ¬ify) {
|
||||
for (const auto &participant : conf->getParticipants()) {
|
||||
if (participant->getPrivate()->isSubscribedToConferenceEventPackage())
|
||||
sendNotify(notify, participant->getAddress());
|
||||
|
|
@ -175,7 +157,7 @@ string LocalConferenceEventHandlerPrivate::createNotifySubjectChanged () {
|
|||
return(createNotify(confInfo));
|
||||
}
|
||||
|
||||
void LocalConferenceEventHandlerPrivate::sendNotify (string notify, const Address &addr) {
|
||||
void LocalConferenceEventHandlerPrivate::sendNotify (const string ¬ify, const Address &addr) {
|
||||
LinphoneAddress *cAddr = linphone_address_new(addr.asString().c_str());
|
||||
LinphoneEvent *lev = linphone_core_create_notify(core, cAddr, "conference");
|
||||
linphone_address_unref(cAddr);
|
||||
|
|
|
|||
|
|
@ -20,11 +20,8 @@
|
|||
#ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_H_
|
||||
#define _LOCAL_CONFERENCE_EVENT_HANDLER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/types.h"
|
||||
|
||||
#include "address/address.h"
|
||||
#include "linphone/types.h"
|
||||
#include "object/object.h"
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
|
|
|||
40
src/conference/remote-conference-event-handler-p.h
Normal file
40
src/conference/remote-conference-event-handler-p.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* remote-conference-event-handler-p.h
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
#define _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
|
||||
#include "object/object-p.h"
|
||||
#include "remote-conference-event-handler.h"
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class RemoteConferenceEventHandlerPrivate : public ObjectPrivate {
|
||||
private:
|
||||
LinphoneCore *core = nullptr;
|
||||
ConferenceListener *listener = nullptr;
|
||||
Address confAddress;
|
||||
LinphoneEvent *lev = nullptr;
|
||||
|
||||
L_DECLARE_PUBLIC(RemoteConferenceEventHandler);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
|
|
@ -17,12 +17,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "remote-conference-event-handler.h"
|
||||
#include "logger/logger.h"
|
||||
#include "object/object-p.h"
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "logger/logger.h"
|
||||
#include "remote-conference-event-handler-p.h"
|
||||
#include "xml/conference-info.h"
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -33,14 +30,6 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
using namespace Xsd::ConferenceInfo;
|
||||
|
||||
class RemoteConferenceEventHandlerPrivate : public ObjectPrivate {
|
||||
public:
|
||||
LinphoneCore *core = nullptr;
|
||||
ConferenceListener *listener = nullptr;
|
||||
Address confAddress;
|
||||
LinphoneEvent *lev = nullptr;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
RemoteConferenceEventHandler::RemoteConferenceEventHandler(LinphoneCore *core, ConferenceListener *listener)
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ set(SOURCE_FILES_C
|
|||
|
||||
set(SOURCE_FILES_CXX
|
||||
clonable-object-tester.cpp
|
||||
# conference-event-tester.cpp
|
||||
conference-event-tester.cpp
|
||||
conference-tester.cpp
|
||||
cpim-tester.cpp
|
||||
multipart-tester.cpp
|
||||
|
|
|
|||
|
|
@ -24,9 +24,11 @@
|
|||
#include "liblinphone_tester.h"
|
||||
#include "conference/conference-listener.h"
|
||||
#include "conference/local-conference.h"
|
||||
#include "conference/local-conference-event-handler.h"
|
||||
#include "conference/local-conference-event-handler-p.h"
|
||||
#include "conference/participant.h"
|
||||
#include "conference/remote-conference-event-handler.h"
|
||||
#include "conference/remote-conference-event-handler-p.h"
|
||||
#include "tools/private-access.h"
|
||||
#include "tools/tester.h"
|
||||
|
||||
using namespace LinphonePrivate;
|
||||
using namespace std;
|
||||
|
|
@ -417,7 +419,8 @@ static const char *aliceUri = "sip:alice@example.com";
|
|||
static const char *frankUri = "sip:frank@example.com";
|
||||
static const char *confUri = "sips:conf233@example.com";
|
||||
|
||||
|
||||
L_ENABLE_ATTR_ACCESS(RemoteConferenceEventHandlerPrivate, Address, confAddress);
|
||||
L_ENABLE_ATTR_ACCESS(Conference, Address, conferenceAddress);
|
||||
|
||||
class ConferenceEventTester : public ConferenceListener {
|
||||
public:
|
||||
|
|
@ -430,10 +433,11 @@ private:
|
|||
void onParticipantAdded (const Address &addr) override;
|
||||
void onParticipantRemoved (const Address &addr) override;
|
||||
void onParticipantSetAdmin (const Address &addr, bool isAdmin) override;
|
||||
void onSubjectChanged(const std::string &subject) override;
|
||||
void onSubjectChanged(const string &subject) override;
|
||||
public:
|
||||
RemoteConferenceEventHandler *handler;
|
||||
map<string, bool> participants;
|
||||
string confSubject;
|
||||
};
|
||||
|
||||
ConferenceEventTester::ConferenceEventTester (LinphoneCore *core, const Address &confAddr) {
|
||||
|
|
@ -461,6 +465,10 @@ void ConferenceEventTester::onParticipantSetAdmin (const Address &addr, bool isA
|
|||
it->second = isAdmin;
|
||||
}
|
||||
|
||||
void ConferenceEventTester::onSubjectChanged(const string &subject) {
|
||||
confSubject = subject;
|
||||
}
|
||||
|
||||
void first_notify_parsing() {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri);
|
||||
|
|
@ -474,6 +482,8 @@ void first_notify_parsing() {
|
|||
size_t size = strlen(first_notify) + strlen(confUri);
|
||||
char *notify = new char[size];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -503,6 +513,8 @@ void first_notify_parsing_wrong_conf() {
|
|||
size_t size = strlen(first_notify) + strlen(confUri);
|
||||
char *notify = new char[size];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -533,6 +545,8 @@ void participant_added_parsing() {
|
|||
size_t size2 = strlen(participant_added_notify) + strlen(confUri);
|
||||
char *notify_added = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -575,6 +589,8 @@ void participant_not_added_parsing() {
|
|||
size_t size2 = strlen(participant_not_added_notify) + strlen(confUri);
|
||||
char *notify_not_added = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -615,6 +631,8 @@ void participant_deleted_parsing() {
|
|||
size_t size2 = strlen(participant_deleted_notify) + strlen(confUri);
|
||||
char *notify_deleted = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -654,6 +672,8 @@ void participant_admined_parsing() {
|
|||
size_t size2 = strlen(participant_admined_notify) + strlen(confUri);
|
||||
char *notify_admined = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -694,6 +714,8 @@ void participant_unadmined_parsing() {
|
|||
size_t size2 = strlen(participant_unadmined_notify) + strlen(confUri);
|
||||
char *notify_unadmined = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -740,12 +762,16 @@ void send_first_notify() {
|
|||
|
||||
CallSessionParams params;
|
||||
localConf.addParticipant(bobAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
alice->setAdmin(true);
|
||||
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "conference");
|
||||
string notify = localConf.getEventHandler()->subscribeReceived(lev);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
linphone_event_unref(lev);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
|
||||
|
|
@ -780,15 +806,19 @@ void send_added_notify() {
|
|||
Address frankAddr(frankAddrStr);
|
||||
bctbx_free(frankAddrStr);
|
||||
linphone_address_unref(cFrankAddr);
|
||||
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "conference");
|
||||
|
||||
CallSessionParams params;
|
||||
localConf.addParticipant(bobAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
alice->setAdmin(true);
|
||||
string notify = localConf.getEventHandler()->subscribeReceived(lev);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
linphone_event_unref(lev);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
|
||||
|
|
@ -796,7 +826,7 @@ void send_added_notify() {
|
|||
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
|
||||
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
|
||||
|
||||
notify = localConf.getEventHandler()->notifyParticipantAdded(frankAddr);
|
||||
notify = localHandlerPrivate->createNotifyParticipantAdded(frankAddr);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 3, int, "%d");
|
||||
|
|
@ -832,12 +862,16 @@ void send_removed_notify() {
|
|||
|
||||
CallSessionParams params;
|
||||
localConf.addParticipant(bobAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
alice->setAdmin(true);
|
||||
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "conference");
|
||||
string notify = localConf.getEventHandler()->subscribeReceived(lev);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
linphone_event_unref(lev);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
|
||||
|
|
@ -845,7 +879,7 @@ void send_removed_notify() {
|
|||
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
|
||||
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
|
||||
|
||||
notify = localConf.getEventHandler()->notifyParticipantRemoved(bobAddr);
|
||||
notify = localHandlerPrivate->createNotifyParticipantRemoved(bobAddr);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 1, int, "%d");
|
||||
|
|
@ -878,12 +912,15 @@ void send_admined_notify() {
|
|||
|
||||
CallSessionParams params;
|
||||
localConf.addParticipant(bobAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
alice->setAdmin(true);
|
||||
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "conference");
|
||||
string notify = localConf.getEventHandler()->subscribeReceived(lev);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
linphone_event_unref(lev);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
|
||||
|
|
@ -891,7 +928,7 @@ void send_admined_notify() {
|
|||
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
|
||||
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
|
||||
|
||||
notify = localConf.getEventHandler()->notifyParticipantSetAdmin(bobAddr, true);
|
||||
notify = localHandlerPrivate->createNotifyParticipantAdmined(bobAddr, true);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
|
|
@ -925,12 +962,16 @@ void send_unadmined_notify() {
|
|||
|
||||
CallSessionParams params;
|
||||
localConf.addParticipant(bobAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
alice->setAdmin(true);
|
||||
LinphoneEvent *lev = linphone_core_create_notify(pauline->lc, marie->identity, "conference");
|
||||
string notify = localConf.getEventHandler()->subscribeReceived(lev);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
linphone_event_unref(lev);
|
||||
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
BC_ASSERT_TRUE(tester.participants.find(bobAddr.asString()) != tester.participants.end());
|
||||
|
|
@ -938,7 +979,7 @@ void send_unadmined_notify() {
|
|||
BC_ASSERT_TRUE(!tester.participants.find(bobAddr.asString())->second);
|
||||
BC_ASSERT_TRUE(tester.participants.find(aliceAddr.asString())->second);
|
||||
|
||||
notify = localConf.getEventHandler()->notifyParticipantSetAdmin(aliceAddr, false);
|
||||
notify = localHandlerPrivate->createNotifyParticipantAdmined(aliceAddr, false);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
|
|
@ -951,41 +992,6 @@ void send_unadmined_notify() {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void send_subscribe_receive_first_notify() {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
ConferenceEventTester tester(marie->lc, pauline->identity);
|
||||
LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri);
|
||||
LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri);
|
||||
string confId("conf233");
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 1, 1000));
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 1000));
|
||||
|
||||
tester.handler->subscribe(confId);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneSubscriptionIncomingReceived, 1, 1000));
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneSubscriptionActive, 1, 3000));
|
||||
wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_NotifyReceived, 1, 3000);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(bobAddr)) != tester.participants.end());
|
||||
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr)) != tester.participants.end());
|
||||
BC_ASSERT_TRUE(!tester.participants.find(linphone_address_as_string(bobAddr))->second);
|
||||
BC_ASSERT_TRUE(tester.participants.find(linphone_address_as_string(aliceAddr))->second);
|
||||
|
||||
tester.handler->unsubscribe();
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneSubscriptionTerminated, 1, 1000));
|
||||
|
||||
linphone_address_unref(bobAddr);
|
||||
linphone_address_unref(aliceAddr);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
#endif
|
||||
|
||||
test_t conference_event_tests[] = {
|
||||
TEST_NO_TAG("First notify parsing", first_notify_parsing),
|
||||
TEST_NO_TAG("First notify parsing wrong conf", first_notify_parsing_wrong_conf),
|
||||
|
|
@ -999,7 +1005,6 @@ test_t conference_event_tests[] = {
|
|||
TEST_NO_TAG("Send participant removed notify", send_removed_notify),
|
||||
TEST_NO_TAG("Send participant admined notify", send_admined_notify),
|
||||
TEST_NO_TAG("Send participant unadmined notify", send_unadmined_notify)
|
||||
//TEST_NO_TAG("Send subscribe receive first notify", send_subscribe_receive_first_notify)
|
||||
};
|
||||
|
||||
test_suite_t conference_event_test_suite = {
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ void liblinphone_tester_add_suites() {
|
|||
bc_tester_add_suite(&account_creator_test_suite);
|
||||
bc_tester_add_suite(&stun_test_suite);
|
||||
bc_tester_add_suite(&event_test_suite);
|
||||
//bc_tester_add_suite(&conference_event_test_suite);
|
||||
bc_tester_add_suite(&conference_event_test_suite);
|
||||
bc_tester_add_suite(&conference_test_suite);
|
||||
bc_tester_add_suite(&flexisip_test_suite);
|
||||
bc_tester_add_suite(&remote_provisioning_test_suite);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue