diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-08-17 15:18:57 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-08-21 22:24:46 +0000 |
commit | f589b8b411f1049f6f2f701478e0c38c72ad824a (patch) | |
tree | 958c4c3f2d2082c34e1515cf1e6a178d9b43d1eb /tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp | |
parent | e8d4115c43665fb6e567e639fce3924082ae6450 (diff) |
Fix crash on changing persistent storage path
The deletion of HttpNetworkSession references the old
HttpServerProperties so delete the session before we replace the
properties.
Task-number: QTBUG-55322
Change-Id: I420dc0523fda44423adaa5f4f0fa1df9ade4b584
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp')
-rw-r--r-- | tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 579a0f776..093bc2e43 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -52,6 +52,7 @@ private Q_SLOTS: void customUserAgent(); void httpAcceptLanguage(); void downloadItem(); + void changePersistentPath(); }; void tst_QWebEngineProfile::defaultProfile() @@ -375,5 +376,24 @@ void tst_QWebEngineProfile::downloadItem() QTRY_COMPARE(downloadSpy.count(), 1); } +void tst_QWebEngineProfile::changePersistentPath() +{ + QWebEngineProfile testProfile(QStringLiteral("Test")); + const QString oldPath = testProfile.persistentStoragePath(); + QVERIFY(oldPath.endsWith(QStringLiteral("Test"))); + + // Make sure the profile has been used and the url-request-context-getter instantiated: + QWebEnginePage page(&testProfile); + QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool))); + page.load(QUrl("http://qt-project.org")); + if (!loadFinishedSpy.wait(10000) || !loadFinishedSpy.at(0).at(0).toBool()) + QSKIP("Couldn't load page from network, skipping test."); + + // Test we do not crash (QTBUG-55322): + testProfile.setPersistentStoragePath(oldPath + QLatin1Char('2')); + const QString newPath = testProfile.persistentStoragePath(); + QVERIFY(newPath.endsWith(QStringLiteral("Test2"))); +} + QTEST_MAIN(tst_QWebEngineProfile) #include "tst_qwebengineprofile.moc" |