summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/network/access')
-rw-r--r--tests/auto/network/access/qnetworkreply/BLACKLIST28
-rw-r--r--tests/auto/network/access/qnetworkreply/test/test.pro3
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp55
3 files changed, 82 insertions, 4 deletions
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST
index 1d56c78bbc..acea0a5aad 100644
--- a/tests/auto/network/access/qnetworkreply/BLACKLIST
+++ b/tests/auto/network/access/qnetworkreply/BLACKLIST
@@ -1,5 +1,7 @@
# See qtbase/src/testlib/qtestblacklist.cpp for format
osx
+[authenticationCacheAfterCancel]
+windows
[ioGetFromBuiltinHttp:http+limited]
ubuntu-14.04
[ioGetFromBuiltinHttp:https+limited]
@@ -8,3 +10,29 @@ ubuntu-14.04
*
[backgroundRequestInterruption:ftp, bg, nobg]
*
+[getErrors:ftp-host]
+linux
+[getFromHttpIntoBuffer]
+windows
+[getFromHttpIntoBuffer2]
+windows
+[headFromHttp]
+windows
+[ioGetFromHttpWithSocksProxy]
+windows
+[ioPostToHttpFromSocket]
+windows
+[ioHttpRedirectMultipartPost]
+linux
+[ioHttpRedirectPolicy]
+b2qt 64bit
+linux
+[ioHttpRedirectPostPut]
+linux
+windows
+[putWithServerClosingConnectionImmediately]
+windows
+[qtbug28035browserDoesNotLoadQtProjectOrgCorrectly]
+windows
+[getFromUnreachableIp]
+windows msvc-2017
diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro
index 0dcf5a250c..1f45ac0c49 100644
--- a/tests/auto/network/access/qnetworkreply/test/test.pro
+++ b/tests/auto/network/access/qnetworkreply/test/test.pro
@@ -13,7 +13,4 @@ RESOURCES += ../qnetworkreply.qrc
TESTDATA += ../empty ../rfc3252.txt ../resource ../bigfile ../*.jpg ../certs \
../index.html ../smb-file.txt
-qtConfig(xcb): CONFIG+=insignificant_test # unstable, QTBUG-21102
-win32:CONFIG += insignificant_test # QTBUG-24226
-
!winrt: TEST_HELPER_INSTALLS = ../echo/echo
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index b6b5f5ae70..5baf4c0870 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -1994,6 +1994,16 @@ void tst_QNetworkReply::getErrors_data()
<< int(QNetworkReply::AuthenticationRequiredError) << 401 << false;
}
+static QByteArray msgGetErrors(int waitResult, const QNetworkReplyPtr &reply)
+{
+ QByteArray result ="waitResult=" + QByteArray::number(waitResult);
+ if (reply->isFinished())
+ result += ", finished";
+ if (reply->error() != QNetworkReply::NoError)
+ result += ", error: " + QByteArray::number(int(reply->error()));
+ return result;
+}
+
void tst_QNetworkReply::getErrors()
{
QFETCH(QString, url);
@@ -2023,7 +2033,8 @@ void tst_QNetworkReply::getErrors()
QCOMPARE(reply->error(), QNetworkReply::NoError);
// now run the request:
- QVERIFY(waitForFinish(reply) != Timeout);
+ const int waitResult = waitForFinish(reply);
+ QVERIFY2(waitResult != Timeout, msgGetErrors(waitResult, reply));
QFETCH(int, error);
QEXPECT_FAIL("ftp-is-dir", "QFtp cannot provide enough detail", Abort);
@@ -6755,6 +6766,48 @@ void tst_QNetworkReply::getFromUnreachableIp()
{
QNetworkAccessManager manager;
+#ifdef Q_OS_WIN32
+ // This test assumes that attempt to connect to 255.255.255.255 fails more
+ // or less fast/immediately. This is not what we observe on Windows x86:
+ // WSAConnect on non-blocking socket returns SOCKET_ERROR, WSAGetLastError
+ // returns WSAEWOULDBLOCK (expected) and getsockopt most of the time returns
+ // NOERROR; so socket engine starts a timer (30 s.) and waits for a timeout/
+ // error/success. Unfortunately, the test itself is waiting only for 5 s.
+ // So we have to adjust the connection timeout or skip the test completely
+ // if the 'bearermanagement' feature is not available.
+#if QT_CONFIG(bearermanagement)
+ class ConfigurationGuard
+ {
+ public:
+ explicit ConfigurationGuard(QNetworkAccessManager *m)
+ : manager(m)
+ {
+ Q_ASSERT(m);
+ auto conf = manager->configuration();
+ previousTimeout = conf.connectTimeout();
+ conf.setConnectTimeout(1500);
+ manager->setConfiguration(conf);
+ }
+ ~ConfigurationGuard()
+ {
+ Q_ASSERT(manager);
+ auto conf = manager->configuration();
+ conf.setConnectTimeout(previousTimeout);
+ manager->setConfiguration(conf);
+ }
+ private:
+ QNetworkAccessManager *manager = nullptr;
+ int previousTimeout = 0;
+
+ Q_DISABLE_COPY(ConfigurationGuard)
+ };
+
+ const ConfigurationGuard restorer(&manager);
+#else // bearermanagement
+ QSKIP("This test is non-deterministic on Windows x86");
+#endif // !bearermanagement
+#endif // Q_OS_WIN32
+
QNetworkRequest request(QUrl("http://255.255.255.255/42/23/narf/narf/narf"));
QNetworkReplyPtr reply(manager.get(request));