summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp')
-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 9fceffd7e..3c8025672 100644
--- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
+++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
@@ -66,6 +66,7 @@ private Q_SLOTS:
void saveAndRestore_crash_2();
void saveAndRestore_crash_3();
void saveAndRestore_crash_4();
+ void saveAndRestore_InternalPage();
void popPushState_data();
void popPushState();
@@ -422,6 +423,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");