Tests: Remove duplicate QTRY_VERIFY/QTRY_COMPARE macros in bearer.
Introduce QTRY_VERIFY_WITH_TIMEOUT and QTRY_COMPARE_WITH_TIMEOUT to be able to specify a timeout value. Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Change-Id: Iaeaa4938eb14f2c431537055f626510cba183ce3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
00d4b15112
commit
dc5ea80963
6
dist/changes-5.0.0
vendored
6
dist/changes-5.0.0
vendored
@ -35,7 +35,7 @@ information about a particular change.
|
||||
|
||||
- QCoreApplication::translate() will no longer return the source text when
|
||||
the translation is empty. Use lrelease -removeidentical for optimization.
|
||||
|
||||
|
||||
- Qt::escape() is deprecated (but can be enabled via
|
||||
QT_DISABLE_DEPRECATED_BEFORE), use QString::toHtmlEscaped() instead.
|
||||
|
||||
@ -44,7 +44,9 @@ information about a particular change.
|
||||
- QTestLib:
|
||||
* The QTRY_VERIFY and QTRY_COMPARE macros have been moved into QTestLib.
|
||||
These macros formerly lived in tests/shared/util.h but are now provided
|
||||
by including the <QtTest/QtTest> header.
|
||||
by including the <QtTest/QtTest> header. In addition,
|
||||
QTRY_VERIFY_WITH_TIMEOUT and QTRY_COMPARE_WITH_TIMEOUT are provided,
|
||||
allowing for specifying custom timeout values.
|
||||
* The QTEST_NOOP_MAIN macro has been removed from the API. If a test is
|
||||
known at compile-time to be inapplicable for a particular build it should
|
||||
be omitted via .pro file logic, or the test should call QSKIP in the
|
||||
|
@ -160,40 +160,61 @@ QT_BEGIN_NAMESPACE
|
||||
\sa QVERIFY(), QTRY_COMPARE(), QTest::toString()
|
||||
*/
|
||||
|
||||
/*! \macro QTRY_VERIFY(condition)
|
||||
/*! \macro QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)
|
||||
|
||||
\relates QTest
|
||||
|
||||
The QTRY_VERIFY() macro is similar to QVERIFY(), but checks the \a condition
|
||||
repeatedly, until either the condition becomes true or a maximum timeout is
|
||||
The QTRY_VERIFY_WITH_TIMEOUT() macro is similar to QVERIFY(), but checks the \a condition
|
||||
repeatedly, until either the condition becomes true or the \a timeout is
|
||||
reached. Between each evaluation, events will be processed. If the timeout
|
||||
is reached, a failure is recorded in the test log and the test won't be
|
||||
executed further.
|
||||
|
||||
The timeout is fixed at five seconds.
|
||||
\note This macro can only be used in a test function that is invoked
|
||||
by the test framework.
|
||||
|
||||
\sa QTRY_VERIFY(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
|
||||
*/
|
||||
|
||||
|
||||
/*! \macro QTRY_VERIFY(condition)
|
||||
|
||||
\relates QTest
|
||||
|
||||
Invokes QTRY_VERIFY_WITH_TIMEOUT() with a timeout of five seconds.
|
||||
|
||||
\note This macro can only be used in a test function that is invoked
|
||||
by the test framework.
|
||||
|
||||
\sa QVERIFY(), QCOMPARE(), QTRY_COMPARE()
|
||||
\sa QTRY_VERIFY_WITH_TIMEOUT(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
|
||||
*/
|
||||
|
||||
/*! \macro QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)
|
||||
|
||||
\relates QTest
|
||||
|
||||
The QTRY_COMPARE_WITH_TIMEOUT() macro is similar to QCOMPARE(), but performs the comparison
|
||||
of the \a actual and \a expected values repeatedly, until either the two values
|
||||
are equal or the \a timeout is reached. Between each comparison, events
|
||||
will be processed. If the timeout is reached, a failure is recorded in the
|
||||
test log and the test won't be executed further.
|
||||
|
||||
\note This macro can only be used in a test function that is invoked
|
||||
by the test framework.
|
||||
|
||||
\sa QTRY_COMPARE(), QCOMPARE(), QVERIFY(), QTRY_VERIFY()
|
||||
*/
|
||||
|
||||
/*! \macro QTRY_COMPARE(actual, expected)
|
||||
|
||||
\relates QTest
|
||||
|
||||
The QTRY_COMPARE() macro is similar to QCOMPARE(), but performs the comparison
|
||||
of the \a actual and \a expected values repeatedly, until either the two values
|
||||
are equal or a maximum timeout is reached. Between each comparison, events
|
||||
will be processed. If the timeout is reached, a failure is recorded in the
|
||||
test log and the test won't be executed further.
|
||||
|
||||
The timeout is fixed at five seconds.
|
||||
Invokes QTRY_COMPARE_WITH_TIMEOUT() with a timeout of five seconds.
|
||||
|
||||
\note This macro can only be used in a test function that is invoked
|
||||
by the test framework.
|
||||
|
||||
\sa QCOMPARE(), QVERIFY(), QTRY_VERIFY()
|
||||
\sa QTRY_COMPARE_WITH_TIMEOUT(), QCOMPARE(), QVERIFY(), QTRY_VERIFY()
|
||||
*/
|
||||
|
||||
/*! \macro QFETCH(type, name)
|
||||
|
@ -86,33 +86,37 @@ do {\
|
||||
} while (0)
|
||||
|
||||
// Will try to wait for the expression to become true while allowing event processing
|
||||
#define QTRY_VERIFY(__expr) \
|
||||
#define QTRY_VERIFY_WITH_TIMEOUT(__expr, __timeout) \
|
||||
do { \
|
||||
const int __step = 50; \
|
||||
const int __timeout = 5000; \
|
||||
const int __timeoutValue = __timeout; \
|
||||
if (!(__expr)) { \
|
||||
QTest::qWait(0); \
|
||||
} \
|
||||
for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
|
||||
for (int __i = 0; __i < __timeoutValue && !(__expr); __i+=__step) { \
|
||||
QTest::qWait(__step); \
|
||||
} \
|
||||
QVERIFY(__expr); \
|
||||
} while (0)
|
||||
|
||||
#define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT(__expr, 5000)
|
||||
|
||||
// Will try to wait for the comparison to become successful while allowing event processing
|
||||
#define QTRY_COMPARE(__expr, __expected) \
|
||||
|
||||
#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
|
||||
do { \
|
||||
const int __step = 50; \
|
||||
const int __timeout = 5000; \
|
||||
const int __timeoutValue = __timeout; \
|
||||
if ((__expr) != (__expected)) { \
|
||||
QTest::qWait(0); \
|
||||
} \
|
||||
for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
|
||||
for (int __i = 0; __i < __timeoutValue && ((__expr) != (__expected)); __i+=__step) { \
|
||||
QTest::qWait(__step); \
|
||||
} \
|
||||
QCOMPARE(__expr, __expected); \
|
||||
} while (0)
|
||||
|
||||
#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, 5000)
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
#define QSKIP(statement) \
|
||||
|
@ -42,6 +42,10 @@
|
||||
#ifndef QBEARERTESTCOMMON_H
|
||||
#define QBEARERTESTCOMMON_H
|
||||
|
||||
#include <QtTest/qtestcase.h>
|
||||
|
||||
enum { TestTimeOut = 90000 };
|
||||
|
||||
// Wait for __expr to happen, while still allowing events to be processed.
|
||||
#define QTRY_NOOP(__expr) \
|
||||
do { \
|
||||
@ -55,18 +59,4 @@
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
// Will try to wait for the condition while allowing event processing
|
||||
#define QTRY_VERIFY(__expr) \
|
||||
do { \
|
||||
const int __step = 50; \
|
||||
const int __timeout = 90000; \
|
||||
if (!(__expr)) { \
|
||||
QTest::qWait(0); \
|
||||
} \
|
||||
for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
|
||||
QTest::qWait(__step); \
|
||||
} \
|
||||
QVERIFY(__expr); \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
|
@ -121,7 +121,7 @@ void tst_QNetworkConfiguration::comparison()
|
||||
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations(); //initiate scans
|
||||
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
|
||||
|
||||
QList<QNetworkConfiguration> configs = manager.allConfigurations(QNetworkConfiguration::Discovered);
|
||||
QVERIFY(configs.count());
|
||||
@ -168,7 +168,7 @@ void tst_QNetworkConfiguration::isRoamingAvailable()
|
||||
//force update to get maximum list
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations(); //initiate scans
|
||||
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
|
||||
|
||||
foreach(QNetworkConfiguration c, configs)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ void tst_QNetworkConfigurationManager::allConfigurations()
|
||||
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations(); //initiate scans
|
||||
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
|
||||
|
||||
QList<QNetworkConfiguration> configs = manager.allConfigurations();
|
||||
|
||||
@ -153,7 +153,7 @@ void tst_QNetworkConfigurationManager::defaultConfiguration()
|
||||
QNetworkConfigurationManager manager;
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations(); //initiate scans
|
||||
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
|
||||
|
||||
QList<QNetworkConfiguration> configs = manager.allConfigurations();
|
||||
QNetworkConfiguration defaultConfig = manager.defaultConfiguration();
|
||||
@ -183,7 +183,7 @@ void tst_QNetworkConfigurationManager::configurationFromIdentifier()
|
||||
//force an update to get maximum number of configs
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations(); //initiate scans
|
||||
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
|
||||
|
||||
QList<QNetworkConfiguration> configs = manager.allConfigurations();
|
||||
|
||||
@ -211,7 +211,7 @@ protected:
|
||||
preScanConfigs = manager.allConfigurations();
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations(); //initiate scans
|
||||
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
|
||||
configs = manager.allConfigurations();
|
||||
}
|
||||
public:
|
||||
@ -228,7 +228,7 @@ void tst_QNetworkConfigurationManager::usedInThread()
|
||||
QNCMTestThread thread;
|
||||
connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
thread.start();
|
||||
QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY could take ~90 seconds to time out in the thread
|
||||
QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY_WITH_TIMEOUT could take ~90 seconds to time out in the thread
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
qDebug() << "prescan:" << thread.preScanConfigs.count();
|
||||
qDebug() << "postscan:" << thread.configs.count();
|
||||
@ -237,7 +237,7 @@ void tst_QNetworkConfigurationManager::usedInThread()
|
||||
QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations(); //initiate scans
|
||||
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
|
||||
QList<QNetworkConfiguration> configs = manager.allConfigurations();
|
||||
QCOMPARE(thread.configs, configs);
|
||||
//Don't compare pre scan configs, because these may be cached and therefore give different results
|
||||
|
@ -110,7 +110,7 @@ void tst_QNetworkSession::initTestCase()
|
||||
|
||||
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
|
||||
manager.updateConfigurations();
|
||||
QTRY_VERIFY(spy.count() == 1);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut);
|
||||
}
|
||||
|
||||
void tst_QNetworkSession::cleanupTestCase()
|
||||
@ -172,7 +172,7 @@ void tst_QNetworkSession::sessionClosing()
|
||||
session.close();
|
||||
// Sooner or later session must end in Disconnected state,
|
||||
// no matter what the phase was.
|
||||
QTRY_VERIFY(session.state() == QNetworkSession::Disconnected);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session.state() == QNetworkSession::Disconnected, TestTimeOut);
|
||||
QTest::qWait(200); // Give platform a breathe, otherwise we'll be catching other errors
|
||||
}
|
||||
}
|
||||
@ -420,7 +420,7 @@ void tst_QNetworkSession::userChoiceSession()
|
||||
QVERIFY(errorSpy.isEmpty());
|
||||
|
||||
if (expectStateChange)
|
||||
QTRY_VERIFY(!stateChangedSpy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!stateChangedSpy.isEmpty(), TestTimeOut);
|
||||
|
||||
QVERIFY(session.state() == QNetworkSession::Connected);
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
@ -524,7 +524,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
|
||||
// Wait until the configuration is uptodate as well, it may be signaled 'connected'
|
||||
// bit later than the session
|
||||
QTRY_VERIFY(configuration.state() == QNetworkConfiguration::Active);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(configuration.state() == QNetworkConfiguration::Active, TestTimeOut);
|
||||
|
||||
if (session.isOpen())
|
||||
QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty());
|
||||
@ -558,7 +558,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
QVERIFY(errorSpy.isEmpty());
|
||||
|
||||
if (expectStateChange) {
|
||||
QTRY_VERIFY(stateChangedSpy.count() >= 2);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(stateChangedSpy.count() >= 2, TestTimeOut);
|
||||
|
||||
QNetworkSession::State state =
|
||||
qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(0).at(0));
|
||||
@ -598,7 +598,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
|
||||
session2.open();
|
||||
|
||||
QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty(), TestTimeOut);
|
||||
|
||||
if (errorSpy2.isEmpty()) {
|
||||
QVERIFY(session2.isOpen());
|
||||
@ -625,13 +625,13 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
|
||||
// QNetworkSession::stop() must result either closed() signal
|
||||
// or error() signal
|
||||
QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty(), TestTimeOut);
|
||||
QVERIFY(!session2.isOpen());
|
||||
|
||||
if (!errorSpy2.isEmpty()) {
|
||||
// QNetworkSession::stop() resulted error() signal for session2
|
||||
// => also session should emit error() signal
|
||||
QTRY_VERIFY(!errorSpy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), TestTimeOut);
|
||||
|
||||
// check for SessionAbortedError
|
||||
QNetworkSession::SessionError error =
|
||||
@ -656,7 +656,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
QTRY_NOOP(session2.state() == QNetworkSession::Disconnected);
|
||||
|
||||
if (expectStateChange)
|
||||
QTRY_VERIFY(stateChangedSpy2.count() >= 1 || !errorSpy2.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(stateChangedSpy2.count() >= 1 || !errorSpy2.isEmpty(), TestTimeOut);
|
||||
|
||||
if (!errorSpy2.isEmpty()) {
|
||||
QVERIFY(session2.state() == previousState);
|
||||
@ -708,11 +708,11 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
QFAIL("Unexpected amount of state changes when roaming.");
|
||||
}
|
||||
|
||||
QTRY_VERIFY(session.state() == QNetworkSession::Roaming ||
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session.state() == QNetworkSession::Roaming ||
|
||||
session.state() == QNetworkSession::Connected ||
|
||||
session.state() == QNetworkSession::Disconnected);
|
||||
session.state() == QNetworkSession::Disconnected, TestTimeOut);
|
||||
|
||||
QTRY_VERIFY(stateChangedSpy.count() > 0);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(stateChangedSpy.count() > 0, TestTimeOut);
|
||||
state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 1).at(0));
|
||||
|
||||
for (int i = 0; i < stateChangedSpy.count(); i++) {
|
||||
@ -723,19 +723,19 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
}
|
||||
|
||||
if (state == QNetworkSession::Roaming) {
|
||||
QTRY_VERIFY(session.state() == QNetworkSession::Connected);
|
||||
QTRY_VERIFY(session2.state() == QNetworkSession::Connected);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session.state() == QNetworkSession::Connected, TestTimeOut);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session2.state() == QNetworkSession::Connected, TestTimeOut);
|
||||
roamedSuccessfully = true;
|
||||
} else if (state == QNetworkSession::Closing) {
|
||||
QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected);
|
||||
QTRY_VERIFY(session.state() == QNetworkSession::Connected ||
|
||||
session.state() == QNetworkSession::Disconnected);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session2.state() == QNetworkSession::Disconnected, TestTimeOut);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session.state() == QNetworkSession::Connected ||
|
||||
session.state() == QNetworkSession::Disconnected, TestTimeOut );
|
||||
roamedSuccessfully = false;
|
||||
} else if (state == QNetworkSession::Disconnected) {
|
||||
QTRY_VERIFY(!errorSpy.isEmpty());
|
||||
QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), TestTimeOut);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session2.state() == QNetworkSession::Disconnected, TestTimeOut);
|
||||
} else if (state == QNetworkSession::Connected) {
|
||||
QTRY_VERIFY(errorSpy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(errorSpy.isEmpty(),TestTimeOut);
|
||||
|
||||
if (stateChangedSpy.count() > 1) {
|
||||
state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 2).at(0));
|
||||
@ -757,7 +757,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
if (session.isOpen())
|
||||
QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty());
|
||||
session.stop();
|
||||
QTRY_VERIFY(session.state() == QNetworkSession::Disconnected);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session.state() == QNetworkSession::Disconnected, TestTimeOut);
|
||||
}
|
||||
if (!roamedSuccessfully)
|
||||
QVERIFY(!errorSpy.isEmpty());
|
||||
@ -786,8 +786,8 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
}
|
||||
}
|
||||
|
||||
QTRY_VERIFY(!sessionClosedSpy.isEmpty());
|
||||
QTRY_VERIFY(session.state() == QNetworkSession::Disconnected);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!sessionClosedSpy.isEmpty(), TestTimeOut);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session.state() == QNetworkSession::Disconnected, TestTimeOut);
|
||||
}
|
||||
|
||||
QVERIFY(errorSpy2.isEmpty());
|
||||
@ -808,7 +808,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
int stateChangedCountBeforeClose = stateChangedSpy2.count();
|
||||
session2.close();
|
||||
|
||||
QTRY_VERIFY(!sessionClosedSpy2.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!sessionClosedSpy2.isEmpty(), TestTimeOut);
|
||||
QVERIFY(stateChangedSpy2.count() == stateChangedCountBeforeClose);
|
||||
|
||||
QVERIFY(sessionClosedSpy.isEmpty());
|
||||
@ -833,12 +833,12 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
|
||||
session.close();
|
||||
|
||||
QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty(), TestTimeOut);
|
||||
|
||||
QVERIFY(!session.isOpen());
|
||||
|
||||
if (expectStateChange)
|
||||
QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty(), TestTimeOut);
|
||||
|
||||
if (!errorSpy.isEmpty()) {
|
||||
QNetworkSession::SessionError error =
|
||||
@ -867,7 +867,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
|
||||
QVERIFY(errorSpy.isEmpty());
|
||||
|
||||
if (expectStateChange)
|
||||
QTRY_VERIFY(session.state() == QNetworkSession::Disconnected);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(session.state() == QNetworkSession::Disconnected, TestTimeOut);
|
||||
|
||||
++inProcessSessionManagementCount;
|
||||
} else {
|
||||
@ -929,7 +929,7 @@ void tst_QNetworkSession::outOfProcessSession()
|
||||
QNetworkConfiguration changed;
|
||||
|
||||
do {
|
||||
QTRY_VERIFY(!spy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty(), TestTimeOut);
|
||||
changed = qvariant_cast<QNetworkConfiguration>(spy.takeFirst().at(0));
|
||||
} while (changed.identifier() != identifier);
|
||||
|
||||
@ -949,7 +949,7 @@ void tst_QNetworkSession::outOfProcessSession()
|
||||
oopSocket->waitForBytesWritten();
|
||||
|
||||
do {
|
||||
QTRY_VERIFY(!spy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty(), TestTimeOut);
|
||||
|
||||
changed = qvariant_cast<QNetworkConfiguration>(spy.takeFirst().at(0));
|
||||
} while (changed.identifier() != identifier);
|
||||
@ -1236,7 +1236,7 @@ void tst_QNetworkSession::sessionAutoClose()
|
||||
// set session to auto close at next polling interval.
|
||||
session.setSessionProperty(QLatin1String("AutoCloseSessionTimeout"), 0);
|
||||
|
||||
QTRY_VERIFY(!closeSpy.isEmpty());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!closeSpy.isEmpty(), TestTimeOut);
|
||||
|
||||
QCOMPARE(session.state(), QNetworkSession::Connected);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user