tests/benchmarks/network/kernel/qhostinfo/main.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
--- a/tests/benchmarks/network/kernel/qhostinfo/main.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/tests/benchmarks/network/kernel/qhostinfo/main.cpp	Mon May 03 13:17:34 2010 +0300
@@ -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 @@
     }
 };
 
+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);