summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 7a89e2439..0ad460634 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -50,6 +50,7 @@ private Q_SLOTS:
void defaultProfile();
void profileConstructors();
void urlSchemeHandlers();
+ void urlSchemeHandlerFailRequest();
};
void tst_QWebEngineProfile::defaultProfile()
@@ -147,5 +148,27 @@ void tst_QWebEngineProfile::urlSchemeHandlers()
QVERIFY(toPlainTextSync(view.page()) != url.toString());
}
+class FailingUrlSchemeHandler : public QWebEngineUrlSchemeHandler
+{
+public:
+ void requestStarted(QWebEngineUrlRequestJob *job) override
+ {
+ job->fail(QWebEngineUrlRequestJob::RequestFailed);
+ }
+};
+
+void tst_QWebEngineProfile::urlSchemeHandlerFailRequest()
+{
+ FailingUrlSchemeHandler handler;
+ QWebEngineProfile profile;
+ profile.installUrlSchemeHandler("foo", &handler);
+ QWebEngineView view;
+ QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool)));
+ view.setPage(new QWebEnginePage(&profile, &view));
+ view.load(QUrl(QStringLiteral("foo://bar")));
+ QVERIFY(loadFinishedSpy.wait());
+ QVERIFY(toPlainTextSync(view.page()).isEmpty());
+}
+
QTEST_MAIN(tst_QWebEngineProfile)
#include "tst_qwebengineprofile.moc"