summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-01-29 13:37:12 +0100
committerMichal Klocek <michal.klocek@qt.io>2018-02-12 14:35:03 +0000
commit58dcd497ad8a0138a77a58001bc8adb3fd62fd73 (patch)
tree9f7802c0ae3e073b4cb2e9a33b74a8947dfefd16 /tests
parent20ffcf870ec0963b97d9d44c12b4fd2aa4a11dc9 (diff)
Correct documentation for storage paths
Udpdate docs and profile unit test for storage paths. Change-Id: I646a33571ad8458af4efcddf310489cdde3a4606 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp54
1 files changed, 44 insertions, 10 deletions
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index c443ee114..123cb7b32 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -42,8 +42,10 @@ class tst_QWebEngineProfile : public QObject
Q_OBJECT
private Q_SLOTS:
- void defaultProfile();
- void profileConstructors();
+ void init();
+ void cleanup();
+ void privateProfile();
+ void testProfile();
void clearDataFromCache();
void disableCache();
void urlSchemeHandlers();
@@ -56,28 +58,60 @@ private Q_SLOTS:
void changePersistentPath();
};
-void tst_QWebEngineProfile::defaultProfile()
+void tst_QWebEngineProfile::init()
{
+ //make sure defualt global profile is 'default' across all the tests
QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
QVERIFY(profile);
QVERIFY(!profile->isOffTheRecord());
QCOMPARE(profile->storageName(), QStringLiteral("Default"));
QCOMPARE(profile->httpCacheType(), QWebEngineProfile::DiskHttpCache);
QCOMPARE(profile->persistentCookiesPolicy(), QWebEngineProfile::AllowPersistentCookies);
+ QCOMPARE(profile->cachePath(), QStandardPaths::writableLocation(QStandardPaths::CacheLocation)
+ + QStringLiteral("/QtWebEngine/Default"));
+ QCOMPARE(profile->persistentStoragePath(), QStandardPaths::writableLocation(QStandardPaths::DataLocation)
+ + QStringLiteral("/QtWebEngine/Default"));
}
-void tst_QWebEngineProfile::profileConstructors()
+void tst_QWebEngineProfile::cleanup()
{
- QWebEngineProfile otrProfile;
- QWebEngineProfile diskProfile(QStringLiteral("Test"));
+ QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
+ profile->setCachePath(QString());
+ profile->setPersistentStoragePath(QString());
+ profile->setHttpCacheType(QWebEngineProfile::DiskHttpCache);
+}
+void tst_QWebEngineProfile::privateProfile()
+{
+ QWebEngineProfile otrProfile;
QVERIFY(otrProfile.isOffTheRecord());
- QVERIFY(!diskProfile.isOffTheRecord());
- QCOMPARE(diskProfile.storageName(), QStringLiteral("Test"));
QCOMPARE(otrProfile.httpCacheType(), QWebEngineProfile::MemoryHttpCache);
- QCOMPARE(diskProfile.httpCacheType(), QWebEngineProfile::DiskHttpCache);
QCOMPARE(otrProfile.persistentCookiesPolicy(), QWebEngineProfile::NoPersistentCookies);
- QCOMPARE(diskProfile.persistentCookiesPolicy(), QWebEngineProfile::AllowPersistentCookies);
+ QCOMPARE(otrProfile.cachePath(), QString());
+ QCOMPARE(otrProfile.persistentStoragePath(), QString());
+ // TBD: setters do not really work
+ otrProfile.setCachePath(QStringLiteral("/home/foo/bar"));
+ QCOMPARE(otrProfile.cachePath(), QString());
+ otrProfile.setPersistentStoragePath(QStringLiteral("/home/foo/bar"));
+ QCOMPARE(otrProfile.persistentStoragePath(), QString());
+ otrProfile.setHttpCacheType(QWebEngineProfile::DiskHttpCache);
+ QCOMPARE(otrProfile.httpCacheType(), QWebEngineProfile::MemoryHttpCache);
+ otrProfile.setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
+ QCOMPARE(otrProfile.persistentCookiesPolicy(), QWebEngineProfile::NoPersistentCookies);
+}
+
+
+void tst_QWebEngineProfile::testProfile()
+{
+ QWebEngineProfile profile(QStringLiteral("Test"));
+ QVERIFY(!profile.isOffTheRecord());
+ QCOMPARE(profile.storageName(), QStringLiteral("Test"));
+ QCOMPARE(profile.httpCacheType(), QWebEngineProfile::DiskHttpCache);
+ QCOMPARE(profile.persistentCookiesPolicy(), QWebEngineProfile::AllowPersistentCookies);
+ QCOMPARE(profile.cachePath(), QStandardPaths::writableLocation(QStandardPaths::CacheLocation)
+ + QStringLiteral("/QtWebEngine/Test"));
+ QCOMPARE(profile.persistentStoragePath(), QStandardPaths::writableLocation(QStandardPaths::DataLocation)
+ + QStringLiteral("/QtWebEngine/Test"));
}
void tst_QWebEngineProfile::clearDataFromCache()