diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-03-21 14:43:21 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-31 16:43:59 +0200 |
commit | e9575322f8068b2dd2bc0b30a0f444f769a861b9 (patch) | |
tree | 1a6fbc4a8cb71d10f436265d20bcb1538e836220 /tests/auto/widgets/qwebenginehistory | |
parent | 3f69bf43c45e54789ce6cdc4a2f01ea129e6287c (diff) |
Implement QWebEngineHistory serialization
This does uses logic taken from Chromium's state save and restore
code. The history version is incremented from the same method in
QtWebKit in cases where the application would try loading a stream
from a previous version using QtWebKit.
In all cases where Chromium does a restore of a serialized history,
it does so on a fresh WebContents instance, thus we must do the same
and some of the initialization code has to be updated.
Change-Id: I45abb052073bd44c9cb47bc2abcf4b558fe3dbbd
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'tests/auto/widgets/qwebenginehistory')
-rw-r--r-- | tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp index f2b11c5c2..cebfee67a 100644 --- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp +++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp @@ -259,6 +259,7 @@ void tst_QWebEngineHistory::serialize_2() // Force a "same document" navigation. page->load(page->url().toString() + QLatin1String("#dummyAnchor")); + loadFinishedBarrier->ensureSignalEmitted(); int initialCurrentIndex = hist->currentItemIndex(); @@ -277,6 +278,8 @@ void tst_QWebEngineHistory::serialize_2() QVERIFY(save.status() == QDataStream::Ok); load >> *hist; QVERIFY(load.status() == QDataStream::Ok); + // Restoring the history will trigger a load. + loadFinishedBarrier->ensureSignalEmitted(); //check current index QCOMPARE(hist->currentItemIndex(), oldCurrentIndex); @@ -562,6 +565,7 @@ void tst_QWebEngineHistory::restoreIncompatibleVersion1() // This should fail to load, the history should be cleared and the stream should be broken. stream >> *hist; + QEXPECT_FAIL("", "Behavior change: A broken stream won't clear the history in QtWebEngine.", Continue); QVERIFY(!hist->canGoBack()); QVERIFY(!hist->canGoForward()); QVERIFY(stream.status() == QDataStream::ReadCorruptData); |