aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-08-07 20:24:48 +0800
committerXan Lopez <xan@igalia.com>2012-08-07 20:26:10 +0800
commit393d8167c8f10578044d4245a1927ab2d9416578 (patch)
tree5902f2a7c0b5eeaceeffe33acb3ed162e478bf2e /tests
parentfa8fc3a78c404d29bb1d3d7a010acca1bd001c53 (diff)
downloadgsoc2013-epiphany-393d8167c8f10578044d4245a1927ab2d9416578.tar
gsoc2013-epiphany-393d8167c8f10578044d4245a1927ab2d9416578.tar.gz
gsoc2013-epiphany-393d8167c8f10578044d4245a1927ab2d9416578.tar.bz2
gsoc2013-epiphany-393d8167c8f10578044d4245a1927ab2d9416578.tar.lz
gsoc2013-epiphany-393d8167c8f10578044d4245a1927ab2d9416578.tar.xz
gsoc2013-epiphany-393d8167c8f10578044d4245a1927ab2d9416578.tar.zst
gsoc2013-epiphany-393d8167c8f10578044d4245a1927ab2d9416578.zip
ephy-web-view: export the 'normalize or autosearch' method
We are going to modify it a bit, and we really want to test it. Add some initial tests for the existing functionality.
Diffstat (limited to 'tests')
-rw-r--r--tests/ephy-web-view-test.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c
index 0d5f627bd..19c9fdf7f 100644
--- a/tests/ephy-web-view-test.c
+++ b/tests/ephy-web-view-test.c
@@ -264,6 +264,44 @@ test_ephy_web_view_non_search_regex ()
g_regex_unref (regex);
}
+/* FIXME: we hardcode the google search for now, since it's the
+ * default. */
+static struct {
+ char *url;
+ char *expected;
+} normalize_or_autosearch[] = {
+ { "google.com", "http://google.com" },
+ { "http://google.com", "http://google.com" },
+ { "search", "http://www.google.com/search?q=search&ie=UTF-8&oe=UTF-8" },
+ { "search.me", "http://search.me" },
+ { "lala.lala", "http://lala.lala" }, /* FIXME: should autosearch. */
+ { "127.0.0.1", "http://127.0.0.1" },
+ { "http://127.0.0.1", "http://127.0.0.1" },
+ { "totalgarbage0xdeadbeef", "http://www.google.com/search?q=totalgarbage0xdeadbeef&ie=UTF-8&oe=UTF-8" }
+};
+
+static void
+test_ephy_web_view_normalize_or_autosearch ()
+{
+ int i;
+ EphyWebView *view;
+
+ view = EPHY_WEB_VIEW (ephy_web_view_new ());
+
+ for (i = 0; i < G_N_ELEMENTS (normalize_or_autosearch); i++) {
+ char *url, *result;
+
+ url = normalize_or_autosearch[i].url;
+
+ result = ephy_web_view_normalize_or_autosearch_url (view, url);
+ g_assert_cmpstr (result, ==, normalize_or_autosearch[i].expected);
+
+ g_free (result);
+ }
+
+ g_object_unref (g_object_ref_sink (view));
+}
+
int
main (int argc, char *argv[])
{
@@ -291,6 +329,9 @@ main (int argc, char *argv[])
g_test_add_func ("/embed/ephy-web-view/non_search_regex",
test_ephy_web_view_non_search_regex);
+ g_test_add_func ("/embed/ephy-web-view/normalize_or_autosearch",
+ test_ephy_web_view_normalize_or_autosearch);
+
g_test_add_func ("/embed/ephy-web-view/load_url",
test_ephy_web_view_load_url);