From fe37c2892be1224eaffe68f1c095e59bb2946bc2 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 9 Oct 2017 16:49:38 +0200 Subject: [PATCH] Fix 'Conference event' tester --- src/CMakeLists.txt | 2 + .../local-conference-event-handler-p.h | 51 +++++++ .../local-conference-event-handler.cpp | 30 +--- .../local-conference-event-handler.h | 5 +- .../remote-conference-event-handler-p.h | 40 ++++++ .../remote-conference-event-handler.cpp | 15 +- tester/CMakeLists.txt | 2 +- tester/conference-event-tester.cpp | 133 +++++++++--------- tester/tester.c | 2 +- 9 files changed, 173 insertions(+), 107 deletions(-) create mode 100644 src/conference/local-conference-event-handler-p.h create mode 100644 src/conference/remote-conference-event-handler-p.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8928cc208..080df4c96 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/conference/local-conference-event-handler-p.h b/src/conference/local-conference-event-handler-p.h new file mode 100644 index 000000000..264175c70 --- /dev/null +++ b/src/conference/local-conference-event-handler-p.h @@ -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 + +#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_ diff --git a/src/conference/local-conference-event-handler.cpp b/src/conference/local-conference-event-handler.cpp index 2e216e5c2..8f46293ce 100644 --- a/src/conference/local-conference-event-handler.cpp +++ b/src/conference/local-conference-event-handler.cpp @@ -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); diff --git a/src/conference/local-conference-event-handler.h b/src/conference/local-conference-event-handler.h index 5d5b6dcfe..5568ed171 100644 --- a/src/conference/local-conference-event-handler.h +++ b/src/conference/local-conference-event-handler.h @@ -20,11 +20,8 @@ #ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_H_ #define _LOCAL_CONFERENCE_EVENT_HANDLER_H_ -#include - -#include "linphone/types.h" - #include "address/address.h" +#include "linphone/types.h" #include "object/object.h" LINPHONE_BEGIN_NAMESPACE diff --git a/src/conference/remote-conference-event-handler-p.h b/src/conference/remote-conference-event-handler-p.h new file mode 100644 index 000000000..71c342c42 --- /dev/null +++ b/src/conference/remote-conference-event-handler-p.h @@ -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_ \ No newline at end of file diff --git a/src/conference/remote-conference-event-handler.cpp b/src/conference/remote-conference-event-handler.cpp index 5536bce0e..a409fe1d5 100644 --- a/src/conference/remote-conference-event-handler.cpp +++ b/src/conference/remote-conference-event-handler.cpp @@ -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) diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index bb1a7eec7..e9263093e 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -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 diff --git a/tester/conference-event-tester.cpp b/tester/conference-event-tester.cpp index b88c7cb03..9cd2f8e09 100644 --- a/tester/conference-event-tester.cpp +++ b/tester/conference-event-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 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 alice = localConf.addParticipant(aliceAddr, ¶ms, false); + localConf.addParticipant(aliceAddr, ¶ms, false); + shared_ptr 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(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 alice = localConf.addParticipant(aliceAddr, ¶ms, false); + localConf.addParticipant(aliceAddr, ¶ms, false); + shared_ptr 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(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 alice = localConf.addParticipant(aliceAddr, ¶ms, false); + localConf.addParticipant(aliceAddr, ¶ms, false); + shared_ptr 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(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 alice = localConf.addParticipant(aliceAddr, ¶ms, false); + localConf.addParticipant(aliceAddr, ¶ms, false); + shared_ptr 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(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 alice = localConf.addParticipant(aliceAddr, ¶ms, false); + localConf.addParticipant(aliceAddr, ¶ms, false); + shared_ptr 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(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 = { diff --git a/tester/tester.c b/tester/tester.c index 50be44792..64e5551c7 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -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);