Convert tst_qabstractnetwork auto-test
to make it work with our new docker-based test server. Change-Id: I76345a2d3d768b8a571f2c85e69f6a21e9a96d7e Reviewed-by: Ryan Chu <ryan.chu@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
8c73ddd8e3
commit
e3f16e7a42
@ -5,3 +5,5 @@ SOURCES += tst_qabstractnetworkcache.cpp
|
|||||||
|
|
||||||
TESTDATA += tests/*
|
TESTDATA += tests/*
|
||||||
|
|
||||||
|
QT_TEST_SERVER_LIST = apache2
|
||||||
|
include($$dirname(_QMAKE_CONF_)/tests/auto/testserver.pri)
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define TESTFILE QLatin1String("http://") + QtNetworkSettings::serverName() + QLatin1String("/qtest/cgi-bin/")
|
#define TESTFILE QLatin1String("http://") + QtNetworkSettings::httpServerName() + QLatin1String("/qtest/cgi-bin/")
|
||||||
|
|
||||||
class tst_QAbstractNetworkCache : public QObject
|
class tst_QAbstractNetworkCache : public QObject
|
||||||
{
|
{
|
||||||
@ -127,8 +127,13 @@ Q_DECLARE_METATYPE(QNetworkRequest::CacheLoadControl)
|
|||||||
|
|
||||||
void tst_QAbstractNetworkCache::initTestCase()
|
void tst_QAbstractNetworkCache::initTestCase()
|
||||||
{
|
{
|
||||||
|
#if defined(QT_TEST_SERVER)
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80));
|
||||||
|
#else
|
||||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||||
QSKIP("No network test server available");
|
QSKIP("No network test server available");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
netConfMan = new QNetworkConfigurationManager(this);
|
netConfMan = new QNetworkConfigurationManager(this);
|
||||||
networkConfiguration = netConfMan->defaultConfiguration();
|
networkConfiguration = netConfMan->defaultConfiguration();
|
||||||
|
7
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_cachecontrol-expire.cgi
vendored
Executable file
7
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_cachecontrol-expire.cgi
vendored
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# cache control takes precedence over expires
|
||||||
|
echo "Cache-Control: max-age=-1"
|
||||||
|
echo "Expires: Mon, 30 Oct 2028 14:19:41 GMT"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
13
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_cachecontrol.cgi
vendored
Executable file
13
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_cachecontrol.cgi
vendored
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ! -z ${HTTP_IF_MODIFIED_SINCE} ] ; then
|
||||||
|
echo "Status: 304"
|
||||||
|
echo ""
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
cc=`echo "${QUERY_STRING}" | sed -e s/%20/\ /g`
|
||||||
|
echo "Cache-Control: $cc"
|
||||||
|
echo "Last-Modified: Sat, 31 Oct 1981 06:00:00 GMT"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
9
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_cachecontrol200.cgi
vendored
Executable file
9
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_cachecontrol200.cgi
vendored
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cc=`echo "${QUERY_STRING}" | sed -e s/%20/\ /g`
|
||||||
|
echo "Status: 200"
|
||||||
|
echo "Cache-Control: $cc"
|
||||||
|
echo "Last-Modified: Sat, 31 Oct 1981 06:00:00 GMT"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo "X-Script: $0"
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
5
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_etag200.cgi
vendored
Executable file
5
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_etag200.cgi
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "ETag: foo"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
11
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_etag304.cgi
vendored
Executable file
11
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_etag304.cgi
vendored
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ! -z ${HTTP_IF_NONE_MATCH} ] ; then
|
||||||
|
echo "Status: 304"
|
||||||
|
echo ""
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "ETag: foo"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
5
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_expires200.cgi
vendored
Executable file
5
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_expires200.cgi
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Expires: Sat, 31 Oct 1981 6:00:00 GMT"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
11
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_expires304.cgi
vendored
Executable file
11
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_expires304.cgi
vendored
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ${HTTP_IF_MODIFIED_SINCE} == "Mon, 30 Oct 2028 14:19:41 GMT" ] ; then
|
||||||
|
echo "Status: 304"
|
||||||
|
echo ""
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Expires: Mon, 30 Oct 2028 14:19:41 GMT"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
5
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_lastModified200.cgi
vendored
Executable file
5
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_lastModified200.cgi
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Last-Modified: Sat, 31 Oct 1981 6:00:00 GMT"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
11
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_lastModified304.cgi
vendored
Executable file
11
tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_lastModified304.cgi
vendored
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ${HTTP_IF_MODIFIED_SINCE} == "Sat, 31 Oct 1981 06:00:00 GMT" ] ; then
|
||||||
|
echo "Status: 304"
|
||||||
|
echo ""
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Last-Modified: Sat, 31 Oct 1981 06:00:00 GMT"
|
||||||
|
echo "Content-type: text/html";
|
||||||
|
echo ""
|
||||||
|
echo "Hello World!"
|
Loading…
x
Reference in New Issue
Block a user