Make tst_qabstractnetworkcache parallel-safe

Use a unique QTemporaryDir instead of a fixed path for the test cache.

Change-Id: Ib664033a509a6cefd7c323708f80ef595b202178
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
bb10
Rohan McGovern 2012-05-31 16:37:44 +10:00 committed by Qt by Nokia
parent 55d0c6c6cf
commit 9469e9fdeb
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,5 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qabstractnetworkcache
QT += network testlib
QT -= gui

View File

@ -39,7 +39,7 @@
**
****************************************************************************/
#include <QTemporaryDir>
#include <QtTest/QtTest>
#include <QtNetwork/QtNetwork>
#include "../../../network-settings.h"
@ -101,10 +101,10 @@ class NetworkDiskCache : public QNetworkDiskCache
public:
NetworkDiskCache(QObject *parent = 0)
: QNetworkDiskCache(parent)
, tempDir(QDir::tempPath() + QLatin1String("/tst_qabstractnetworkcache.XXXXXX"))
, gotData(false)
{
QString location = QDir::tempPath() + QLatin1String("/tst_qnetworkdiskcache/");
setCacheDirectory(location);
setCacheDirectory(tempDir.path());
clear();
}
@ -114,6 +114,7 @@ public:
return QNetworkDiskCache::data(url);
}
QTemporaryDir tempDir;
bool gotData;
};