1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#ifndef _TelepathyQt_tests_lib_glib_helpers_test_conn_helper_h_HEADER_GUARD_
#define _TelepathyQt_tests_lib_glib_helpers_test_conn_helper_h_HEADER_GUARD_
#include <tests/lib/test.h>
#include <TelepathyQt/Constants>
#include <TelepathyQt/Features>
#include <TelepathyQt/Types>
#include <glib-object.h>
#include <telepathy-glib/telepathy-glib.h>
namespace Tp
{
class PendingContacts;
}
class TestConnHelper : public QObject
{
Q_OBJECT
public:
TestConnHelper(Test *parent,
GType gType, const QString &account, const QString &protocol);
TestConnHelper(Test *parent,
GType gType, const char *firstPropertyName, ...);
TestConnHelper(Test *parent,
const Tp::ChannelFactoryConstPtr &channelFactory,
const Tp::ContactFactoryConstPtr &contactFactory,
GType gType, const QString &account, const QString &protocol);
TestConnHelper(Test *parent,
const Tp::ChannelFactoryConstPtr &channelFactory,
const Tp::ContactFactoryConstPtr &contactFactory,
GType gType, const char *firstPropertyName, ...);
virtual ~TestConnHelper();
GObject *service() const { return mService; }
Tp::ConnectionPtr client() const { return mClient; }
QString objectPath() const;
bool isValid() const;
bool isReady(const Tp::Features &features = Tp::Features()) const;
bool enableFeatures(const Tp::Features &features);
bool connect(const Tp::Features &features = Tp::Features());
bool disconnect();
QList<Tp::ContactPtr> contacts(const QStringList &ids,
const Tp::Features &features = Tp::Features());
QList<Tp::ContactPtr> contacts(const Tp::UIntList &handles,
const Tp::Features &features = Tp::Features());
QList<Tp::ContactPtr> upgradeContacts(const QList<Tp::ContactPtr> &contacts,
const Tp::Features &features = Tp::Features());
Tp::ChannelPtr createChannel(const QVariantMap &request);
Tp::ChannelPtr createChannel(const QString &channelType, const Tp::ContactPtr &target);
Tp::ChannelPtr createChannel(const QString &channelType,
Tp::HandleType targetHandleType, uint targetHandle);
Tp::ChannelPtr createChannel(const QString &channelType,
Tp::HandleType targetHandleType, const QString &targetID);
Tp::ChannelPtr ensureChannel(const QVariantMap &request);
Tp::ChannelPtr ensureChannel(const QString &channelType, const Tp::ContactPtr &target);
Tp::ChannelPtr ensureChannel(const QString &channelType,
Tp::HandleType targetHandleType, uint targetHandle);
Tp::ChannelPtr ensureChannel(const QString &channelType,
Tp::HandleType targetHandleType, const QString &targetID);
private Q_SLOTS:
void expectConnInvalidated();
void checkFinishedContactsForIdentifiers(Tp::PendingContacts *pc,
const Tp::Features &features);
void expectContactsForHandlesFinished(Tp::PendingOperation *op);
void expectUpgradeContactsFinished(Tp::PendingOperation *op);
void expectCreateChannelFinished(Tp::PendingOperation *op);
void expectEnsureChannelFinished(Tp::PendingOperation *op);
private:
void init(Test *parent,
const Tp::ChannelFactoryConstPtr &channelFactory,
const Tp::ContactFactoryConstPtr &contactFactory,
GType gType, const char *firstPropertyName, ...);
void init(Test *parent,
const Tp::ChannelFactoryConstPtr &channelFactory,
const Tp::ContactFactoryConstPtr &contactFactory,
GType gType, const char *firstPropertyName, va_list varArgs);
void expectPendingContactsFinished(Tp::PendingContacts *pc);
void expectPendingContactsFinished(Tp::PendingContacts *pc, const Tp::Features &features);
Test *mParent;
QEventLoop *mLoop;
GObject *mService;
Tp::ConnectionPtr mClient;
// The property retrieved by expectPendingContactsFinished()
QList<Tp::ContactPtr> mContacts;
// Property used by expectPendingContactsFinished()
Tp::Features mContactFeatures;
// The property retrieved by expectCreate/EnsureChannelFinished()
Tp::ChannelPtr mChannel;
};
#endif // _TelepathyQt_tests_lib_glib_helpers_test_conn_helper_h_HEADER_GUARD_
|