1
#ifndef _TelepathyQt_tests_lib_glib_helpers_test_conn_helper_h_HEADER_GUARD_
2
#define _TelepathyQt_tests_lib_glib_helpers_test_conn_helper_h_HEADER_GUARD_
4
#include <tests/lib/test.h>
6
#include <TelepathyQt/Constants>
7
#include <TelepathyQt/Features>
8
#include <TelepathyQt/Types>
10
#include <glib-object.h>
12
#include <telepathy-glib/telepathy-glib.h>
16
class PendingContacts;
19
class TestConnHelper : public QObject
24
TestConnHelper(Test *parent,
25
GType gType, const QString &account, const QString &protocol);
26
TestConnHelper(Test *parent,
27
GType gType, const char *firstPropertyName, ...);
28
TestConnHelper(Test *parent,
29
const Tp::ChannelFactoryConstPtr &channelFactory,
30
const Tp::ContactFactoryConstPtr &contactFactory,
31
GType gType, const QString &account, const QString &protocol);
32
TestConnHelper(Test *parent,
33
const Tp::ChannelFactoryConstPtr &channelFactory,
34
const Tp::ContactFactoryConstPtr &contactFactory,
35
GType gType, const char *firstPropertyName, ...);
37
virtual ~TestConnHelper();
39
GObject *service() const { return mService; }
40
Tp::ConnectionPtr client() const { return mClient; }
41
QString objectPath() const;
44
bool isReady(const Tp::Features &features = Tp::Features()) const;
45
bool enableFeatures(const Tp::Features &features);
46
bool connect(const Tp::Features &features = Tp::Features());
49
QList<Tp::ContactPtr> contacts(const QStringList &ids,
50
const Tp::Features &features = Tp::Features());
51
QList<Tp::ContactPtr> contacts(const Tp::UIntList &handles,
52
const Tp::Features &features = Tp::Features());
53
QList<Tp::ContactPtr> upgradeContacts(const QList<Tp::ContactPtr> &contacts,
54
const Tp::Features &features = Tp::Features());
56
Tp::ChannelPtr createChannel(const QVariantMap &request);
57
Tp::ChannelPtr createChannel(const QString &channelType, const Tp::ContactPtr &target);
58
Tp::ChannelPtr createChannel(const QString &channelType,
59
Tp::HandleType targetHandleType, uint targetHandle);
60
Tp::ChannelPtr createChannel(const QString &channelType,
61
Tp::HandleType targetHandleType, const QString &targetID);
62
Tp::ChannelPtr ensureChannel(const QVariantMap &request);
63
Tp::ChannelPtr ensureChannel(const QString &channelType, const Tp::ContactPtr &target);
64
Tp::ChannelPtr ensureChannel(const QString &channelType,
65
Tp::HandleType targetHandleType, uint targetHandle);
66
Tp::ChannelPtr ensureChannel(const QString &channelType,
67
Tp::HandleType targetHandleType, const QString &targetID);
70
void expectConnInvalidated();
71
void expectContactsForIdentifiersFinished(Tp::PendingOperation *op);
72
void expectContactsForHandlesFinished(Tp::PendingOperation *op);
73
void expectUpgradeContactsFinished(Tp::PendingOperation *op);
74
void expectCreateChannelFinished(Tp::PendingOperation *op);
75
void expectEnsureChannelFinished(Tp::PendingOperation *op);
78
void init(Test *parent,
79
const Tp::ChannelFactoryConstPtr &channelFactory,
80
const Tp::ContactFactoryConstPtr &contactFactory,
81
GType gType, const char *firstPropertyName, ...);
82
void init(Test *parent,
83
const Tp::ChannelFactoryConstPtr &channelFactory,
84
const Tp::ContactFactoryConstPtr &contactFactory,
85
GType gType, const char *firstPropertyName, va_list varArgs);
87
void expectPendingContactsFinished(Tp::PendingContacts *pc);
92
Tp::ConnectionPtr mClient;
94
// The property retrieved by expectPendingContactsFinished()
95
QList<Tp::ContactPtr> mContacts;
96
// Property used by expectPendingContactsFinished()
97
Tp::Features mContactFeatures;
98
// The property retrieved by expectCreate/EnsureChannelFinished()
99
Tp::ChannelPtr mChannel;
102
#endif // _TelepathyQt_tests_lib_glib_helpers_test_conn_helper_h_HEADER_GUARD_