diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 13:00:36 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 13:00:36 +0100 |
commit | 2eb26c170920d28213b71e549d5dac4663febb14 (patch) | |
tree | 8df5223ac114d758c2112a8fc787992175556418 /tests/auto/network | |
parent | 49ddae28e0dcd1c59dd5d742cffedd5290d1224a (diff) | |
parent | 81998b4e8e440076bd22a9164f0a93481c0e597a (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
src/gui/text/qfontdatabase.cpp
Change-Id: I6ac1f55faa22b8e7b591386fb67f0333d0ea443d
Diffstat (limited to 'tests/auto/network')
3 files changed, 57 insertions, 12 deletions
diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index a6d75390c3..a2f1668ef5 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -55,6 +55,7 @@ public slots: void init(); void cleanup(); void accessAfterRemoveReadyReadSlot(); + void setCookieHeaderMetaDataChangedSlot(); private slots: void qnetworkdiskcache_data(); @@ -68,6 +69,7 @@ private slots: void metaData(); void remove(); void accessAfterRemove(); // QTBUG-17400 + void setCookieHeader(); // QTBUG-41514 void setCacheDirectory_data(); void setCacheDirectory(); void updateMetaData(); @@ -86,8 +88,9 @@ private slots: private: QTemporaryDir tempDir; - QUrl url; // used by accessAfterRemove() + QUrl url; // used by accessAfterRemove(), setCookieHeader() QNetworkDiskCache *diskCache; // used by accessAfterRemove() + QNetworkAccessManager *manager; // used by setCookieHeader() }; // FIXME same as in tst_qnetworkreply.cpp .. could be unified @@ -403,6 +406,40 @@ void tst_QNetworkDiskCache::accessAfterRemoveReadyReadSlot() diskCache->remove(url); // this used to cause a crash later on } +void tst_QNetworkDiskCache::setCookieHeader() // QTBUG-41514 +{ + SubQNetworkDiskCache *cache = new SubQNetworkDiskCache(); + url = QUrl("http://www.foo.com/cookieTest.html"); + QNetworkCacheMetaData metaData; + metaData.setUrl(url); + + QNetworkCacheMetaData::RawHeaderList headers; + headers.append(QNetworkCacheMetaData::RawHeader("Set-Cookie", "aaa=bbb")); + metaData.setRawHeaders(headers); + metaData.setSaveToDisk(true); + cache->setupWithOne(tempDir.path(), url, metaData); + + manager = new QNetworkAccessManager(); + manager->setCache(cache); + + QNetworkRequest request(url); + QNetworkReply *reply = manager->get(request); + connect(reply, SIGNAL(metaDataChanged()), this, SLOT(setCookieHeaderMetaDataChangedSlot())); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + + reply->deleteLater(); + manager->deleteLater(); +} + +void tst_QNetworkDiskCache::setCookieHeaderMetaDataChangedSlot() +{ + QList<QNetworkCookie> actualCookieJar = manager->cookieJar()->cookiesForUrl(url); + QVERIFY(!actualCookieJar.empty()); +} + void tst_QNetworkDiskCache::setCacheDirectory_data() { QTest::addColumn<QString>("cacheDir"); diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp index d3ff95a26d..1e0d9555dd 100644 --- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp @@ -271,7 +271,11 @@ void tst_QNetworkSession::sessionProperties() << QLatin1String("WCDMA") << QLatin1String("HSPA") << QLatin1String("Bluetooth") - << QLatin1String("WiMAX"); + << QLatin1String("WiMAX") + << QLatin1String("BearerEVDO") + << QLatin1String("BearerLTE") + << QLatin1String("Bearer3G") + << QLatin1String("Bearer4G"); if (!configuration.isValid()) { QVERIFY(configuration.bearerTypeName().isEmpty()); @@ -1022,7 +1026,11 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur if (config.bearerTypeName() != "2G" && config.bearerTypeName() != "CDMA2000" && config.bearerTypeName() != "WCDMA" && - config.bearerTypeName() != "HSPA") { + config.bearerTypeName() != "HSPA" && + config.bearerTypeName() != "EVDO" && + config.bearerTypeName() != "LTE" && + config.bearerTypeName() != "3G" && + config.bearerTypeName() != "4G") { // qDebug() << "Dumping config because bearer mismatches (cellular): " << config.name(); discoveredConfigs.removeOne(config); } diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 6e915f89fb..aa954429de 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -1088,7 +1088,7 @@ void tst_QSslSocket::protocolServerSide_data() #endif QTest::newRow("ssl3-tls1.0") << QSsl::SslV3 << QSsl::TlsV1_0 << false; QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true; - QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << true; + QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << false; #ifndef OPENSSL_NO_SSL2 QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a // numerical IP, so OpenSSL will send a SSL 2 handshake @@ -1120,7 +1120,7 @@ void tst_QSslSocket::protocolServerSide_data() #ifndef OPENSSL_NO_SSL2 QTest::newRow("secure-ssl2") << QSsl::SecureProtocols << QSsl::SslV2 << false; #endif - QTest::newRow("secure-ssl3") << QSsl::SecureProtocols << QSsl::SslV3 << true; + QTest::newRow("secure-ssl3") << QSsl::SecureProtocols << QSsl::SslV3 << false; QTest::newRow("secure-tls1.0") << QSsl::SecureProtocols << QSsl::TlsV1_0 << true; QTest::newRow("secure-tls1ssl3") << QSsl::SecureProtocols << QSsl::TlsV1SslV3 << true; QTest::newRow("secure-any") << QSsl::SecureProtocols << QSsl::AnyProtocol << true; @@ -2300,28 +2300,28 @@ void tst_QSslSocket::sslOptions() #ifdef SSL_OP_NO_COMPRESSION QCOMPARE(QSslSocketBackendPrivate::setupOpenSslOptions(QSsl::SecureProtocols, QSslConfigurationPrivate::defaultSslOptions), - long(SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_COMPRESSION)); + long(SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_COMPRESSION)); #else QCOMPARE(QSslSocketBackendPrivate::setupOpenSslOptions(QSsl::SecureProtocols, QSslConfigurationPrivate::defaultSslOptions), - long(SSL_OP_ALL|SSL_OP_NO_SSLv2)); + long(SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3)); #endif QCOMPARE(QSslSocketBackendPrivate::setupOpenSslOptions(QSsl::SecureProtocols, QSsl::SslOptionDisableEmptyFragments |QSsl::SslOptionDisableLegacyRenegotiation), - long(SSL_OP_ALL|SSL_OP_NO_SSLv2)); + long(SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3)); #ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION QCOMPARE(QSslSocketBackendPrivate::setupOpenSslOptions(QSsl::SecureProtocols, QSsl::SslOptionDisableEmptyFragments), - long((SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))); + long((SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))); #endif #ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS QCOMPARE(QSslSocketBackendPrivate::setupOpenSslOptions(QSsl::SecureProtocols, QSsl::SslOptionDisableLegacyRenegotiation), - long((SSL_OP_ALL|SSL_OP_NO_SSLv2) & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)); + long((SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3) & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)); #endif #ifdef SSL_OP_NO_TICKET @@ -2329,7 +2329,7 @@ void tst_QSslSocket::sslOptions() QSsl::SslOptionDisableEmptyFragments |QSsl::SslOptionDisableLegacyRenegotiation |QSsl::SslOptionDisableSessionTickets), - long((SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_TICKET))); + long((SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TICKET))); #endif #ifdef SSL_OP_NO_TICKET @@ -2339,7 +2339,7 @@ void tst_QSslSocket::sslOptions() |QSsl::SslOptionDisableLegacyRenegotiation |QSsl::SslOptionDisableSessionTickets |QSsl::SslOptionDisableCompression), - long((SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_TICKET|SSL_OP_NO_COMPRESSION))); + long((SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TICKET|SSL_OP_NO_COMPRESSION))); #endif #endif } |