summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-07-19 14:12:54 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-09-11 17:25:32 +0000
commit7282fb4fb4861320539f2b7288f63e1d4f48749d (patch)
tree3fb62ed4d45875be975410b08c776888803748ec /tests
parent82499104972d24027044acaff1136ea7d758efe2 (diff)
Adaptations for Chromium 60
Change-Id: I536258e22c2ec143f2fd3f1cbda229e0611b6af4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qmltests/data/confirmclose.html3
-rw-r--r--tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml22
-rw-r--r--tests/auto/quick/qmltests/tst_qmltests.cpp13
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp2
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp5
-rw-r--r--tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp9
-rw-r--r--tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp2
-rw-r--r--tests/auto/widgets/qwebenginepage/resources/basic_printing_page.html (renamed from tests/auto/widgets/qwebengineview/resources/basic_printing_page.html)0
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp8
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc1
-rw-r--r--tests/auto/widgets/qwebenginescript/resources/test_iframe_inner.html8
-rw-r--r--tests/auto/widgets/qwebenginescript/resources/test_iframe_main.html9
-rw-r--r--tests/auto/widgets/qwebenginescript/resources/test_iframe_outer.html9
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp53
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.qrc7
-rw-r--r--tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp4
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp27
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc1
-rw-r--r--tests/auto/widgets/widgets.pro3
19 files changed, 152 insertions, 34 deletions
diff --git a/tests/auto/quick/qmltests/data/confirmclose.html b/tests/auto/quick/qmltests/data/confirmclose.html
index ba11da7a4..c2acbb67f 100644
--- a/tests/auto/quick/qmltests/data/confirmclose.html
+++ b/tests/auto/quick/qmltests/data/confirmclose.html
@@ -1,5 +1,6 @@
<html>
-<body onbeforeunload="return 'You are about to miss out on some awesome content.';">
+<body onbeforeunload="return 'You are about to miss out on some awesome content.';"
+ onmousedown="window.mousePressReceived = true;">
Be greeted, precious viewer!
</body>
</html>
diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
index 73673f511..44836d67c 100644
--- a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
+++ b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
@@ -34,6 +34,7 @@ import "../mock-delegates/TestParams" 1.0
TestWebEngineView {
id: webEngineView
+ anchors.fill: parent
testSupport: WebEngineTestSupport {
property bool windowCloseRejectedSignalEmitted: false
@@ -52,6 +53,7 @@ TestWebEngineView {
TestCase {
id: test
name: "WebEngineViewJavaScriptDialogs"
+ when: windowShown
function init() {
JSDialogParams.dialogMessage = "";
@@ -82,11 +84,29 @@ TestWebEngineView {
}
+ function simulateUserGesture() {
+ // A user gesture after page load is required since Chromium 60 to allow showing
+ // an onbeforeunload dialog.
+ // See https://www.chromestatus.com/feature/5082396709879808
+ mouseClick(webEngineView, 10, 10, Qt.LeftButton)
+
+ var mousePressReceived;
+ runJavaScript("window.mousePressReceived", function(result) {
+ mousePressReceived = result;
+ });
+
+ tryVerify(function() {
+ return mousePressReceived != undefined
+ }, 5000);
+ }
+
function test_confirmClose() {
webEngineView.url = Qt.resolvedUrl("confirmclose.html");
verify(webEngineView.waitForLoadSucceeded());
webEngineView.windowCloseRequestedSignalEmitted = false;
JSDialogParams.shouldAcceptDialog = true;
+
+ simulateUserGesture()
webEngineView.triggerWebAction(WebEngineView.RequestClose);
verify(webEngineView.waitForWindowCloseRequested());
}
@@ -96,6 +116,8 @@ TestWebEngineView {
verify(webEngineView.waitForLoadSucceeded());
webEngineView.testSupport.windowCloseRejectedSignalEmitted = false;
JSDialogParams.shouldAcceptDialog = false;
+
+ simulateUserGesture()
webEngineView.triggerWebAction(WebEngineView.RequestClose);
verify(webEngineView.testSupport.waitForWindowCloseRejected());
}
diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp
index 5dc909709..2aa24b76c 100644
--- a/tests/auto/quick/qmltests/tst_qmltests.cpp
+++ b/tests/auto/quick/qmltests/tst_qmltests.cpp
@@ -114,8 +114,17 @@ int main(int argc, char **argv)
// Force to use English language for testing due to error message checks
QLocale::setDefault(QLocale("en"));
- if (!QCoreApplication::instance())
- app.reset(new Application(argc, argv));
+ static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")};
+ QVector<const char *> w_argv(argc); \
+ for (int i = 0; i < argc; ++i) \
+ w_argv[i] = argv[i]; \
+ for (int i = 0; i < params.size(); ++i) \
+ w_argv.append(params[i].data()); \
+ int w_argc = w_argv.size(); \
+
+ if (!QCoreApplication::instance()) {
+ app.reset(new Application(w_argc, const_cast<char **>(w_argv.data())));
+ }
QtWebEngine::initialize();
QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true);
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
index 2afaf03a3..0139d266f 100644
--- a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
@@ -110,7 +110,7 @@ QUrl tst_QQuickWebEngineDefaultSurfaceFormat::urlFromTestPath(const char *localF
void tst_QQuickWebEngineDefaultSurfaceFormat::customDefaultSurfaceFormat()
{
-#if !defined(Q_OS_MACOSX)
+#if !defined(Q_OS_MACOS)
QSKIP("OpenGL Core Profile is currently only supported on macOS.");
#endif
// Setting a new default QSurfaceFormat with a core OpenGL profile, before
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 8aea72cca..7af2263be 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -261,7 +261,6 @@ void tst_QQuickWebEngineView::loadProgress()
void tst_QQuickWebEngineView::show()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
// This should not crash.
m_window->show();
QTest::qWait(200);
@@ -270,7 +269,6 @@ void tst_QQuickWebEngineView::show()
void tst_QQuickWebEngineView::showWebEngineView()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
webEngineView()->setUrl(urlFromTestPath("html/direct-image-compositing.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
m_window->show();
@@ -283,7 +281,6 @@ void tst_QQuickWebEngineView::showWebEngineView()
void tst_QQuickWebEngineView::removeFromCanvas()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
showWebEngineView();
// This should not crash.
@@ -298,7 +295,6 @@ void tst_QQuickWebEngineView::removeFromCanvas()
void tst_QQuickWebEngineView::multipleWebEngineViewWindows()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
showWebEngineView();
// This should not crash.
@@ -321,7 +317,6 @@ void tst_QQuickWebEngineView::multipleWebEngineViewWindows()
void tst_QQuickWebEngineView::multipleWebEngineViews()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
showWebEngineView();
// This should not crash.
diff --git a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
index 6eb29db8d..bed2745e3 100644
--- a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
+++ b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
@@ -68,7 +68,6 @@ void tst_QWebEngineAccessibility::cleanup()
void tst_QWebEngineAccessibility::noPage()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
QWebEngineView webView;
webView.show();
@@ -85,7 +84,6 @@ void tst_QWebEngineAccessibility::noPage()
void tst_QWebEngineAccessibility::hierarchy()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
QWebEngineView webView;
webView.setHtml("<html><body>" \
"Hello world" \
@@ -146,7 +144,6 @@ void tst_QWebEngineAccessibility::hierarchy()
void tst_QWebEngineAccessibility::text()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
QWebEngineView webView;
webView.setHtml("<html><body>" \
"<input type='text' value='Good morning!'></input>" \
@@ -216,7 +213,6 @@ void tst_QWebEngineAccessibility::text()
void tst_QWebEngineAccessibility::value()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
QWebEngineView webView;
webView.setHtml("<html><body>" \
"<div role='slider' aria-valuenow='4' aria-valuemin='1' aria-valuemax='10'></div>" \
@@ -294,7 +290,7 @@ void tst_QWebEngineAccessibility::roles_data()
QTest::newRow("AX_ROLE_DIALOG") << QString("<div role='dialog'></div>") << true << QAccessible::Dialog;
//QTest::newRow("AX_ROLE_DIRECTORY") << QString("<div role='directory'></div>") << true << QAccessible::NoRole; // FIXME: Aria role 'directory' should work
QTest::newRow("AX_ROLE_DISCLOSURE_TRIANGLE") << QString("<details><summary>a</summary></details>") << false << QAccessible::NoRole;
- QTest::newRow("AX_ROLE_DIV") << QString("<div>a</div>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_GENERIC_CONTAINER") << QString("<div>a</div>") << true << QAccessible::Section;
QTest::newRow("AX_ROLE_DOCUMENT") << QString("<div role='document'>a</div>") << true << QAccessible::Document;
QTest::newRow("AX_ROLE_EMBEDDED_OBJECT") << QString("<object width='10' height='10'></object>") << false << QAccessible::Grouping;
QTest::newRow("AX_ROLE_FEED") << QString("<div role='feed'>a</div>") << true << QAccessible::Section;
@@ -305,7 +301,7 @@ void tst_QWebEngineAccessibility::roles_data()
QTest::newRow("AX_ROLE_GRID") << QString("<div role='grid'></div>") << true << QAccessible::Table;
QTest::newRow("AX_ROLE_GROUP") << QString("<fieldset></fieldset>") << true << QAccessible::Grouping;
QTest::newRow("AX_ROLE_HEADING") << QString("<h1>a</h1>") << true << QAccessible::Heading;
- QTest::newRow("AX_ROLE_IFRAME") << QString("<iframe>a</iframe>") << true << QAccessible::Grouping;
+ QTest::newRow("AX_ROLE_IFRAME") << QString("<iframe>a</iframe>") << true << QAccessible::Section;
QTest::newRow("AX_ROLE_IFRAME_PRESENTATIONAL") << QString("<iframe role='presentation'>a</iframe>") << false << QAccessible::NoRole;
//QTest::newRow("AX_ROLE_IGNORED") << QString("<tag>a</tag>") << true << QAccessible::NoRole; // FIXME: The HTML element should not be exposed as an element (see AXNodeObject.cpp)
QTest::newRow("AX_ROLE_IMAGE") << QString("<img>") << false << QAccessible::Graphic;
@@ -390,7 +386,6 @@ void tst_QWebEngineAccessibility::roles_data()
void tst_QWebEngineAccessibility::roles()
{
- QSKIP("Skip to due 58-based issues. Restore once 60-based is in.");
QFETCH(QString, html);
QFETCH(bool, isSection);
QFETCH(QAccessible::Role, role);
diff --git a/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp b/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp
index 1e8cc74e2..da47c5f0f 100644
--- a/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp
+++ b/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp
@@ -51,7 +51,7 @@ private Q_SLOTS:
void tst_QWebEngineDefaultSurfaceFormat::customDefaultSurfaceFormat()
{
-#if !defined(Q_OS_MACOSX)
+#if !defined(Q_OS_MACOS)
QSKIP("OpenGL Core Profile is currently only supported on macOS.");
#endif
// Setting a new default QSurfaceFormat with a core OpenGL profile before
diff --git a/tests/auto/widgets/qwebengineview/resources/basic_printing_page.html b/tests/auto/widgets/qwebenginepage/resources/basic_printing_page.html
index 0c6ff379f..0c6ff379f 100644
--- a/tests/auto/widgets/qwebengineview/resources/basic_printing_page.html
+++ b/tests/auto/widgets/qwebenginepage/resources/basic_printing_page.html
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 5f3a7e728..09d4f0f51 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -309,6 +309,10 @@ void tst_QWebEnginePage::acceptNavigationRequest()
NavigationRequestOverride* newPage = new NavigationRequestOverride(&view, false);
view.setPage(newPage);
+ // acceptNavigationRequest and QWebEngineUrlRequestInterceptor::interceptRequest are not called
+ // for data: urls, which means the test is broken, aka setting
+ // newPage->m_acceptNavigationRequest to false does nothing to stop the page from loading.
+ // See QTBUG-50922 comments.
view.setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>"
"<input type='text'><input type='submit'></form></body></html>"), QUrl());
QTRY_COMPARE(loadSpy.count(), 1);
@@ -4368,5 +4372,7 @@ void tst_QWebEnginePage::viewSourceURL()
QVERIFY(!page.action(QWebEnginePage::ViewSource)->isEnabled());
}
-QTEST_MAIN(tst_QWebEnginePage)
+static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")};
+W_QTEST_MAIN(tst_QWebEnginePage, params)
+
#include "tst_qwebenginepage.moc"
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc
index 91adeb694..4fddd7a3f 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc
@@ -1,5 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
+ <file>resources/basic_printing_page.html</file>
<file>resources/content.html</file>
<file>resources/index.html</file>
<file>resources/frame_a.html</file>
diff --git a/tests/auto/widgets/qwebenginescript/resources/test_iframe_inner.html b/tests/auto/widgets/qwebenginescript/resources/test_iframe_inner.html
new file mode 100644
index 000000000..3539c9620
--- /dev/null
+++ b/tests/auto/widgets/qwebenginescript/resources/test_iframe_inner.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title></title>
+</head>
+<body>
+<div>Inner text</div>
+</body>
+</html>
diff --git a/tests/auto/widgets/qwebenginescript/resources/test_iframe_main.html b/tests/auto/widgets/qwebenginescript/resources/test_iframe_main.html
new file mode 100644
index 000000000..47b991c2c
--- /dev/null
+++ b/tests/auto/widgets/qwebenginescript/resources/test_iframe_main.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title></title>
+</head>
+<body>
+<div>Main text</div>
+<iframe id="outer" src="qrc:/resources/test_iframe_outer.html"></iframe>
+</body>
+</html>
diff --git a/tests/auto/widgets/qwebenginescript/resources/test_iframe_outer.html b/tests/auto/widgets/qwebenginescript/resources/test_iframe_outer.html
new file mode 100644
index 000000000..8854809f8
--- /dev/null
+++ b/tests/auto/widgets/qwebenginescript/resources/test_iframe_outer.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title></title>
+</head>
+<body>
+<div>Outer text</div>
+<iframe id="inner" src="qrc:/resources/test_iframe_inner.html"></iframe>
+</body>
+</html>
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
index c10ae2886..1a8110bb6 100644
--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
@@ -38,6 +38,7 @@ private Q_SLOTS:
void webChannel_data();
void webChannel();
void noTransportWithoutWebChannel();
+ void scriptsInNestedIframes();
};
void tst_QWebEngineScript::domEditing()
@@ -246,6 +247,58 @@ void tst_QWebEngineScript::noTransportWithoutWebChannel()
QCOMPARE(evaluateJavaScriptSync(&page, "qt.webChannelTransport"), QVariant(QVariant::Invalid));
}
+void tst_QWebEngineScript::scriptsInNestedIframes()
+{
+ QWebEnginePage page;
+ QWebEngineView view;
+ view.setPage(&page);
+ QWebEngineScript s;
+ s.setInjectionPoint(QWebEngineScript::DocumentReady);
+ s.setWorldId(QWebEngineScript::ApplicationWorld);
+
+ // Prepend a "Modified prefix" to every frame's div content.
+ s.setSourceCode("var elements = document.getElementsByTagName(\"div\");\
+ var i;\
+ for (i = 0; i < elements.length; i++) {\
+ var content = elements[i].innerHTML;\
+ elements[i].innerHTML = \"Modified \" + content;\
+ }\
+ ");
+
+ // Make sure the script runs on all frames.
+ s.setRunsOnSubFrames(true);
+ page.scripts().insert(s);
+
+ QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished);
+ page.load(QUrl("qrc:/resources/test_iframe_main.html"));
+ view.show();
+ QVERIFY(spyFinished.wait());
+
+ // Check that main frame has modified content.
+ QCOMPARE(
+ evaluateJavaScriptSyncInWorld(&page, "document.getElementsByTagName(\"div\")[0].innerHTML",
+ QWebEngineScript::ApplicationWorld),
+ QVariant::fromValue(QStringLiteral("Modified Main text")));
+
+ // Check that outer frame has modified content.
+ QCOMPARE(
+ evaluateJavaScriptSyncInWorld(&page,
+ "var i = document.getElementById(\"outer\").contentDocument;\
+ i.getElementsByTagName(\"div\")[0].innerHTML",
+ QWebEngineScript::ApplicationWorld),
+ QVariant::fromValue(QStringLiteral("Modified Outer text")));
+
+
+ // Check that inner frame has modified content.
+ QCOMPARE(
+ evaluateJavaScriptSyncInWorld(&page,
+ "var i = document.getElementById(\"outer\").contentDocument;\
+ var i2 = i.getElementById(\"inner\").contentDocument;\
+ i2.getElementsByTagName(\"div\")[0].innerHTML",
+ QWebEngineScript::ApplicationWorld),
+ QVariant::fromValue(QStringLiteral("Modified Inner text")));
+}
+
QTEST_MAIN(tst_QWebEngineScript)
#include "tst_qwebenginescript.moc"
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.qrc b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.qrc
new file mode 100644
index 000000000..8b7a11cf2
--- /dev/null
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>resources/test_iframe_main.html</file>
+ <file>resources/test_iframe_outer.html</file>
+ <file>resources/test_iframe_inner.html</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
index d8c18e509..5cbcf4ec0 100644
--- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
+++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
@@ -33,6 +33,8 @@ private Q_SLOTS:
void tst_QWebEngineSettings::resetAttributes()
{
+ // QT_TODO_FIXME_ADAPT
+ QSKIP("The application deadlocks and hangs without exiting.");
QWebEngineProfile profile;
QWebEngineSettings *settings = profile.settings();
@@ -74,6 +76,8 @@ void tst_QWebEngineSettings::defaultFontFamily_data()
void tst_QWebEngineSettings::defaultFontFamily()
{
+ // QT_TODO_FIXME_ADAPT
+ QSKIP("The application deadlocks and hangs without exiting.");
QWebEngineProfile profile;
QWebEngineSettings *settings = profile.settings();
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 8f9efdbc2..f1bb181d1 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -293,12 +293,12 @@ class WebViewCrashTest : public QObject {
Q_OBJECT
QWebEngineView* m_view;
public:
- bool m_executed;
+ bool m_invokedStop;
WebViewCrashTest(QWebEngineView* view)
: m_view(view)
- , m_executed(false)
+ , m_invokedStop(false)
{
view->connect(view, SIGNAL(loadProgress(int)), this, SLOT(loading(int)));
}
@@ -306,10 +306,11 @@ public:
private Q_SLOTS:
void loading(int progress)
{
- if (progress > 1 && progress < 100) {
- QVERIFY(!m_executed);
+ qDebug() << "progress: " << progress;
+ if (progress > 0 && progress < 100) {
+ QVERIFY(!m_invokedStop);
m_view->stop();
- m_executed = true;
+ m_invokedStop = true;
}
}
};
@@ -324,7 +325,10 @@ void tst_QWebEngineView::crashTests()
WebViewCrashTest tester(&view);
QUrl url("qrc:///resources/index.html");
view.load(url);
- QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed.
+
+ // If the verification fails, it means that either stopping doesn't work, or the hardware is
+ // too slow to load the page and thus to slow to issue the first loadProgress > 0 signal.
+ QTRY_VERIFY_WITH_TIMEOUT(tester.m_invokedStop, 10000);
}
void tst_QWebEngineView::microFocusCoordinates()
@@ -1609,7 +1613,7 @@ void tst_QWebEngineView::inputMethods()
view.setHtml("<html><body>"
" <input type='text' id='input1' style='font-family: serif' value='' maxlength='20' size='50'/>"
"</body></html>");
- QVERIFY(loadFinishedSpy.wait());
+ QTRY_COMPARE(loadFinishedSpy.size(), 1);
QPoint textInputCenter = elementCenter(view.page(), "input1");
QTest::mouseClick(view.focusProxy(), Qt::LeftButton, 0, textInputCenter);
@@ -1655,8 +1659,7 @@ void tst_QWebEngineView::inputMethods()
QInputMethodEvent eventSelection1("", inputAttributes);
QApplication::sendEvent(view.focusProxy(), &eventSelection1);
- QVERIFY(selectionChangedSpy.wait());
- QCOMPARE(selectionChangedSpy.count(), 1);
+ QTRY_COMPARE(selectionChangedSpy.size(), 1);
QCOMPARE(view.focusProxy()->inputMethodQuery(Qt::ImAnchorPosition).toInt(), 3);
QCOMPARE(view.focusProxy()->inputMethodQuery(Qt::ImCursorPosition).toInt(), 5);
@@ -1667,8 +1670,7 @@ void tst_QWebEngineView::inputMethods()
inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant());
QInputMethodEvent eventSelection2("", inputAttributes);
QApplication::sendEvent(view.focusProxy(), &eventSelection2);
- QVERIFY(selectionChangedSpy.wait());
- QCOMPARE(selectionChangedSpy.count(), 2);
+ QTRY_COMPARE(selectionChangedSpy.size(), 2);
QCOMPARE(view.focusProxy()->inputMethodQuery(Qt::ImAnchorPosition).toInt(), 1);
QCOMPARE(view.focusProxy()->inputMethodQuery(Qt::ImCursorPosition).toInt(), 6);
@@ -1681,8 +1683,7 @@ void tst_QWebEngineView::inputMethods()
attributes.append(newSelection);
QInputMethodEvent eventComposition("composition", attributes);
QApplication::sendEvent(view.focusProxy(), &eventComposition);
- QVERIFY(selectionChangedSpy.wait());
- QCOMPARE(selectionChangedSpy.count(), 3);
+ QTRY_COMPARE(selectionChangedSpy.size(), 3);
QCOMPARE(view.focusProxy()->inputMethodQuery(Qt::ImCurrentSelection).toString(), QString(""));
// An ongoing composition should not change the surrounding text before it is committed.
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc b/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc
index 4809bbebf..53b11bca8 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc
@@ -4,7 +4,6 @@
<file>resources/frame_a.html</file>
<file>resources/input_types.html</file>
<file>resources/scrolltest_page.html</file>
- <file>resources/basic_printing_page.html</file>
<file>resources/keyboardEvents.html</file>
</qresource>
</RCC>
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index d260b7c4f..90352310e 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -6,8 +6,7 @@ SUBDIRS += \
qwebenginefaviconmanager \
qwebenginepage \
qwebenginehistory \
- # Skipped to due issue in 58-based. Restore once 60-based is in.
- #qwebenginehistoryinterface \
+ qwebenginehistoryinterface \
qwebengineinspector \
qwebengineprofile \
qwebenginescript \