From f39626b4394b906ea77f35db20bb667f0310b7ed Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 7 Dec 2015 16:41:23 +0100 Subject: 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 --- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests') 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); } -- cgit v1.2.3 From 468c5484a065165fd6a5afdecdb1ab09cc79779c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 29 Oct 2015 16:56:06 +0100 Subject: enable tests/auto/widgets Enable autotests and blacklist tests that are known to fail. Change-Id: Iea23c69aa5a7bbd44c21803e352d17a92e9178a0 Reviewed-by: Simon Hausmann --- tests/auto/widgets/qwebengineaccessibility/BLACKLIST | 6 ++++++ tests/auto/widgets/qwebenginepage/BLACKLIST | 5 +++++ tests/auto/widgets/tests.pri | 4 +--- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 tests/auto/widgets/qwebengineaccessibility/BLACKLIST create mode 100644 tests/auto/widgets/qwebenginepage/BLACKLIST (limited to 'tests') 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/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_ -- cgit v1.2.3 From a736ef46564ca88a96370f1ac41b7f4b82cb2462 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 8 Dec 2015 18:49:34 +0100 Subject: Stabilize tst_download.qml Connect to WebEngineViewDownloadItem.stateChanged to collect state changes. This makes sure that state changes from tests that ran before do not interfere with the current test. Change-Id: I360ac325711bf041f82375b3714a9cfe7a42398c Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/data/tst_download.qml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests') 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) } } } -- cgit v1.2.3 From 9daa85a3f12c6ce0e6908598c6f54a7dac28ce79 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 9 Dec 2015 12:26:44 +0100 Subject: Stabilize tst_QWebEnginePage::getUserMediaRequest Do not use 100 ms timeouts. Change-Id: Ied4a9a8b9af6ac33c025930a823d334000be2945 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index d7e11eb06..8fb76492e 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; } -- cgit v1.2.3 From 890b9cf4d38c449374d50c04eb4aaca4b09a5d5a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 8 Dec 2015 11:35:24 +0100 Subject: Update tests/auto/quick/publicapi Change-Id: Ia40857762cffb8e9fc47b55e3f9e41a177a6fa26 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/publicapi/tst_publicapi.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 135d9167f..9bb4711fc 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -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*" ; -- cgit v1.2.3 From 30fe6b91128e08cae583eb6105ce95f76f743fe1 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 8 Dec 2015 17:45:20 +0100 Subject: Fix path issues tst_QQuickWebEngineView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compare URLs, not paths. This saves us a bunch of conversions and fixes the test on Windows. Change-Id: Iaf91e7be2b015545bb7b2b1141bc316f85e629ea Reviewed-by: Michael BrĂ¼ning Reviewed-by: Allan Sandfeld Jensen --- .../tst_qquickwebengineview.cpp | 61 +++++++++++++--------- 1 file changed, 36 insertions(+), 25 deletions(-) (limited to 'tests') 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 m_window; QScopedPointer 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(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 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. -- cgit v1.2.3 From 66988974a0eba36b6523b771bf6b078aa155a810 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 11 Dec 2015 12:54:10 +0100 Subject: Build qmltests only if QML testsupport API is available Change-Id: Id54356024f60e5f877271b29895912e2bf0cb84f Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/quick.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') 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 -- cgit v1.2.3 From 28b08c849efc361b42e79b69e76541d9b0faddd9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 27 Nov 2015 16:15:32 +0100 Subject: Make QQuickWebEngineProfile public Make QQuickWebEngineProfile a publicly exported class. This allows users to set up and manipulate the profile from C++, and removes the ugly hack needed to access the cookie store. Change-Id: I99e1a8c2cb99d9d1a14e1c78bec5948ba1282fb3 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/publicapi/tst_publicapi.cpp | 2 +- tests/quicktestbrowser/main.cpp | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 9bb4711fc..face62352 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -53,7 +54,6 @@ #include #include #include -#include #include #include #include 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 #include #include +#include #include 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); -- cgit v1.2.3 From d239b60313f798cf75a4e34a768d9f4a1fc8f92a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 11 Dec 2015 13:45:21 +0100 Subject: Stabilize test_urlProperty Pulls in Chromium patches that fixes crashes in the test, and add a missing waitForLoadSucceeded, that otherwise might cause the next test to fail. Task-number: QTBUG-48031 Change-Id: I4844aee0ccf159e50de955f3b3da704160a4a0f5 Reviewed-by: Joerg Bornemann --- tests/auto/quick/qmltests/data/tst_loadUrl.qml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3 From 27fc4fb2076ae54825f56914a0759e20b7e9c782 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 21 Dec 2015 14:48:42 +0100 Subject: Stabilize tst_QQuickWebEngineViewGraphics::showHideShow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increase wait timeouts to let the test pass under heavy conditions. Change-Id: I412d5d6a33c33ce698e15a487355c5a5e51a9905 Reviewed-by: Michael BrĂ¼ning --- .../qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') 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()); } -- cgit v1.2.3 From 8f6684a01cf6d8a4c203bb44698b0a61bcfa8bd2 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 8 Jan 2016 13:11:59 +0100 Subject: Stabilize tst_QWebEnginePage::symmetricUrl The sequence view.setUrl(dataUrl2); view.setUrl(dataUrl3); might result in a navigation entry for dataUrl2 or not, depending on whether the first call completes before the second call would overwrite the pending load. Change-Id: I487ada16517daa218078af007083a68c01697c9c Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 8fb76492e..82fe03344 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -3799,7 +3799,10 @@ void tst_QWebEnginePage::symmetricUrl() QTRY_VERIFY(loadFinishedSpy.count() >= 2); QTRY_COMPARE(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")); } -- cgit v1.2.3 From 9a8fe6c59a41f7a42ee0cf14e536202bd5be3a64 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 11 Jan 2016 10:22:58 +0100 Subject: Stabilize tst_QWebEnginePage::symmetricUrl some more The second call to setUrl might override the first setUrl, depending on the timing. Change-Id: I30a8257751be3256a61668bd57195b1a12154d68 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 82fe03344..8fd71c701 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -3796,8 +3796,9 @@ 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); // setUrl(dataUrl3) might stop Chromium from adding a navigation entry for dataUrl2, // depending on whether the load of dataUrl2 could be completed in time. -- cgit v1.2.3