diff options
Diffstat (limited to 'tests')
5 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/core/certificateerror/tst_certificateerror.cpp b/tests/auto/core/certificateerror/tst_certificateerror.cpp index 67e2d8ae4..61201e250 100644 --- a/tests/auto/core/certificateerror/tst_certificateerror.cpp +++ b/tests/auto/core/certificateerror/tst_certificateerror.cpp @@ -19,6 +19,7 @@ private Q_SLOTS: void handleError_data(); void handleError(); void fatalError(); + void resourceError(); }; struct PageWithCertificateErrorHandler : QWebEnginePage @@ -130,5 +131,20 @@ void tst_CertificateError::fatalError() } } +void tst_CertificateError::resourceError() +{ + PageWithCertificateErrorHandler page(false, false); + page.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); + + page.setHtml("<img src=\"https://expired.badssl.com\">"); + if (!page.loadSpy.wait(10000)) { + QVERIFY2(!page.error, "There shouldn't be any certificate error if not loaded due to missing internet access!"); + QSKIP("Couldn't load page from network, skipping test."); + } + + QTRY_VERIFY(page.error); + QCOMPARE(page.error->isMainFrame(), false); +} + QTEST_MAIN(tst_CertificateError) #include <tst_certificateerror.moc> diff --git a/tests/auto/core/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/core/qwebengineframe/tst_qwebengineframe.cpp index b70a655d3..7cd075443 100644 --- a/tests/auto/core/qwebengineframe/tst_qwebengineframe.cpp +++ b/tests/auto/core/qwebengineframe/tst_qwebengineframe.cpp @@ -37,6 +37,7 @@ private Q_SLOTS: void childrenOfInvalidFrame(); void url(); void size(); + void runJavaScript(); private: }; @@ -175,6 +176,19 @@ void tst_QWebEngineFrame::size() QCOMPARE(frame1.size(), QSizeF()); } +void tst_QWebEngineFrame::runJavaScript() +{ + QWebEnginePage page; + QSignalSpy loadSpy{ &page, SIGNAL(loadFinished(bool)) }; + page.load(QUrl("qrc:/resources/iframes.html")); + QTRY_COMPARE(loadSpy.size(), 1); + auto children = page.mainFrame().children(); + CallbackSpy<QVariant> spy; + children[0].runJavaScript("window.name", spy.ref()); + auto result = spy.waitForResult(); + QCOMPARE(result, QString("test-subframe0")); +} + QTEST_MAIN(tst_QWebEngineFrame) #include "tst_qwebengineframe.moc" diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 4d9d02bca..990b1de4f 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -134,6 +134,7 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineCertificateError.defer() --> void" << "QWebEngineCertificateError.description --> QString" << "QWebEngineCertificateError.type --> QWebEngineCertificateError::Type" + << "QWebEngineCertificateError.isMainFrame --> bool" << "QWebEngineCertificateError.acceptCertificate() --> void" << "QWebEngineCertificateError.overridable --> bool" << "QWebEngineCertificateError.rejectCertificate() --> void" @@ -887,6 +888,10 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineFrame.htmlName --> QString" << "QWebEngineFrame.isValid --> bool" << "QWebEngineFrame.name --> QString" + << "QWebEngineFrame.runJavaScript(QString) --> void" + << "QWebEngineFrame.runJavaScript(QString,uint) --> void" + << "QWebEngineFrame.runJavaScript(QString,QJSValue) --> void" + << "QWebEngineFrame.runJavaScript(QString,uint,QJSValue) --> void" << "QWebEngineFrame.size --> QSizeF" << "QWebEngineFrame.url --> QUrl" ; diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 5bd33332b..cebdaaa47 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -205,7 +205,11 @@ void tst_QWebEngineProfile::clearDataFromCache() QCOMPARE_GT(sizeBeforeClear, 0); profile.clearHttpCache(); QTRY_COMPARE(cacheSpy.size(), 1); +#if defined(Q_OS_WIN) + QTRY_COMPARE_GT(sizeBeforeClear, totalSize(cacheDir)); +#else QCOMPARE_GT(sizeBeforeClear, totalSize(cacheDir)); +#endif (void)server.stop(); } diff --git a/tests/manual/quick/pdf/withdoc.qml b/tests/manual/quick/pdf/withdoc.qml index d4bf12e29..0a2a86630 100644 --- a/tests/manual/quick/pdf/withdoc.qml +++ b/tests/manual/quick/pdf/withdoc.qml @@ -19,6 +19,11 @@ Window { onPasswordRequired: function() { passwordDialog.open() } } + Component.onCompleted: { + if (Application.arguments.length > 2) + doc.source = Application.arguments[Application.arguments.length - 1] + } + FileDialog { id: fileDialog title: "Open a PDF file" @@ -85,6 +90,7 @@ Window { PdfPageImage { id: image document: doc + retainWhileLoading: true property real zoomFactor: Math.sqrt(2) |