summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2020-03-31 20:19:10 +0200
committerMichal Klocek <michal.klocek@qt.io>2020-04-02 22:30:20 +0000
commited5bd3c5638b237846234028381cab5d67669786 (patch)
treec09e224aba8800dba191e384a268247fffa681a2 /tests
parent887b236e54354c53cf2714197e017488fc788b7a (diff)
Speculative fix for titleUpdate test case
After tedious investigation the issue boils down to error prone synchronization of web engine settings. WebEngineSettings are synchronized between the browser process and the render process. Moreover in the browser process the sync message is send to the render with QTimer::singleShot, which can cause race conditions if for example QWebPage::setUrl was used meanwhile. This makes current settings not being picked up by the render process and results in 'titleUpdate' test case flaky. This happens due to the fact that ShouldDisplayErrorPageForFailedLoad in the render process frame view could have invalid value. Try to sync web engine settings on every adapter load, setContent or reload. Mark some flaky settings in tests. Fixes: QTBUG-83078 Change-Id: I5289472f146e104d5cb6c3b9b20b26d3dc42f4b1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp1
-rw-r--r--tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 4945f6c91..e1d97af25 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -828,6 +828,7 @@ void tst_QWebEnginePage::localStorageVisibility()
// Toggle local setting for every page and...
webPage1.settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
webPage2.settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true);
+ // TODO: note this setting is flaky, consider settings().commit()
// ...first check second page (for storage to appear) as applying settings is batched and done asynchronously
QTRY_VERIFY(evaluateJavaScriptSync(&webPage2, QString("(window.localStorage != undefined)")).toBool());
// Switching the feature off does not actively remove the object from webPage1.
diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
index b4061b984..a09901e69 100644
--- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
+++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
@@ -168,7 +168,7 @@ protected:
if (isMainFrame && url.scheme().startsWith("data"))
settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
-
+ // TODO: note this setting is flaky, consider settings().commit()
return true;
}
};