MCPcopy Create free account
hub / github.com/KDAB/GammaRay / testMultipleConnection

Method testMultipleConnection

tests/clientconnectiontest.cpp:83–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 }
82
83 void testMultipleConnection()
84 {
85 ClientConnectionManager connector(nullptr, false);
86 QSignalSpy spyReady(&connector, &ClientConnectionManager::ready);
87 QSignalSpy spyError(&connector, &ClientConnectionManager::persistentConnectionError);
88 QSignalSpy spyDisconnected(&connector, &ClientConnectionManager::disconnected);
89
90 QVERIFY(spyReady.isValid());
91 QVERIFY(spyError.isValid());
92 QVERIFY(spyDisconnected.isValid());
93
94 for (int i = 0; i < 5; ++i) {
95 qWarning("Phase: #%i", i);
96
97 spyReady.clear();
98 spyError.clear();
99 spyDisconnected.clear();
100
101 connector.connectToHost(m_serverUrl);
102
103 int loops = 0;
104 while (loops++ < (30000 / 10)) {
105 QTest::qWait(10);
106
107 if (!spyReady.isEmpty()
108 || !spyError.isEmpty()
109 || !spyDisconnected.isEmpty()) {
110 break;
111 }
112 }
113
114 QVERIFY(spyReady.size() == 1);
115 QVERIFY(Endpoint::isConnected());
116 QCOMPARE(m_process.processId(), Endpoint::instance()->pid());
117 QVERIFY(spyError.isEmpty());
118 QVERIFY(spyDisconnected.isEmpty());
119
120 connector.disconnectFromHost();
121 QTest::qWait(1);
122
123 QVERIFY(spyDisconnected.size() == 1);
124 QVERIFY(!Endpoint::isConnected());
125 }
126 }
127
128 void cleanupTestCase()
129 {

Callers

nothing calls this directly

Calls 7

isValidMethod · 0.45
clearMethod · 0.45
connectToHostMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45
pidMethod · 0.45
disconnectFromHostMethod · 0.45

Tested by

no test coverage detected