Skip to content

Commit b23f08f

Browse files
committed
Test ssl errors in background thread
1 parent c707df7 commit b23f08f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/src/core/testqgsnetworkaccessmanager.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,28 @@ void TestQgsNetworkAccessManager::fetchBadSsl()
353353
} );
354354
QgsNetworkAccessManager::instance()->get( QNetworkRequest( u ) );
355355

356-
while ( !loaded && !gotSslError )
356+
while ( !loaded && !gotSslError && !gotRequestAboutToBeCreatedSignal )
357357
{
358358
qApp->processEvents();
359359
}
360360

361361
QVERIFY( gotRequestAboutToBeCreatedSignal );
362362

363-
// we don't test for background thread ssl error yet -- that signal isn't thread safe
363+
gotRequestAboutToBeCreatedSignal = false;
364+
loaded = false;
365+
gotSslError = false;
366+
BackgroundRequest *thread = new BackgroundRequest( QNetworkRequest( u ) );
367+
368+
thread->start();
369+
370+
while ( !loaded && !gotSslError && !gotRequestAboutToBeCreatedSignal )
371+
{
372+
qApp->processEvents();
373+
}
374+
QVERIFY( gotRequestAboutToBeCreatedSignal );
375+
thread->exit();
376+
thread->wait();
377+
thread->deleteLater();
364378
}
365379

366380
void TestQgsNetworkAccessManager::fetchTimeout()

0 commit comments

Comments
 (0)