From f39626b4394b906ea77f35db20bb667f0310b7ed Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Date: Mon, 7 Dec 2015 16:41:23 +0100
Subject: [PATCH] stabilize tst_qwebenginepage some more

Remove a qWait, and use the default timeout of waitForSignal.
Do not expect the CI to be as fast as your desktop machine.

Change-Id: I30b060422a285a2110ee7e065a3f17f80039e775
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
---
 .../widgets/qwebenginepage/tst_qwebenginepage.cpp     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 50914a920..d7e11eb06 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -3749,8 +3749,7 @@ void tst_QWebEnginePage::fullScreenRequested()
     });
 
     QTest::keyPress(qApp->focusWindow(), Qt::Key_Space);
-    QTest::qWait(100);
-    page->runJavaScript("document.webkitIsFullScreen", JavaScriptCallback(true));
+    QTRY_VERIFY(evaluateJavaScriptSync(page, "document.webkitIsFullScreen").toBool());
     page->runJavaScript("document.webkitExitFullscreen()", JavaScriptCallbackUndefined());
     QVERIFY(watcher.wait());
 
@@ -4042,7 +4041,7 @@ void tst_QWebEnginePage::setHtmlWithImageResource()
     QWebEnginePage page;
 
     page.setHtml(html, QUrl(QLatin1String("file:///path/to/file")));
-    waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
+    waitForSignal(&page, SIGNAL(loadFinished(bool)));
 
     QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
     QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128);
@@ -4051,7 +4050,7 @@ void tst_QWebEnginePage::setHtmlWithImageResource()
     // Now we test the opposite: without a baseUrl as a local file, we cannot request local resources.
 
     page.setHtml(html);
-    waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
+    waitForSignal(&page, SIGNAL(loadFinished(bool)));
     QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
     QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue);
     QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 0);
@@ -4113,7 +4112,7 @@ void tst_QWebEnginePage::setHtmlWithBaseURL()
     QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
 
     page.setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
-    waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
+    waitForSignal(&page, SIGNAL(loadFinished(bool)));
     QCOMPARE(spy.count(), 1);
 
     QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
@@ -5072,7 +5071,7 @@ void tst_QWebEnginePage::loadInSignalHandlers()
     URLSetter setter(m_page, signal, type, urlForSetter);
 
     m_page->load(url);
-    waitForSignal(&setter, SIGNAL(finished()), 200);
+    waitForSignal(&setter, SIGNAL(finished()));
     QCOMPARE(m_page->url(), urlForSetter);
 }
 
-- 
GitLab