summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2020-02-27 17:00:13 +0100
committerKirill Burtsev <kirill.burtsev@qt.io>2020-02-28 14:27:56 +0100
commit616781369e8787a02e5629b73a0c8cfffe3c5239 (patch)
tree705bb10afe99fb43d3c734416bce1f015055890b /tests
parenta44d7aeef75c73ede4fb21df91f8e7d173d95c68 (diff)
Stabilize tst_QWebEnginePage::localStorageVisibility()
Toggling page's setting is actually first batched and then executed asynchronously by timer. So javascript code might not necessarily see this update immediately after change on UI thread. Change-Id: I1a1f373b5fd0b96c5b937a2dca1ce0ed99364c33 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 94b3f16c1..d0453e1e6 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -823,11 +823,13 @@ void tst_QWebEnginePage::localStorageVisibility()
QVERIFY(evaluateJavaScriptSync(&webPage1, QString("(window.localStorage != undefined)")).toBool());
QVERIFY(!evaluateJavaScriptSync(&webPage2, QString("(window.localStorage != undefined)")).toBool());
- // Switching the feature off does not actively remove the object from webPage1.
+ // Toggle local setting for every page and...
webPage1.settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
webPage2.settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true);
+ // ...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.
QVERIFY(evaluateJavaScriptSync(&webPage1, QString("(window.localStorage != undefined)")).toBool());
- QVERIFY(evaluateJavaScriptSync(&webPage2, QString("(window.localStorage != undefined)")).toBool());
// The object disappears only after reloading.
webPage1.triggerAction(QWebEnginePage::Reload);