summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-12 11:32:02 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-12 11:35:45 +0100
commita077399f4c17f57e911334867c918cc6ddeb15fc (patch)
treec8e4d326d7a074e9d16b68399ecc5f728f8533fe /tests
parent3d698f5de377bde2293e222536bc50171cfdf1b8 (diff)
parent12dd6ff845656eb625e2ee3d0e73392bc2c61983 (diff)
Merge branch '5.6' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp8
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml12
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadUrl.qml2
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp61
-rw-r--r--tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp6
-rw-r--r--tests/auto/quick/quick.pro3
-rw-r--r--tests/auto/widgets/qwebengineaccessibility/BLACKLIST6
-rw-r--r--tests/auto/widgets/qwebenginepage/BLACKLIST5
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp25
-rw-r--r--tests/auto/widgets/tests.pri4
-rw-r--r--tests/quicktestbrowser/main.cpp14
11 files changed, 87 insertions, 59 deletions
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 135d9167f..face62352 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -46,6 +46,7 @@
#include <QMetaType>
#include <QQmlListProperty>
#include <QtTest/QtTest>
+#include <QtWebEngine/QQuickWebEngineProfile>
#include <private/qquickwebengineview_p.h>
#include <private/qquickwebenginecertificateerror_p.h>
#include <private/qquickwebenginedownloaditem_p.h>
@@ -53,7 +54,6 @@
#include <private/qquickwebengineloadrequest_p.h>
#include <private/qquickwebenginenavigationrequest_p.h>
#include <private/qquickwebenginenewviewrequest_p.h>
-#include <private/qquickwebengineprofile_p.h>
#include <private/qquickwebenginescript_p.h>
#include <private/qquickwebenginesettings_p.h>
#include <private/qquickwebenginesingleton_p.h>
@@ -149,6 +149,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.DownloadMediaToDisk --> WebAction"
<< "QQuickWebEngineView.InspectElement --> WebAction"
<< "QQuickWebEngineView.ExitFullScreen --> WebAction"
+ << "QQuickWebEngineView.RequestClose --> WebAction"
<< "QQuickWebEngineView.WebActionCount --> WebAction"
<< "QQuickWebEngineView.InfoMessageLevel --> JavaScriptConsoleMessageLevel"
<< "QQuickWebEngineView.WarningMessageLevel --> JavaScriptConsoleMessageLevel"
@@ -195,6 +196,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.activeFocusOnPressChanged(bool) --> void"
<< "QQuickWebEngineView.backgroundColorChanged() --> void"
<< "QQuickWebEngineView.renderProcessTerminated(RenderProcessTerminationStatus,int) --> void"
+ << "QQuickWebEngineView.windowCloseRequested() --> void"
<< "QQuickWebEngineView.runJavaScript(QString,QJSValue) --> void"
<< "QQuickWebEngineView.runJavaScript(QString) --> void"
<< "QQuickWebEngineView.loadHtml(QString,QUrl) --> void"
@@ -289,7 +291,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void"
<< "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void"
<< "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void"
- << "QQuickWebEngineProfile.setCookieStore(QWebEngineCookieStore*) --> void"
+ << "QQuickWebEngineProfile.cookieStore() --> QWebEngineCookieStore*"
<< "QQuickWebEngineScript.Deferred --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentReady --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentCreation --> InjectionPoint"
@@ -343,8 +345,10 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineSettings.pluginsEnabledChanged() --> void"
<< "QQuickWebEngineSettings.fullScreenSupportEnabledChanged() --> void"
<< "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void"
+ << "QQuickWebEngineFullScreenRequest.origin --> QUrl"
<< "QQuickWebEngineFullScreenRequest.toggleOn --> bool"
<< "QQuickWebEngineFullScreenRequest.accept() --> void"
+ << "QQuickWebEngineFullScreenRequest.reject() --> void"
<< "QQuickWebEngineSingleton.settings --> QQuickWebEngineSettings*"
<< "QQuickWebEngineSingleton.defaultProfile --> QQuickWebEngineProfile*"
;
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index ffd7041e3..415318ed7 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -66,23 +66,26 @@ TestWebEngineView {
signalName: "downloadFinished"
}
+ Connections {
+ id: downloadItemConnections
+ onStateChanged: downloadState.push(target.state)
+ }
+
WebEngineProfile {
id: testDownloadProfile
onDownloadRequested: {
downloadState.push(download.state)
+ downloadItemConnections.target = download
if (cancelDownload) {
download.cancel()
- downloadState.push(download.state)
} else {
totalBytes = download.totalBytes
download.path = "testfile.zip"
download.accept()
- downloadState.push(download.state)
}
}
onDownloadFinished: {
- downloadState.push(download.state)
receivedBytes = download.receivedBytes;
}
}
@@ -96,6 +99,7 @@ TestWebEngineView {
totalBytes = 0
receivedBytes = 0
cancelDownload = false
+ downloadItemConnections.target = null
downloadState = []
}
@@ -133,7 +137,7 @@ TestWebEngineView {
downLoadRequestedSpy.wait()
compare(downLoadRequestedSpy.count, 1)
compare(downloadFinishedSpy.count, 1)
- compare(downloadState[2], WebEngineDownloadItem.DownloadCancelled)
+ compare(downloadState[1], WebEngineDownloadItem.DownloadCancelled)
}
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
index c8abf2bb0..31296f45c 100644
--- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
@@ -144,6 +144,8 @@ TestWebEngineView {
var dataUrl = "data:text/html,foo"
webEngineView.url = dataUrl
compare(webEngineView.url, dataUrl)
+ verify(webEngineView.waitForLoadSucceeded()) // data:text/html,foo is loaded
+ compare(webEngineView.url, dataUrl)
var redirectUrl = Qt.resolvedUrl("redirect.html")
webEngineView.url = redirectUrl
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 40dc3cb61..cb566c254 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -61,7 +61,9 @@ private Q_SLOTS:
private:
inline QQuickWebEngineView *newWebEngineView();
inline QQuickWebEngineView *webEngineView() const;
+ QUrl urlFromTestPath(const char *localFilePath);
void runJavaScript(const QString &script);
+ QString m_testSourceDirPath;
QScopedPointer<TestWindow> m_window;
QScopedPointer<QQmlComponent> m_component;
};
@@ -70,6 +72,10 @@ tst_QQuickWebEngineView::tst_QQuickWebEngineView()
{
QtWebEngine::initialize();
+ m_testSourceDirPath = QString::fromLocal8Bit(TESTS_SOURCE_DIR);
+ if (!m_testSourceDirPath.endsWith(QLatin1Char('/')))
+ m_testSourceDirPath.append(QLatin1Char('/'));
+
static QQmlEngine *engine = new QQmlEngine(this);
m_component.reset(new QQmlComponent(engine, this));
m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n"
@@ -100,6 +106,11 @@ inline QQuickWebEngineView *tst_QQuickWebEngineView::webEngineView() const
return static_cast<QQuickWebEngineView*>(m_window->webEngineView.data());
}
+QUrl tst_QQuickWebEngineView::urlFromTestPath(const char *localFilePath)
+{
+ return QUrl::fromLocalFile(m_testSourceDirPath + QString::fromUtf8(localFilePath));
+}
+
void tst_QQuickWebEngineView::runJavaScript(const QString &script)
{
webEngineView()->runJavaScript(script);
@@ -119,7 +130,7 @@ void tst_QQuickWebEngineView::stopEnabledAfterLoadStarted()
QCOMPARE(webEngineView()->isLoading(), false);
LoadStartedCatcher catcher(webEngineView());
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
waitForSignal(&catcher, SIGNAL(finished()));
QCOMPARE(webEngineView()->isLoading(), true);
@@ -149,7 +160,7 @@ void tst_QQuickWebEngineView::loadEmptyPageViewHidden()
{
QSignalSpy loadSpy(webEngineView(), SIGNAL(loadingChanged(QQuickWebEngineLoadRequest*)));
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
QCOMPARE(loadSpy.size(), 2);
@@ -159,7 +170,7 @@ void tst_QQuickWebEngineView::loadNonexistentFileUrl()
{
QSignalSpy loadSpy(webEngineView(), SIGNAL(loadingChanged(QQuickWebEngineLoadRequest*)));
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/file_that_does_not_exist.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/file_that_does_not_exist.html"));
QVERIFY(waitForLoadFailed(webEngineView()));
QCOMPARE(loadSpy.size(), 2);
@@ -167,46 +178,46 @@ void tst_QQuickWebEngineView::loadNonexistentFileUrl()
void tst_QQuickWebEngineView::backAndForward()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page2.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page2.html"));
webEngineView()->goBack();
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
webEngineView()->goForward();
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page2.html"));
}
void tst_QQuickWebEngineView::reload()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
webEngineView()->reload();
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
}
void tst_QQuickWebEngineView::stop()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
webEngineView()->stop();
}
@@ -215,7 +226,7 @@ void tst_QQuickWebEngineView::loadProgress()
{
QCOMPARE(webEngineView()->loadProgress(), 0);
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QSignalSpy loadProgressChangedSpy(webEngineView(), SIGNAL(loadProgressChanged()));
QVERIFY(waitForLoadSucceeded(webEngineView()));
@@ -234,7 +245,7 @@ void tst_QQuickWebEngineView::show()
void tst_QQuickWebEngineView::showWebEngineView()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/direct-image-compositing.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/direct-image-compositing.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
m_window->show();
// This should not crash.
@@ -268,12 +279,12 @@ void tst_QQuickWebEngineView::multipleWebEngineViewWindows()
QQuickWebEngineView *webEngineView2 = newWebEngineView();
QScopedPointer<TestWindow> window2(new TestWindow(webEngineView2));
- webEngineView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/scroll.html")));
+ webEngineView1->setUrl(urlFromTestPath("html/scroll.html"));
QVERIFY(waitForLoadSucceeded(webEngineView1));
window1->show();
webEngineView1->setVisible(true);
- webEngineView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView2->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView2));
window2->show();
webEngineView2->setVisible(true);
@@ -291,12 +302,12 @@ void tst_QQuickWebEngineView::multipleWebEngineViews()
webEngineView2->setParentItem(m_window->contentItem());
webEngineView1->setSize(QSizeF(300, 400));
- webEngineView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/scroll.html")));
+ webEngineView1->setUrl(urlFromTestPath("html/scroll.html"));
QVERIFY(waitForLoadSucceeded(webEngineView1.data()));
webEngineView1->setVisible(true);
webEngineView2->setSize(QSizeF(300, 400));
- webEngineView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView2->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView2.data()));
webEngineView2->setVisible(true);
QTest::qWait(200);
@@ -325,14 +336,14 @@ void tst_QQuickWebEngineView::titleUpdate()
QSignalSpy titleSpy(webEngineView(), SIGNAL(titleChanged()));
// Load page with no title
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page2.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
QCOMPARE(titleSpy.size(), 1);
titleSpy.clear();
// No titleChanged signal for failed load
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/file_that_does_not_exist.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/file_that_does_not_exist.html"));
QVERIFY(waitForLoadFailed(webEngineView()));
QCOMPARE(titleSpy.size(), 0);
}
@@ -357,7 +368,7 @@ void tst_QQuickWebEngineView::transparentWebEngineViews()
webEngineView1->setVisible(true);
webEngineView2->setSize(QSizeF(300, 400));
- webEngineView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
+ webEngineView2->setUrl(urlFromTestPath("/html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView2.data()));
webEngineView2->setVisible(true);
@@ -388,7 +399,7 @@ void tst_QQuickWebEngineView::inputMethod()
QSKIP("QQUICKWEBENGINEVIEW_ITEMACCEPTSINPUTMETHOD");
#else
QQuickWebEngineView *view = webEngineView();
- view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/inputmethod.html")));
+ view->setUrl(urlFromTestPath("html/inputmethod.html"));
QVERIFY(waitForLoadSucceeded(view));
QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
@@ -406,7 +417,7 @@ void tst_QQuickWebEngineView::inputMethodHints()
#else
QQuickWebEngineView *view = webEngineView();
- view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/inputmethod.html")));
+ view->setUrl(urlFromTestPath("html/inputmethod.html"));
QVERIFY(waitForLoadSucceeded(view));
// Setting focus on an input element results in an element in its shadow tree becoming the focus node.
diff --git a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
index e0e876fc8..a969993ff 100644
--- a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
+++ b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
@@ -154,13 +154,13 @@ void tst_QQuickWebEngineViewGraphics::showHideShow()
setHtml(greenSquare);
QSignalSpy exposeSpy(m_view.data(), SIGNAL(exposeChanged()));
m_view->show();
- QVERIFY(exposeSpy.wait(500));
+ QVERIFY(exposeSpy.wait());
QCOMPARE(m_view->grabWindow(), get150x150GreenReferenceImage());
m_view->hide();
- QVERIFY(exposeSpy.wait(500));
+ QVERIFY(exposeSpy.wait());
m_view->show();
- QVERIFY(exposeSpy.wait(500));
+ QVERIFY(exposeSpy.wait());
QCOMPARE(m_view->grabWindow(), get150x150GreenReferenceImage());
}
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 71bc61b9e..33821e20b 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -3,6 +3,7 @@ TEMPLATE = subdirs
SUBDIRS += \
inspectorserver \
publicapi \
- qmltests \
qquickwebengineview \
qquickwebengineviewgraphics
+
+isQMLTestSupportApiEnabled(): SUBDIRS += qmltests
diff --git a/tests/auto/widgets/qwebengineaccessibility/BLACKLIST b/tests/auto/widgets/qwebengineaccessibility/BLACKLIST
new file mode 100644
index 000000000..0450f8c1c
--- /dev/null
+++ b/tests/auto/widgets/qwebengineaccessibility/BLACKLIST
@@ -0,0 +1,6 @@
+[hierarchy]
+windows
+[text]
+windows
+[value]
+windows
diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST
new file mode 100644
index 000000000..91858f299
--- /dev/null
+++ b/tests/auto/widgets/qwebenginepage/BLACKLIST
@@ -0,0 +1,5 @@
+[geolocationRequestJS]
+*
+
+[macCopyUnicodeToClipboard]
+osx
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 50914a920..8fd71c701 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -3479,16 +3479,16 @@ void tst_QWebEnginePage::getUserMediaRequest()
QVERIFY(evaluateJavaScriptSync(page, QStringLiteral("!!navigator.webkitGetUserMedia")).toBool());
evaluateJavaScriptSync(page, QStringLiteral("navigator.webkitGetUserMedia({audio: true}, function() {}, function(){})"));
- QTRY_VERIFY_WITH_TIMEOUT(page->gotFeatureRequest(QWebEnginePage::MediaAudioCapture), 100);
+ QTRY_VERIFY(page->gotFeatureRequest(QWebEnginePage::MediaAudioCapture));
// Might end up failing due to the lack of physical media devices deeper in the content layer, so the JS callback is not guaranteed to be called,
// but at least we go through that code path, potentially uncovering failing assertions.
page->acceptPendingRequest();
page->runJavaScript(QStringLiteral("errorCallbackCalled = false;"));
evaluateJavaScriptSync(page, QStringLiteral("navigator.webkitGetUserMedia({audio: true, video: true}, function() {}, function(){errorCallbackCalled = true;})"));
- QTRY_VERIFY_WITH_TIMEOUT(page->gotFeatureRequest(QWebEnginePage::MediaAudioVideoCapture), 100);
+ QTRY_VERIFY(page->gotFeatureRequest(QWebEnginePage::MediaAudioVideoCapture));
page->rejectPendingRequest(); // Should always end up calling the error callback in JS.
- QTRY_VERIFY_WITH_TIMEOUT(evaluateJavaScriptSync(page, QStringLiteral("errorCallbackCalled;")).toBool(), 100);
+ QTRY_VERIFY(evaluateJavaScriptSync(page, QStringLiteral("errorCallbackCalled;")).toBool());
delete page;
}
@@ -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());
@@ -3797,10 +3796,14 @@ void tst_QWebEnginePage::symmetricUrl()
QCOMPARE(view.url(), dataUrl3);
+ // setUrl(dataUrl3) might override the pending load for dataUrl2. Or not.
QTRY_VERIFY(loadFinishedSpy.count() >= 2);
- QTRY_COMPARE(loadFinishedSpy.count(), 3);
+ QTRY_VERIFY(loadFinishedSpy.count() <= 3);
- QCOMPARE(view.history()->count(), 2);
+ // setUrl(dataUrl3) might stop Chromium from adding a navigation entry for dataUrl2,
+ // depending on whether the load of dataUrl2 could be completed in time.
+ QVERIFY(view.history()->count() >= 2);
+ QVERIFY(view.history()->count() <= 3);
QCOMPARE(toPlainTextSync(view.page()), QString("Test3"));
}
@@ -4042,7 +4045,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 +4054,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 +4116,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 +5075,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);
}
diff --git a/tests/auto/widgets/tests.pri b/tests/auto/widgets/tests.pri
index afdf46f42..8a62ce2a6 100644
--- a/tests/auto/widgets/tests.pri
+++ b/tests/auto/widgets/tests.pri
@@ -1,8 +1,6 @@
TEMPLATE = app
-# FIXME: Re-enable once we want to run tests on the CI
-# CONFIG += testcase
-
+CONFIG += testcase
CONFIG += c++11
VPATH += $$_PRO_FILE_PWD_
diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp
index 12ebfa2d5..61977a018 100644
--- a/tests/quicktestbrowser/main.cpp
+++ b/tests/quicktestbrowser/main.cpp
@@ -52,6 +52,7 @@ typedef QGuiApplication Application;
#include <QtQml/QQmlContext>
#include <QtQml/QQmlComponent>
#include <QtWebEngine/qtwebengineglobal.h>
+#include <QtWebEngine/QQuickWebEngineProfile>
#include <QtWebEngineCore/qwebenginecookiestore.h>
static QUrl startupUrl()
@@ -84,17 +85,10 @@ int main(int argc, char **argv)
appEngine.load(QUrl("qrc:/ApplicationRoot.qml"));
QObject *rootObject = appEngine.rootObjects().first();
- QQmlComponent component(&appEngine);
- component.setData(QByteArrayLiteral("import QtQuick 2.0\n"
- "import QtWebEngine 1.1\n"
- "WebEngineProfile {\n"
- "storageName: \"Test\"\n"
- "}")
- , QUrl());
- QObject *profile = component.create();
+ QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(rootObject);
+ QWebEngineCookieStore *client = profile->cookieStore();
+
const QMetaObject *rootMeta = rootObject->metaObject();
- QWebEngineCookieStore *client = 0;
- QMetaObject::invokeMethod(profile, "cookieStore", Q_RETURN_ARG(QWebEngineCookieStore*, client));
int index = rootMeta->indexOfProperty("thirdPartyCookiesEnabled");
Q_ASSERT(index != -1);
QMetaProperty thirdPartyCookiesProperty = rootMeta->property(index);