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
1=== modified file 'extensions/adblock.c'
2--- extensions/adblock.c 2013-03-03 21:02:11 +0000
3+++ extensions/adblock.c 2013-05-20 19:08:39 +0000
4@@ -1910,12 +1910,33 @@
5 adblock_destroy_db ();
6 }
7
8+static void
9+test_same_domain (void)
10+{
11+ gint temp;
12+ gchar* filename;
13+
14+ adblock_init_db ();
15+ temp = g_file_open_tmp ("midori_adblock_domain_test_XXXXXX", &filename, NULL);
16+ close (temp);
17+ g_file_set_contents (filename,
18+ "http://forum.ubuntu-it.org/*.jpg\n"
19+ "http://forum.ubuntu-it.org/*.png",
20+ -1, NULL);
21+ adblock_parse_file (filename);
22+ g_assert (adblock_is_matched ("http://forum.ubuntu-it.org/download/file.php?avatar=95802_1334865145.png", ""));
23+ g_assert (adblock_is_matched ("http://forum.ubuntu-it.org/download/file.php?avatar=141178_1354023674.jpg", ""));
24+ g_free (filename);
25+ adblock_destroy_db ();
26+}
27+
28 void
29 extension_test (void)
30 {
31 g_test_add_func ("/extensions/adblock/parse", test_adblock_parse);
32 g_test_add_func ("/extensions/adblock/pattern", test_adblock_pattern);
33 g_test_add_func ("/extensions/adblock/update", test_subscription_update);
34+ g_test_add_func ("/extensions/adblock/same-domain", test_same_domain);
35 }
36
37 MidoriExtension*

Subscribers

People subscribed via source and target branches

to all changes: