summaryrefslogtreecommitdiffstats
path: root/tests/resourcecommunicationtest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-11 11:55:29 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-11 11:55:29 +0200
commit3a3118e768e1447dc7524328e84b8d7faef81fe1 (patch)
treeaf5582170ed6164fffc9365f34b17bf449c0db40 /tests/resourcecommunicationtest.cpp
parentf9379318d801df204cc50385c5eca1f28e91755e (diff)
parentce2fd2666f084eebe443598f6f3740a02913091e (diff)
downloadsink-3a3118e768e1447dc7524328e84b8d7faef81fe1.tar.gz
sink-3a3118e768e1447dc7524328e84b8d7faef81fe1.zip
Merge branch 'feature/notifications' into develop
Diffstat (limited to 'tests/resourcecommunicationtest.cpp')
-rw-r--r--tests/resourcecommunicationtest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/resourcecommunicationtest.cpp b/tests/resourcecommunicationtest.cpp
index 2874457..1530f63 100644
--- a/tests/resourcecommunicationtest.cpp
+++ b/tests/resourcecommunicationtest.cpp
@@ -92,6 +92,26 @@ private slots:
92 QTRY_COMPARE(complete, count); 92 QTRY_COMPARE(complete, count);
93 QVERIFY(!errors); 93 QVERIFY(!errors);
94 } 94 }
95
96 void testAccessFactory()
97 {
98 const QByteArray resourceIdentifier("test");
99 Listener listener(resourceIdentifier, "");
100 QWeakPointer<Sink::ResourceAccess> weakRef;
101 QTime time;
102 time.start();
103 {
104 auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess(resourceIdentifier, "");
105 weakRef = resourceAccess.toWeakRef();
106 resourceAccess->open();
107 resourceAccess->sendCommand(Sink::Commands::PingCommand).then<void>([resourceAccess]() { qDebug() << "Pind complete"; }).exec();
108 }
109 QVERIFY(weakRef.toStrongRef());
110 QTRY_VERIFY(!weakRef.toStrongRef());
111 qDebug() << "time.elapsed " << time.elapsed();
112 QVERIFY(time.elapsed() < 3500);
113 QVERIFY(time.elapsed() > 2500);
114 }
95}; 115};
96 116
97QTEST_MAIN(ResourceCommunicationTest) 117QTEST_MAIN(ResourceCommunicationTest)