diff options
Diffstat (limited to 'tests/auto/qabstractnetworkcache')
12 files changed, 22 insertions, 8 deletions
diff --git a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro index 11e340d..a57c56f 100644 --- a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += network +QT -= gui SOURCES += tst_qabstractnetworkcache.cpp wince*|symbian: { diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi index 7dc506f..7dc506f 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi index f2edfc1..f2edfc1 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi new file mode 100755 index 0000000..e44d5ed --- /dev/null +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi @@ -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!" diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi index 0966abf..0966abf 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi index 91a4b92..91a4b92 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi index e18ebc8..e18ebc8 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi index 1c7de1c..1c7de1c 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi index 9615c4f..9615c4f 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi index 5dc219b..5dc219b 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi index bdf23be..bdf23be 100644..100755 --- a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index 5ef95cd..04bd432 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -41,7 +41,6 @@ #include <QtTest/QtTest> -#include <QtGui/QtGui> #include <QtNetwork/QtNetwork> #include "../../shared/util.h" #include "../network-settings.h" @@ -83,8 +82,7 @@ public: : QNetworkDiskCache(parent) , gotData(false) { - QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation) - + QLatin1String("/qnetworkdiskcache/"); + QString location = QDir::tempPath() + QLatin1String("/tst_qnetworkdiskcache/"); setCacheDirectory(location); clear(); } @@ -136,7 +134,7 @@ void tst_QAbstractNetworkCache::expires_data() QTest::newRow("200-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_expires200.cgi" << AlwaysFalse; QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_expires200.cgi" << false; QTest::newRow("200-2") << QNetworkRequest::AlwaysCache << "httpcachetest_expires200.cgi" << AlwaysTrue; - QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_expires200.cgi" << true; + QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_expires200.cgi" << false; } void tst_QAbstractNetworkCache::expires() @@ -158,7 +156,7 @@ void tst_QAbstractNetworkCache::lastModified_data() QTest::newRow("200-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_lastModified200.cgi" << AlwaysFalse; QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_lastModified200.cgi" << false; QTest::newRow("200-2") << QNetworkRequest::AlwaysCache << "httpcachetest_lastModified200.cgi" << AlwaysTrue; - QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_lastModified200.cgi" << true; + QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_lastModified200.cgi" << false; } void tst_QAbstractNetworkCache::lastModified() @@ -180,7 +178,7 @@ void tst_QAbstractNetworkCache::etag_data() QTest::newRow("200-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_etag200.cgi" << AlwaysFalse; QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_etag200.cgi" << false; QTest::newRow("200-2") << QNetworkRequest::AlwaysCache << "httpcachetest_etag200.cgi" << AlwaysTrue; - QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_etag200.cgi" << true; + QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_etag200.cgi" << false; } void tst_QAbstractNetworkCache::etag() @@ -207,6 +205,11 @@ void tst_QAbstractNetworkCache::cacheControl_data() QTest::newRow("304-2") << QNetworkRequest::PreferNetwork << "httpcachetest_cachecontrol.cgi?max-age=1000, must-revalidate" << true; QTest::newRow("304-3") << QNetworkRequest::AlwaysCache << "httpcachetest_cachecontrol.cgi?max-age=1000, must-revalidate" << AlwaysTrue; QTest::newRow("304-4") << QNetworkRequest::PreferCache << "httpcachetest_cachecontrol.cgi?max-age=1000, must-revalidate" << true; + + // see QTBUG-7060 + //QTest::newRow("nokia-boston") << QNetworkRequest::PreferNetwork << "http://waplabdc.nokia-boston.com/browser/users/venkat/cache/Cache_directives/private_1b.asp" << true; + QTest::newRow("304-2b") << QNetworkRequest::PreferNetwork << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << true; + QTest::newRow("304-4b") << QNetworkRequest::PreferCache << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << true; } void tst_QAbstractNetworkCache::cacheControl() @@ -225,7 +228,8 @@ void tst_QAbstractNetworkCache::check() manager.setCache(diskCache); QCOMPARE(diskCache->gotData, false); - QNetworkRequest request(QUrl(TESTFILE + url)); + QUrl realUrl = url.contains("://") ? url : TESTFILE + url; + QNetworkRequest request(realUrl); // prime the cache QNetworkReply *reply = manager.get(request); |