Bug 24844 - Unit test WebKitDownload
Summary: Unit test WebKitDownload
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2009-03-26 11:40 PDT by Christian Dywan
Modified: 2009-04-02 08:50 PDT (History)
0 users

See Also:


Attachments
Initial download unit test (3.54 KB, patch)
2009-03-26 11:55 PDT, Christian Dywan
zecke: review+
Details | Formatted Diff | Diff
Fixes for the crash and critical message detected by the unit tests (1.71 KB, patch)
2009-04-01 10:16 PDT, Gustavo Noronha (kov)
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.