From 54860ee6b8fe1ad33977eca490200929ea9cfac5 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 9 Aug 2016 00:09:33 +0100 Subject: add cookie database load and restore unit test --- test/urldbtest.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'test/urldbtest.c') diff --git a/test/urldbtest.c b/test/urldbtest.c index 0b4853cc4..faf6d6ee5 100644 --- a/test/urldbtest.c +++ b/test/urldbtest.c @@ -37,10 +37,12 @@ #include "utils/nsurl.h" #include "utils/nsoption.h" #include "netsurf/url_db.h" +#include "netsurf/cookie_db.h" #include "content/urldb.h" #include "desktop/cookie_manager.h" const char *test_urldb_path = "test/data/urldb"; +const char *test_cookies_path = "test/data/cookies"; struct netsurf_table *guit = NULL; @@ -139,6 +141,7 @@ static void urldb_create_loaded(void) res = urldb_load(test_urldb_path); ck_assert_int_eq(res, NSERROR_OK); + urldb_load_cookies(test_cookies_path); } static void urldb_lwc_iterator(lwc_string *str, void *pw) @@ -401,17 +404,23 @@ START_TEST(urldb_session_test) res = urldb_load(test_urldb_path); ck_assert_int_eq(res, NSERROR_OK); + urldb_load_cookies(test_cookies_path); + /* write database out */ outnam = tmpnam(NULL); res = urldb_save(outnam); ck_assert_int_eq(res, NSERROR_OK); + /* remove test output */ + unlink(outnam); + + /* write cookies out */ + urldb_save_cookies(outnam); + /* finalise options */ res = nsoption_finalise(NULL, NULL); ck_assert_int_eq(res, NSERROR_OK); - /* remove test output */ - unlink(outnam); } END_TEST @@ -460,7 +469,7 @@ START_TEST(urldb_auth_details_test) nsurl *url; const char *res; const char *auth = "mooooo"; - + url = make_url("http://www.wikipedia.org/"); urldb_set_auth_details(url, "tree", auth); -- cgit v1.2.3