Bug 24844

Summary: Unit test WebKitDownload
Product: WebKit Reporter: Christian Dywan <christian>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal Keywords: Gtk
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Linux   
Attachments:
Description Flags
Initial download unit test
zecke: review+
Fixes for the crash and critical message detected by the unit tests ap: review+

Description Christian Dywan 2009-03-26 11:40:57 PDT
I noticed while implementing download API that looking at the current progress before starting a WebKitDownload crashes WebKit. So I think we should really be unit testing add, to avoid such silly bugs.
Comment 1 Christian Dywan 2009-03-26 11:55:09 PDT
Created attachment 28974 [details]
Initial download unit test

This is only a start but it already catches two bugs:

webkit_download_get_progress(download) crashes

webkit_download_get_elapsed_time(download) complains about an invalid timer
Comment 2 Holger Freyther 2009-03-30 06:06:31 PDT
Comment on attachment 28974 [details]
Initial download unit test

Thanks.
Comment 3 Gustavo Noronha (kov) 2009-04-01 10:16:28 PDT
Created attachment 29163 [details]
Fixes for the crash and critical message detected by the unit tests

accessor functions are called before the download is started.
---
 WebKit/gtk/ChangeLog                 |   15 +++++++++++++++
 WebKit/gtk/webkit/webkitdownload.cpp |    6 ++++++
 2 files changed, 21 insertions(+), 0 deletions(-)
Comment 4 Christian Dywan 2009-04-01 12:51:43 PDT
Comment on attachment 28974 [details]
Initial download unit test

Committed in revision 42153.
Comment 5 Alexey Proskuryakov 2009-04-02 08:12:26 PDT
Comment on attachment 29163 [details]
Fixes for the crash and critical message detected by the unit tests

> +        Extra checks to avoid crashing and a critical message when
> +	property accessor functions are called before the download is
> +	started.

Tabs instead of spaces here.

> +    if (!priv->timer)
> +        return 0.0;

I'd just write "return 0".

r=me
Comment 6 Gustavo Noronha (kov) 2009-04-02 08:50:59 PDT
Landed fix as r42169, with ap's comments addressed.