diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qftp/tst_qftp.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qhostinfo/tst_qhostinfo.cpp | 11 | ||||
-rw-r--r-- | tests/benchmarks/network/kernel/qhostinfo/main.cpp | 24 |
3 files changed, 31 insertions, 6 deletions
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 240885d..638c810 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -308,7 +308,7 @@ void tst_QFtp::connectToUnresponsiveHost() if (setProxy) QSKIP( "This test takes too long if we test with proxies too", SkipSingle ); - QString host = "1.2.3.4"; + QString host = "192.0.2.42"; // IP out of TEST-NET, should be unreachable uint port = 21; ftp = newFtp(); diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index cbadcf5..4282062 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -213,8 +213,8 @@ void tst_QHostInfo::initTestCase() // run each testcase with and without test enabled QTest::addColumn<bool>("cache"); - QTest::newRow("WithCache") << false; - QTest::newRow("WithoutCache") << true; + QTest::newRow("WithCache") << true; + QTest::newRow("WithoutCache") << false; } void tst_QHostInfo::init() @@ -484,7 +484,8 @@ void tst_QHostInfo::cache() // lookup once, wait in event loop, result should not come directly. bool valid = true; - QHostInfo result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid); + int id = -1; + QHostInfo result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid, &id); QTestEventLoop::instance().enterLoop(5); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(valid == false); @@ -492,7 +493,7 @@ void tst_QHostInfo::cache() // loopkup second time, result should come directly valid = false; - result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid); + result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid, &id); QVERIFY(valid == true); QVERIFY(!result.addresses().isEmpty()); @@ -501,7 +502,7 @@ void tst_QHostInfo::cache() // lookup third time, result should not come directly. valid = true; - result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid); + result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid, &id); QTestEventLoop::instance().enterLoop(5); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(valid == false); diff --git a/tests/benchmarks/network/kernel/qhostinfo/main.cpp b/tests/benchmarks/network/kernel/qhostinfo/main.cpp index 0ae1b7f..f4648d6 100644 --- a/tests/benchmarks/network/kernel/qhostinfo/main.cpp +++ b/tests/benchmarks/network/kernel/qhostinfo/main.cpp @@ -48,10 +48,15 @@ #include <qtest.h> #include <qtesteventloop.h> +#include "private/qhostinfo_p.h" + class tst_qhostinfo : public QObject { Q_OBJECT +public slots: + void init(); private slots: + void lookupSpeed_data(); void lookupSpeed(); }; @@ -70,14 +75,33 @@ public slots: } }; +void tst_qhostinfo::init() +{ + // delete the cache so inidividual testcase results are independant from each other + qt_qhostinfo_clear_cache(); +} + +void tst_qhostinfo::lookupSpeed_data() +{ + QTest::addColumn<bool>("cache"); + QTest::newRow("WithCache") << true; + QTest::newRow("WithoutCache") << false; +} + void tst_qhostinfo::lookupSpeed() { + QFETCH(bool, cache); + qt_qhostinfo_enable_cache(cache); + QStringList hostnameList; hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no" << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com" << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----"; // also add some duplicates: hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com"; + // and some more + hostnameList << hostnameList; + const int COUNT = hostnameList.size(); SignalReceiver receiver(COUNT); |