diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-04 11:43:54 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-04 11:45:58 +0100 |
commit | 2b3f5b66af4f06a57216575a44f54c1d20fb12a0 (patch) | |
tree | b58f6a31b9d97b4693d485ea1a794fa6b8c5d875 /tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp | |
parent | 4dc312011bcaa2ee2cf812b5b84dc9238130e608 (diff) | |
parent | 56fadb571f32b721d8b99554e6e38692009ec37f (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I1dd136df7004b11e2f38a2ec4e82a6fa81627479
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 32823d30d..ee1e6ee04 100644 --- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp +++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp @@ -70,6 +70,7 @@ private Q_SLOTS: void downloadFileNot1(); void downloadFileNot2(); void downloadDeleted(); + void downloadDeletedByProfile(); void downloadUniqueFilename_data(); void downloadUniqueFilename(); void downloadUniqueFileNameWithTimeStamp(); @@ -821,6 +822,37 @@ 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); +} + void tst_QWebEngineDownloadItem::downloadUniqueFilename_data() { QTest::addColumn<QString>("baseName"); |