Commit 278d4cde authored by christian@webkit.org's avatar christian@webkit.org

2009-04-01 Christian Dywan <christian@twotoasts.de>

        Reviewed by Holger Freyther.

        Unit test WebKitDownload
        http://bugs.webkit.org/show_bug.cgi?id=24844

        * GNUmakefile.am: Add a unit test for downloading.

2009-04-01  Christian Dywan  <christian@twotoasts.de>

        Reviewed by Holger Freyther.

        * tests/testdownload.c: Added.
        (test_webkit_download_create):
        (main): Add an initial unit test for downloading.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@42153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2ad69888
2009-04-01 Christian Dywan <christian@twotoasts.de>
Reviewed by Holger Freyther.
Unit test WebKitDownload
http://bugs.webkit.org/show_bug.cgi?id=24844
* GNUmakefile.am: Add a unit test for downloading.
2009-04-01 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Unreviewed build fix. Fix make distcheck, after the gtk-doc
......
......@@ -492,7 +492,8 @@ webkit_tests_ldadd = \
TEST_PROGS += Programs/unittests/testwebframe \
Programs/unittests/testwebbackforwardlist \
Programs/unittests/testwebhistoryitem
Programs/unittests/testwebhistoryitem \
Programs/unittests/testdownload
# Add additional tests here
Programs_unittests_testwebframe_SOURCES = WebKit/gtk/tests/testwebframe.c
......@@ -507,6 +508,9 @@ Programs_unittests_testwebhistoryitem_SOURCES = WebKit/gtk/tests/testwebhistoryi
Programs_unittests_testwebhistoryitem_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testwebhistoryitem_LDADD = $(webkit_tests_ldadd)
Programs_unittests_testdownload_SOURCES = WebKit/gtk/tests/testdownload.c
Programs_unittests_testdownload_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testdownload_LDADD = $(webkit_tests_ldadd)
# Autogenerated sources
BUILT_SOURCES := \
......
2009-04-01 Christian Dywan <christian@twotoasts.de>
Reviewed by Holger Freyther.
* tests/testdownload.c: Added.
(test_webkit_download_create):
(main): Add an initial unit test for downloading.
2009-04-01 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Unreviewed typo fixes, and naming normalization in the
......
/*
* Copyright (C) 2009 Christian Dywan <christian@twotoasts.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2,1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <webkit/webkit.h>
#if GTK_CHECK_VERSION(2, 14, 0)
static void
test_webkit_download_create(void)
{
WebKitNetworkRequest* request;
WebKitDownload* download;
const gchar* uri = "http://example.com";
gchar* tmpDir;
request = webkit_network_request_new(uri);
download = webkit_download_new(request);
g_object_unref(request);
g_assert_cmpstr(webkit_download_get_uri(download), ==, uri);
g_assert(webkit_download_get_network_request(download) == request);
g_assert(g_strrstr(uri, webkit_download_get_suggested_filename(download)));
g_assert(webkit_download_get_status(download) == WEBKIT_DOWNLOAD_STATUS_CREATED);
g_assert(!webkit_download_get_total_size(download));
g_assert(!webkit_download_get_current_size(download));
g_assert(!webkit_download_get_progress(download));
g_assert(!webkit_download_get_elapsed_time(download));
tmpDir = g_strconcat("file://", g_get_tmp_dir(), NULL);
webkit_download_set_destination_uri(download, tmpDir);
g_assert_cmpstr(tmpDir, ==, webkit_download_get_destination_uri(download));;
g_free(tmpDir);
g_object_unref(download);
}
int main(int argc, char** argv)
{
g_thread_init(NULL);
gtk_test_init(&argc, &argv, NULL);
g_test_bug_base("https://bugs.webkit.org/");
g_test_add_func("/webkit/download/create", test_webkit_download_create);
return g_test_run ();
}
#else
int main(int argc, char** argv)
{
g_critical("You will need at least GTK+ 2.14.0 to run the unit tests.");
return 0;
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment