summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/qwebenginehistory
diff options
context:
space:
mode:
authorViktor Engelmann <viktor.engelmann@qt.io>2017-08-23 12:51:57 +0200
committerViktor Engelmann <viktor.engelmann@qt.io>2017-09-18 08:49:34 +0000
commit858a468b77ed969333efe4985cb4a64d46c5c154 (patch)
tree2dc75640a94b9049f7506715126485b89f839e50 /tests/auto/widgets/qwebenginehistory
parent7b365eb352780dc0d939e918b0aa58d0458fd9da (diff)
Add Autotest for restoring history that contains an internal page
Since this issue has re-appeared at least once, we add an Autotest that navigates to an internal page (view-source:...), saves and then restores the history. Task-number: QTBUG-57826 Change-Id: Ida771ebacefd38592873d02f47133d0f3f6894ea Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/widgets/qwebenginehistory')
-rw-r--r--tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
index d9bbce173..7c8497fef 100644
--- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
+++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
@@ -65,6 +65,7 @@ private Q_SLOTS:
void saveAndRestore_crash_2();
void saveAndRestore_crash_3();
void saveAndRestore_crash_4();
+ void saveAndRestore_InternalPage();
void popPushState_data();
void popPushState();
@@ -420,6 +421,26 @@ void tst_QWebEngineHistory::saveAndRestore_crash_4()
QTRY_COMPARE(loadFinishedSpy2.count(), 1);
}
+void tst_QWebEngineHistory::saveAndRestore_InternalPage()
+{
+ QWebEngineView view;
+ view.show();
+ QSignalSpy loadFinishedSpy(&view, &QWebEngineView::loadFinished);
+ view.load(QUrl("view-source:http://qt.io"));
+ QTRY_LOOP_IMPL((loadFinishedSpy.size() == 1), 30000, 200)
+ if (loadFinishedSpy.size() != 1 || !loadFinishedSpy.at(0).at(0).toBool())
+ QSKIP("Couldn't load page from network, skipping test.");
+
+ // get history
+ QByteArray data;
+ QDataStream stream1(&data, QIODevice::WriteOnly);
+ stream1 << *view.history();
+
+ // restore history - this should not crash. see QTBUG-57826
+ QDataStream stream2(data);
+ stream2 >> *view.history();
+}
+
void tst_QWebEngineHistory::popPushState_data()
{
QTest::addColumn<QString>("script");