Make tst_qabstractnetworkcache parallel-safe
authorRohan McGovern <rohan.mcgovern@nokia.com>
Thu, 31 May 2012 06:37:44 +0000 (16:37 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 1 Jun 2012 01:16:11 +0000 (03:16 +0200)
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>
tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro
tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp

index 788abc3..979032c 100644 (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;
 };