summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDmitriy Kuminov <coding@dmik\.org>2019-10-29 11:17:38 +0100
committerJüri Valdmann <juri.valdmann@qt.io>2019-11-08 17:50:24 +0100
commit85dbb7c99e25889b4b24594f46d2093c8c6febc9 (patch)
treeeb1572b0a229287c90f27c20d0697c1a9b3a962d /tests
parent025710fa77f80c0940705bc4ad405872b5aeecfe (diff)
Store favicon URL when serializing QWebEngineHistory
This is to make QWebEngineHistoryItem::iconUrl of the deserialized QWebEngineHistory object return the same URL it had when serializing. Otherwise it's impossible to have favicons for URLs from the navigation history of a restored browser session until these URLs are visited again (so that Chromium refetches their favicons). These icons are usually needed much earlier - e.g. when showing a popup with the navigation history and having an icon URL allows to load it from a disk cache before visiting the page. Fixes: QTBUG-78998 Change-Id: Ief2d089d52f301826e5c131d401cafd08952a8b5 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebenginehistory/resources/page5.html1
-rw-r--r--tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginehistory/resources/page5.html b/tests/auto/widgets/qwebenginehistory/resources/page5.html
index 859355279..cad6d964e 100644
--- a/tests/auto/widgets/qwebenginehistory/resources/page5.html
+++ b/tests/auto/widgets/qwebenginehistory/resources/page5.html
@@ -1 +1,2 @@
+<link rel="icon" href="qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png">
<title>page5</title><body><h1>page5</h1></body>
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
index 6209401cb..bdb486793 100644
--- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
+++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
@@ -51,6 +51,7 @@ public Q_SLOTS:
private Q_SLOTS:
void title();
void lastVisited();
+ void iconUrl();
void count();
void back();
void forward();
@@ -126,6 +127,11 @@ void tst_QWebEngineHistory::lastVisited()
QVERIFY(qAbs(hist->itemAt(0).lastVisited().secsTo(QDateTime::currentDateTime())) < 60);
}
+void tst_QWebEngineHistory::iconUrl()
+{
+ QTRY_COMPARE(hist->currentItem().iconUrl(), QUrl("qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png"));
+}
+
/**
* Check QWebEngineHistory::count() method
*/
@@ -336,6 +342,7 @@ void tst_QWebEngineHistory::serialize_3()
QDateTime lastVisited(a.lastVisited());
QUrl originalUrl(a.originalUrl());
QUrl url(a.url());
+ QUrl iconUrl(a.iconUrl());
save << *hist;
QVERIFY(save.status() == QDataStream::Ok);
@@ -351,6 +358,7 @@ void tst_QWebEngineHistory::serialize_3()
QTRY_COMPARE(b.lastVisited(), lastVisited);
QTRY_COMPARE(b.originalUrl(), originalUrl);
QTRY_COMPARE(b.url(), url);
+ QTRY_COMPARE(b.iconUrl(), iconUrl);
//Check if all data was read
QVERIFY(load.atEnd());