Merge lp:~midori/midori/adblock-unit-test into lp:midori

Proposed by Danielle Foré
Status: Work in progress
Proposed branch: lp:~midori/midori/adblock-unit-test
Merge into: lp:midori
Diff against target: 37 lines (+21/-0)
1 file modified
extensions/adblock.c (+21/-0)
To merge this branch: bzr merge lp:~midori/midori/adblock-unit-test
Reviewer Review Type Date Requested Status
Danielle Foré (community) Needs Fixing
Review via email: mp+164793@code.launchpad.net

Description of the change

unit test written by gue5t to confirm bug 1069294

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

pfor recommends that we merge this at the same time as the fix for Bug #1069294

If we merge before, the unit test would simply fail for every build instead of being useful.

review: Needs Fixing

Unmerged revisions

6163. By gue5t gue5t

add unit test for adblock

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'extensions/adblock.c'
--- extensions/adblock.c 2013-03-03 21:02:11 +0000
+++ extensions/adblock.c 2013-05-20 19:08:39 +0000
@@ -1910,12 +1910,33 @@
1910 adblock_destroy_db ();1910 adblock_destroy_db ();
1911}1911}
19121912
1913static void
1914test_same_domain (void)
1915{
1916 gint temp;
1917 gchar* filename;
1918
1919 adblock_init_db ();
1920 temp = g_file_open_tmp ("midori_adblock_domain_test_XXXXXX", &filename, NULL);
1921 close (temp);
1922 g_file_set_contents (filename,
1923 "http://forum.ubuntu-it.org/*.jpg\n"
1924 "http://forum.ubuntu-it.org/*.png",
1925 -1, NULL);
1926 adblock_parse_file (filename);
1927 g_assert (adblock_is_matched ("http://forum.ubuntu-it.org/download/file.php?avatar=95802_1334865145.png", ""));
1928 g_assert (adblock_is_matched ("http://forum.ubuntu-it.org/download/file.php?avatar=141178_1354023674.jpg", ""));
1929 g_free (filename);
1930 adblock_destroy_db ();
1931}
1932
1913void1933void
1914extension_test (void)1934extension_test (void)
1915{1935{
1916 g_test_add_func ("/extensions/adblock/parse", test_adblock_parse);1936 g_test_add_func ("/extensions/adblock/parse", test_adblock_parse);
1917 g_test_add_func ("/extensions/adblock/pattern", test_adblock_pattern);1937 g_test_add_func ("/extensions/adblock/pattern", test_adblock_pattern);
1918 g_test_add_func ("/extensions/adblock/update", test_subscription_update);1938 g_test_add_func ("/extensions/adblock/update", test_subscription_update);
1939 g_test_add_func ("/extensions/adblock/same-domain", test_same_domain);
1919}1940}
19201941
1921MidoriExtension*1942MidoriExtension*

Subscribers

People subscribed via source and target branches

to all changes: