summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/shared
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2017-02-15 11:49:25 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2017-03-03 05:51:25 +0000
commit78d8985c6bdb7bf9d04fa5e6936aadab5174c6d2 (patch)
tree49d4a45b617b105704bc942274fc4195c61180da /tests/auto/quick/shared
parentc7edb365f6c9c3d614fb6bb2fe03de3dd6d2d5a8 (diff)
Rework change locale tests for 55-based Chromium
Error pages no longer have useful titles in Chromium 55. Test the error page content instead. Tests have been also stabilized. Task-number: QTBUG-58022 Change-Id: If5c3e2b1df2cb3ee8b48d651e6f19360fa484f17 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick/shared')
-rw-r--r--tests/auto/quick/shared/util.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/quick/shared/util.h b/tests/auto/quick/shared/util.h
index 98a7c1007..dce0afb8e 100644
--- a/tests/auto/quick/shared/util.h
+++ b/tests/auto/quick/shared/util.h
@@ -120,4 +120,26 @@ inline bool waitForViewportReady(QQuickWebEngineView *webEngineView, int timeout
#endif
}
+inline QString bodyInnerText(QQuickWebEngineView *webEngineView)
+{
+ qRegisterMetaType<QQuickWebEngineView::JavaScriptConsoleMessageLevel>("JavaScriptConsoleMessageLevel");
+ QSignalSpy consoleMessageSpy(webEngineView, &QQuickWebEngineView::javaScriptConsoleMessage);
+
+ webEngineView->runJavaScript(
+ "if (document.body == null)"
+ " console.log('');"
+ "else"
+ " console.log(document.body.innerText);"
+ );
+
+ if (!consoleMessageSpy.wait())
+ return QString();
+
+ QList<QVariant> arguments = consoleMessageSpy.takeFirst();
+ if (static_cast<QQuickWebEngineView::JavaScriptConsoleMessageLevel>(arguments.at(0).toInt()) != QQuickWebEngineView::InfoMessageLevel)
+ return QString();
+
+ return arguments.at(1).toString();
+}
+
#endif /* UTIL_H */