From dc5ea809634560e836d2847f42f66beb43db7924 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 10 Jan 2012 10:13:55 +0100 Subject: 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 Change-Id: Iaeaa4938eb14f2c431537055f626510cba183ce3 Reviewed-by: Friedemann Kleint --- .../tst_qnetworkconfigurationmanager.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp') diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp index 77e16161e6..7366e0adc1 100644 --- a/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp +++ b/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp @@ -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 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 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 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 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 configs = manager.allConfigurations(); QCOMPARE(thread.configs, configs); //Don't compare pre scan configs, because these may be cached and therefore give different results -- cgit v1.2.3