summaryrefslogtreecommitdiffstats
path: root/tests/auto/qabstractnetworkcache
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qabstractnetworkcache')
-rw-r--r--tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index fa36845..19fa502 100644
--- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -69,6 +69,8 @@ private slots:
void cacheControl_data();
void cacheControl();
+ void deleteCache();
+
private:
void check();
};
@@ -84,8 +86,8 @@ public:
#ifdef Q_OS_SYMBIAN
QString location = QLatin1String("./cache/");
#else
- QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation)
- + QLatin1String("/cache/");
+ QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation)
+ + QLatin1String("/qnetworkdiskcache/");
#endif
setCacheDirectory(location);
clear();
@@ -275,6 +277,20 @@ void tst_QAbstractNetworkCache::check()
QCOMPARE(diskCache->gotData, fetchFromCache);
}
+void tst_QAbstractNetworkCache::deleteCache()
+{
+ QNetworkAccessManager manager;
+ NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
+ manager.setCache(diskCache);
+
+ QString url = "httpcachetest_cachecontrol.cgi?max-age=1000";
+ QNetworkRequest request(QUrl(TESTFILE + url));
+ QNetworkReply *reply = manager.get(request);
+ QSignalSpy downloaded1(reply, SIGNAL(finished()));
+ manager.setCache(0);
+ QTRY_COMPARE(downloaded1.count(), 1);
+}
+
QTEST_MAIN(tst_QAbstractNetworkCache)
#include "tst_qabstractnetworkcache.moc"