diff options
-rw-r--r-- | src/webenginewidgets/api/qwebenginedownloaditem.cpp | 1 | ||||
-rw-r--r-- | tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp index 9fdab3367..bb5fed8af 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp +++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp @@ -84,7 +84,6 @@ QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QWebEngineProfilePr QWebEngineDownloadItemPrivate::~QWebEngineDownloadItemPrivate() { - profile->downloadDestroyed(downloadId); } void QWebEngineDownloadItemPrivate::update(const BrowserContextAdapterClient::DownloadItemInfo &info) diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 287e2364a..23a56a9cb 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -42,6 +42,7 @@ #include <QtWebEngineWidgets/qwebengineprofile.h> #include <QtWebEngineWidgets/qwebenginesettings.h> #include <QtWebEngineWidgets/qwebengineview.h> +#include <QtWebEngineWidgets/qwebenginedownloaditem.h> class tst_QWebEngineProfile : public QObject { @@ -54,6 +55,7 @@ private Q_SLOTS: void urlSchemeHandlerFailRequest(); void customUserAgent(); void httpAcceptLanguage(); + void downloadItem(); }; void tst_QWebEngineProfile::defaultProfile() @@ -245,5 +247,16 @@ void tst_QWebEngineProfile::httpAcceptLanguage() QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.languages")).toStringList(), QStringList(testLang)); } +void tst_QWebEngineProfile::downloadItem() +{ + qRegisterMetaType<QWebEngineDownloadItem *>(); + QWebEngineProfile testProfile; + QWebEnginePage page(&testProfile); + QSignalSpy downloadSpy(&testProfile, SIGNAL(downloadRequested(QWebEngineDownloadItem *))); + connect(&testProfile, &QWebEngineProfile::downloadRequested, this, [=] (QWebEngineDownloadItem *item) { item->accept(); }); + page.load(QUrl::fromLocalFile(QCoreApplication::applicationFilePath())); + QTRY_COMPARE(downloadSpy.count(), 1); +} + QTEST_MAIN(tst_QWebEngineProfile) #include "tst_qwebengineprofile.moc" |