summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-10-21 20:07:26 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-10-21 20:07:26 (GMT)
commit26eda5fa33e401a1803b42e6eacf0921ddc6a14e (patch)
tree510cff78e0dcdd8a3b0d70dea9c270b37d8ac57d /tests/benchmarks
parentfad27a3b6f018a0bc3cb261c81aaefc540589585 (diff)
parent58574ea3590fbb28da5be73b983d83f0a8824d00 (diff)
downloadQt-26eda5fa33e401a1803b42e6eacf0921ddc6a14e.zip
Qt-26eda5fa33e401a1803b42e6eacf0921ddc6a14e.tar.gz
Qt-26eda5fa33e401a1803b42e6eacf0921ddc6a14e.tar.bz2
Merge branch '4.5' into 4.6
Conflicts: src/gui/widgets/qmenu_mac.mm tests/benchmarks/benchmarks.pro tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/benchmarks.pro4
-rw-r--r--tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp40
2 files changed, 41 insertions, 3 deletions
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index ad1920b..a63fb41 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -9,8 +9,8 @@ SUBDIRS = containers-associative \
qiodevice \
qpixmap \
blendbench \
- qstring \
- qstringlist \
+ qstring \
+ qstringlist \
qmatrix4x4 \
qnetworkreply \
qobject \
diff --git a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
index 666e4f1..993db52 100644
--- a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
@@ -54,6 +54,10 @@ class tst_qnetworkreply : public QObject
private slots:
void httpLatency();
+#ifndef QT_NO_OPENSSL
+ void echoPerformance_data();
+ void echoPerformance();
+#endif
};
void tst_qnetworkreply::httpLatency()
@@ -69,6 +73,40 @@ void tst_qnetworkreply::httpLatency()
}
}
+#ifndef QT_NO_OPENSSL
+void tst_qnetworkreply::echoPerformance_data()
+{
+ QTest::addColumn<bool>("ssl");
+ QTest::newRow("no_ssl") << false;
+ QTest::newRow("ssl") << true;
+}
+
+void tst_qnetworkreply::echoPerformance()
+{
+ QFETCH(bool, ssl);
+ QNetworkAccessManager manager;
+ QNetworkRequest request(QUrl((ssl ? "https://" : "http://") + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi"));
+
+ QByteArray data;
+ data.resize(1024*1024*10); // 10 MB
+ // init with garbage. needed so ssl cannot compress it in an efficient way.
+ for (int i = 0; i < data.size() / sizeof(int); i++) {
+ int r = qrand();
+ data.data()[i*sizeof(int)] = r;
+ }
+
+ QBENCHMARK{
+ QNetworkReply* reply = manager.post(request, data);
+ connect(reply, SIGNAL(sslErrors( const QList<QSslError> &)), reply, SLOT(ignoreSslErrors()));
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(reply->error() == QNetworkReply::NoError);
+ delete reply;
+ }
+}
+#endif
+
QTEST_MAIN(tst_qnetworkreply)
-#include "main.moc"
+#include "tst_qnetworkreply.moc"