summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2014-10-15 16:15:23 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2014-10-28 10:49:59 +0100
commit7435ac7bebdec419702248d4ef92caa80d052b19 (patch)
treeef9d0abddc5d82ab560108174f27ca0534080294 /tests/auto/widgets
parent7639513f94fe45b5202349d2891e46b2295606a0 (diff)
Fix tst_QWebEngineFrame::setUrlHistory expected failures
Adapt test results to the chromium behavior and remove expected failures. Change-Id: I277462125822e50f84c0d0ae795846a71c9a2b10 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp43
1 files changed, 26 insertions, 17 deletions
diff --git a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
index 218a8b579..1a8745f25 100644
--- a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
+++ b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
@@ -1370,19 +1370,19 @@ void tst_QWebEngineFrame::setUrlHistory()
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(m_page->url(), aboutBlank);
QCOMPARE(m_page->requestedUrl(), QUrl());
- QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
- QCOMPARE(collectHistoryUrls(m_page->history()), QStringList());
+ // Chromium stores navigation entry for every successful loads. The load of the empty page is committed and stored as about:blank.
+ QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << aboutBlank.toString());
url = QUrl("http://non.existent/");
m_page->setUrl(url);
expectedLoadFinishedCount++;
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
- QEXPECT_FAIL("", "Needs to be investigated", Continue);
- QCOMPARE(m_page->url(), url);
- QEXPECT_FAIL("", "Needs to be investigated", Continue);
- QCOMPARE(m_page->requestedUrl(), url);
- QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
- QCOMPARE(collectHistoryUrls(m_page->history()), QStringList());
+ // When error page is disabled in case of LoadFail the entry of the unavailable page is not stored.
+ // We expect the url of the previously loaded page here.
+ QCOMPARE(m_page->url(), aboutBlank);
+ QCOMPARE(m_page->requestedUrl(), QUrl());
+ // Since the entry of the unavailable page is not stored it will not available in the history.
+ QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << aboutBlank.toString());
url = QUrl("qrc:/test1.html");
m_page->setUrl(url);
@@ -1390,26 +1390,31 @@ void tst_QWebEngineFrame::setUrlHistory()
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(m_page->url(), url);
QCOMPARE(m_page->requestedUrl(), url);
- QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
- QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << QStringLiteral("qrc:/test1.html"));
+ QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << aboutBlank.toString() << QStringLiteral("qrc:/test1.html"));
m_page->setUrl(QUrl());
expectedLoadFinishedCount++;
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(m_page->url(), aboutBlank);
QCOMPARE(m_page->requestedUrl(), QUrl());
- QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
- QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << QStringLiteral("qrc:/test1.html"));
+ // Chromium stores navigation entry for every successful loads. The load of the empty page is committed and stored as about:blank.
+ QCOMPARE(collectHistoryUrls(m_page->history()), QStringList()
+ << aboutBlank.toString()
+ << QStringLiteral("qrc:/test1.html")
+ << aboutBlank.toString());
- // Loading same page as current in history, so history count doesn't change.
url = QUrl("qrc:/test1.html");
m_page->setUrl(url);
expectedLoadFinishedCount++;
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(m_page->url(), url);
QCOMPARE(m_page->requestedUrl(), url);
- QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
- QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << QStringLiteral("qrc:/test1.html"));
+ // The history count DOES change since the about:blank is in the list.
+ QCOMPARE(collectHistoryUrls(m_page->history()), QStringList()
+ << aboutBlank.toString()
+ << QStringLiteral("qrc:/test1.html")
+ << aboutBlank.toString()
+ << QStringLiteral("qrc:/test1.html"));
url = QUrl("qrc:/test2.html");
m_page->setUrl(url);
@@ -1417,8 +1422,12 @@ void tst_QWebEngineFrame::setUrlHistory()
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(m_page->url(), url);
QCOMPARE(m_page->requestedUrl(), url);
- QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
- QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << QStringLiteral("qrc:/test1.html") << QStringLiteral("qrc:/test2.html"));
+ QCOMPARE(collectHistoryUrls(m_page->history()), QStringList()
+ << aboutBlank.toString()
+ << QStringLiteral("qrc:/test1.html")
+ << aboutBlank.toString()
+ << QStringLiteral("qrc:/test1.html")
+ << QStringLiteral("qrc:/test2.html"));
}
void tst_QWebEngineFrame::setUrlUsingStateObject()