summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkreply
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-04-11 10:48:44 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-04-11 10:48:44 (GMT)
commit1062da14facb7dd10f0928a4c242549d3626f9ba (patch)
tree4462fcaa82b45c47eddcdcb1d89e1cc03de45a85 /tests/auto/qnetworkreply
parent847df81a5680fe4d71196d0afe5e68e41ae49700 (diff)
parentdd60cf7ba8afdf5c84f5793c1e1d08ab18303a74 (diff)
downloadQt-1062da14facb7dd10f0928a4c242549d3626f9ba.zip
Qt-1062da14facb7dd10f0928a4c242549d3626f9ba.tar.gz
Qt-1062da14facb7dd10f0928a4c242549d3626f9ba.tar.bz2
Merge branch 'master' of scm.dev.troll.no:qt/qt-earth-team into symbian-socket-engine
Conflicts: src/s60installs/bwins/QtCoreu.def src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtNetworku.def src/s60installs/eabi/QtCoreu.def src/s60installs/eabi/QtGuiu.def src/s60installs/eabi/QtNetworku.def src/s60installs/eabi/QtOpenVGu.def tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp40
1 files changed, 34 insertions, 6 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 10fce94..146d2f3 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -93,6 +93,7 @@ Q_DECLARE_METATYPE(QNetworkReply::NetworkError)
Q_DECLARE_METATYPE(QBuffer*)
Q_DECLARE_METATYPE(QHttpMultiPart *)
Q_DECLARE_METATYPE(QList<QFile*>) // for multiparts
+Q_DECLARE_METATYPE(QSslConfiguration)
class QNetworkReplyPtr: public QSharedPointer<QNetworkReply>
{
@@ -330,6 +331,8 @@ private Q_SLOTS:
void ignoreSslErrorsList();
void ignoreSslErrorsListWithSlot_data();
void ignoreSslErrorsListWithSlot();
+ void sslConfiguration_data();
+ void sslConfiguration();
#endif
void getAndThenDeleteObject_data();
@@ -4209,14 +4212,8 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress()
// some progress should have been made
QVERIFY(!spy.isEmpty());
QList<QVariant> args = spy.last();
- qDebug() << "tst_QNetworkReply::ioPostToHttpsUploadProgress"
- << args.at(0).toLongLong()
- << sourceFile.size()
- << spy.size();
QVERIFY(args.at(0).toLongLong() > 0);
- // FIXME this is where it messes up
- QEXPECT_FAIL("", "Either the readBufferSize of QSslSocket is broken or we do upload too much. Hm.", Abort);
QVERIFY(args.at(0).toLongLong() != sourceFile.size());
incomingSocket->setReadBufferSize(32*1024);
@@ -5438,6 +5435,37 @@ void tst_QNetworkReply::ignoreSslErrorsListWithSlot()
QCOMPARE(reply->error(), expectedNetworkError);
}
+void tst_QNetworkReply::sslConfiguration_data()
+{
+ QTest::addColumn<QSslConfiguration>("configuration");
+ QTest::addColumn<bool>("works");
+
+ QTest::newRow("empty") << QSslConfiguration() << false;
+ QSslConfiguration conf = QSslConfiguration::defaultConfiguration();
+ QTest::newRow("default") << conf << false; // does not contain test server cert
+ QList<QSslCertificate> testServerCert = QSslCertificate::fromPath(SRCDIR "/certs/qt-test-server-cacert.pem");
+ conf.setCaCertificates(testServerCert);
+ QTest::newRow("set-root-cert") << conf << true;
+ conf.setProtocol(QSsl::SecureProtocols);
+ QTest::newRow("secure") << conf << true;
+}
+
+void tst_QNetworkReply::sslConfiguration()
+{
+ QNetworkRequest request(QUrl("https://" + QtNetworkSettings::serverName() + "/index.html"));
+ QFETCH(QSslConfiguration, configuration);
+ request.setSslConfiguration(configuration);
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QFETCH(bool, works);
+ QNetworkReply::NetworkError expectedError = works ? QNetworkReply::NoError : QNetworkReply::SslHandshakeFailedError;
+ QCOMPARE(reply->error(), expectedError);
+}
+
#endif // QT_NO_OPENSSL
void tst_QNetworkReply::getAndThenDeleteObject_data()