Fix build of unit tests: speed dial, hsts, bookmarks

This commit is contained in:
Christian Dywan 2012-09-11 00:38:09 +02:00
parent f29318af7c
commit bae360e3f8
9 changed files with 23 additions and 21 deletions

View file

@ -22,10 +22,14 @@ namespace Midori {
public Directive.from_header (string header) {
var param_list = Soup.header_parse_param_list (header);
if (param_list == null)
return;
string? max_age = param_list.lookup ("max-age");
if (max_age != null)
expires = new Soup.Date.from_now (max_age.to_int ());
if (param_list.lookup_extended ("includeSubDomains", null, null))
// if (param_list.lookup_extended ("includeSubDomains", null, null))
if ("includeSubDomains" in header)
sub_domains = true;
Soup.header_free_param_list (param_list);
}

View file

@ -91,12 +91,12 @@ namespace Midori {
foreach (string tile in keyfile.get_groups ()) {
try {
string img = keyfile.get_string (tile, "img");
keyfile.remove_key (tile, "img");
string uri = keyfile.get_string (tile, "uri");
if (img != null && uri[0] != '\0' && uri[0] != '#') {
uchar[] decoded = Base64.decode (img);
FileUtils.set_data (build_thumbnail_path (uri), decoded);
}
keyfile.remove_key (tile, "img");
}
catch (GLib.Error img_error) {
/* img and uri can be missing */

View file

@ -398,8 +398,9 @@ sokoke_prepare_command (const gchar* command,
g_return_val_if_fail (command != NULL, FALSE);
g_return_val_if_fail (argument != NULL, FALSE);
g_print ("Preparing command: %s %d %s %d\n",
command, quote_command, argument, quote_argument);
if (midori_debug ("paths"))
g_print ("Preparing command: %s %d %s %d\n",
command, quote_command, argument, quote_argument);
{
gchar* uri_format;

View file

@ -10,7 +10,7 @@ libs = 'M UNIQUE LIBSOUP GMODULE GTHREAD LIBIDN GIO GTK SQLITE ' \
'LIBNOTIFY WEBKIT JAVASCRIPTCOREGTK LIBXML X11 XSS WS2_32 HILDON' \
'HILDON_FM GCR GRANITE ZEITGEIST'
if progressive or Options.commands['check']:
if progressive:
obj = bld.new_task_gen ('cc', 'staticlib')
obj.target = 'midori-core'
obj.includes = '.. ../katze . ../toolbars'
@ -26,7 +26,6 @@ if progressive or Options.commands['check']:
obj.packages += ' gtk+-2.0 webkit-1.0'
bld.add_group ()
if progressive:
obj = bld.new_task_gen ('cc', 'program')
obj.target = 'midori'
obj.includes = '.. ../katze . ../panels'
@ -35,12 +34,3 @@ if progressive:
obj.uselib_local = 'midori-core'
if bld.env['WINRC']:
obj.source += ' ../data/midori.rc'
else:
obj = bld.new_task_gen ('cc', 'program')
obj.target = 'midori'
obj.includes = '.. ../katze . ../panels ../toolbars'
obj.find_sources_in_dirs ('../katze . ../panels ../toolbars')
obj.add_marshal_file ('marshal.list', 'midori_cclosure_marshal')
obj.uselib = libs
if bld.env['WINRC']:
obj.source += ' ../data/midori.rc'

View file

@ -40,7 +40,7 @@ fixture_setup (BookmarksFixture* fixture,
gchar *errmsg = NULL;
fixture->db_bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
db = midori_bookmarks_initialize (fixture->db_bookmarks, params->dbfile, &errmsg);
db = NULL; /* FIXME midori_bookmarks_initialize (fixture->db_bookmarks, params->dbfile, &errmsg); */
if (db == NULL)
g_error ("Bookmarks couldn't be loaded: %s\n", errmsg);
g_assert (errmsg == NULL);

View file

@ -8,6 +8,7 @@
See the file COPYING for the full license text.
*/
static void http_hsts () {
Midori.HSTS.Directive d;
d = new Midori.HSTS.Directive.from_header ("max-age=31536000");

View file

@ -341,9 +341,9 @@ magic_uri_commands (void)
for (j = 0; j < G_N_ELEMENTS (arguments); j++)
{
gchar* input = g_strconcat (commands[i].command, " ", arguments[j].command, NULL);
gchar* ce = commands[i].expected ? commands[i].expected
gchar* ce = commands[i].expected ? (gchar*)commands[i].expected
: g_strconcat ("'", commands[i].command, "'", NULL);
gchar* ae = arguments[j].expected ? arguments[j].expected
gchar* ae = arguments[j].expected ? (gchar*)arguments[j].expected
: (arguments[j].quote ? g_strconcat ("'", arguments[j].command, "'", NULL)
: g_strdup (arguments[j].command));
gchar* expected = g_strconcat (ce, " ", ae, NULL);

View file

@ -42,12 +42,18 @@ static void speeddial_load () {
Katze.assert_str_equal (json, dial_data.keyfile.to_data (), dial_json.keyfile.to_data ());
Katze.assert_str_equal (json, dial_data.get_next_free_slot (), "Dial 2");
Katze.assert_str_equal (json, dial_json.get_next_free_slot (), "Dial 2");
dial_data.save_message ("speed_dial-save-rename s1 Lorem");
Katze.assert_str_equal (data, dial_data.keyfile.get_string ("Dial 1", "title"), "Lorem");
dial_data.save_message ("speed_dial-save-delete s1");
Katze.assert_str_equal (data, dial_data.get_next_free_slot (), "Dial 1");
}
void main (string[] args) {
string temporary_cache = DirUtils.make_tmp ("cacheXXXXXX");
Environment.set_variable ("XDG_CACHE_HOME", temporary_cache, true);
Test.init (ref args);
Midori.Paths.init (Midori.RuntimeMode.PRIVATE, null);
Test.add_func ("/speeddial/load", speeddial_load);
Test.run ();
DirUtils.remove (temporary_cache);

View file

@ -14,7 +14,7 @@ for test in tests:
for fila in files:
if fila[-2:] == '.c':
source += ' ' + test + os.sep + fila
elif 'VALAC' in bld.env and file[-5:] == '.vala':
elif file[-5:] == '.vala':
source += ' ' + test + os.sep + fila
if not source:
Utils.pprint ('RED', folder + ': No source files found')
@ -22,7 +22,7 @@ for test in tests:
else:
if test[-2:] == '.c':
target = test[:-2]
elif 'VALAC' in bld.env and test[-5:] == '.vala':
elif test[-5:] == '.vala':
target = test[:-5]
else:
continue
@ -34,7 +34,7 @@ for test in tests:
obj.cflags = ['-DEXTENSION_PATH="' + os.path.abspath ('_build/default/extensions') + '"']
obj.source = source
obj.vapi_dirs = '../midori ../katze'
obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 katze midori'
obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 katze midori midori-core'
if bld.env['HAVE_GTK3']:
obj.packages += ' gtk+-3.0 webkitgtk-3.0'
else: