From 76112815630387c503ff31238fa6b91186a33db8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 9 Sep 2016 15:15:10 +0200 Subject: [PATCH] Add basename to "download finished" message --- qutebrowser/browser/webkit/downloads.py | 2 +- tests/end2end/features/misc.feature | 2 +- tests/end2end/features/test_downloads_bdd.py | 8 +++++++- tests/end2end/test_invocations.py | 6 ++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/qutebrowser/browser/webkit/downloads.py b/qutebrowser/browser/webkit/downloads.py index 358d13015..9b641c4f9 100644 --- a/qutebrowser/browser/webkit/downloads.py +++ b/qutebrowser/browser/webkit/downloads.py @@ -657,7 +657,7 @@ class DownloadItem(QObject): self.reply = None self.finished.emit() self.done = True - log.downloads.debug("Download finished") + log.downloads.debug("Download {} finished".format(self.basename)) self.data_changed.emit() @pyqtSlot() diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 6d746c775..43e6c65f0 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -308,7 +308,7 @@ Feature: Various utility commands. When I set content -> enable-pdfjs to false And I set storage -> prompt-download-directory to false And I open data/misc/test.pdf - Then "Download finished" should be logged + Then "Download test.pdf finished" should be logged @qtwebengine_todo: pdfjs is not implemented yet Scenario: Downloading a pdf via pdf.js button (issue 1214) diff --git a/tests/end2end/features/test_downloads_bdd.py b/tests/end2end/features/test_downloads_bdd.py index 3549b3c61..ce060ae77 100644 --- a/tests/end2end/features/test_downloads_bdd.py +++ b/tests/end2end/features/test_downloads_bdd.py @@ -45,7 +45,13 @@ def clean_old_downloads(quteproc): @bdd.when("I wait until the download is finished") def wait_for_download_finished(quteproc): - quteproc.wait_for(category='downloads', message='Download finished') + quteproc.wait_for(category='downloads', message='Download * finished') + + +@bdd.when(bdd.parsers.parse("I wait until the download {name} is finished")) +def wait_for_download_finished_name(quteproc, name): + quteproc.wait_for(category='downloads', + message='Download {} finished'.format(name)) @bdd.when("I download an SSL page") diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index b5047bc25..0901e6eaa 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -98,14 +98,16 @@ def test_ascii_locale(request, httpbin, tmpdir, quteproc_new): url = 'http://localhost:{port}/data/downloads/ä-issue908.bin'.format( port=httpbin.port) quteproc_new.send_cmd(':download {}'.format(url)) - quteproc_new.wait_for(category='downloads', message='Download finished') + quteproc_new.wait_for(category='downloads', + message='Download ?-issue908.bin finished') # Test :prompt-open-download quteproc_new.set_setting('storage', 'prompt-download-directory', 'true') quteproc_new.send_cmd(':download {}'.format(url)) quteproc_new.send_cmd(':prompt-open-download "{}" -c pass' .format(sys.executable)) - quteproc_new.wait_for(category='downloads', message='Download finished') + quteproc_new.wait_for(category='downloads', + message='Download ä-issue908.bin finished') quteproc_new.wait_for(category='downloads', message='Opening * with [*python*]')