diff options
author | Kari Oikarinen <kari.oikarinen@qt.io> | 2019-02-20 12:39:08 +0200 |
---|---|---|
committer | Kari Oikarinen <kari.oikarinen@qt.io> | 2019-02-20 12:39:08 +0200 |
commit | 0cdb13d0b66a2489fe2343ce2eaa536a3eae7adb (patch) | |
tree | 28f20cce7fed95aef697be6457b552e618163f8a /tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp | |
parent | cfaa49a9e5ec5e01c57a5621702c881ae07ab515 (diff) | |
parent | 7537526093c92e89672d1e952a9baceecaa91730 (diff) |
Merge 5.12 into 5.12.2
Change-Id: I660e890b4630fba2c6828571cac99a529f24be50
Diffstat (limited to 'tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp')
-rw-r--r-- | tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp index 2af818928..b30fc7258 100644 --- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp +++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp @@ -69,6 +69,7 @@ private Q_SLOTS: void downloadFileNot1(); void downloadFileNot2(); void downloadDeleted(); + void downloadDeletedByProfile(); private: void saveLink(QPoint linkPos); @@ -812,5 +813,36 @@ void tst_QWebEngineDownloadItem::downloadDeleted() QTRY_COMPARE(finishedCount, 1); } +void tst_QWebEngineDownloadItem::downloadDeletedByProfile() +{ + m_server->setExpectError(true); + + QPointer<QWebEngineProfile> profile(new QWebEngineProfile); + profile->setHttpCacheType(QWebEngineProfile::NoCache); + profile->settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); + + bool downloadFinished = false; + QPointer<QWebEngineDownloadItem> downloadItem; + connect(profile, &QWebEngineProfile::downloadRequested, [&] (QWebEngineDownloadItem *item) { + connect(item, &QWebEngineDownloadItem::finished, [&] () { + downloadFinished = true; + }); + downloadItem = item; + item->accept(); + }); + + QPointer<QWebEnginePage> page(new QWebEnginePage(profile)); + page->download(m_server->url(QByteArrayLiteral("/file"))); + + QTRY_COMPARE(downloadItem.isNull(), false); + QVERIFY(downloadItem); + + page->deleteLater(); + profile->deleteLater(); + + QTRY_COMPARE(downloadFinished, true); + QTRY_COMPARE(downloadItem.isNull(), true); +} + QTEST_MAIN(tst_QWebEngineDownloadItem) #include "tst_qwebenginedownloaditem.moc" |