summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRichard Moore <rich@kde.org>2013-02-10 17:06:34 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-19 21:37:32 +0100
commit5ebc8d3663df5860f13ec9fe0bf4cce1cb37111b (patch)
tree3f953c8f37728cd6eaf001428fe9c6c54d160c9b /tests
parent7898080ca78ceec15163976390979631fcbd178d (diff)
Add an encrypted() signal to QNetworkAccessManager and QNetworkReply.
Add an encrypted signal to QNAM and QNetworkReply to allow applications to perform additional checks on the certificate chain beyond those done as part of the standard SSL validation. This allows things like certificate change notification to be implemented for QNAM as they can be for QSSLSocket currently. Change-Id: I693e3e6fec8b7040379b7e7f1f819550e6b2617f Reviewed-by: Peter Hartmann <phartmann@rim.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 4847dedac4..bcc0641973 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -361,6 +361,7 @@ private Q_SLOTS:
void ignoreSslErrorsList();
void ignoreSslErrorsListWithSlot_data();
void ignoreSslErrorsListWithSlot();
+ void encrypted();
void sslConfiguration_data();
void sslConfiguration();
#ifdef QT_BUILD_INTERNAL
@@ -5867,6 +5868,24 @@ void tst_QNetworkReply::sslConfiguration_data()
QTest::newRow("secure") << conf << true;
}
+void tst_QNetworkReply::encrypted()
+{
+ qDebug() << QtNetworkSettings::serverName();
+ QUrl url("https://" + QtNetworkSettings::serverName());
+ QNetworkRequest request(url);
+ QNetworkReply *reply = manager.get(request);
+ reply->ignoreSslErrors();
+
+ QSignalSpy spy(reply, SIGNAL(encrypted()));
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(20);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spy.count(), 1);
+
+ reply->deleteLater();
+}
+
void tst_QNetworkReply::sslConfiguration()
{
QNetworkRequest request(QUrl("https://" + QtNetworkSettings::serverName() + "/index.html"));