diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ephy-bookmarks-test.c | 7 | ||||
-rw-r--r-- | tests/ephy-completion-model-test.c | 48 | ||||
-rw-r--r-- | tests/ephy-download-test.c | 18 | ||||
-rw-r--r-- | tests/ephy-embed-shell-test.c | 48 | ||||
-rw-r--r-- | tests/ephy-embed-utils-test.c | 4 | ||||
-rw-r--r-- | tests/ephy-file-helpers-test.c | 2 | ||||
-rw-r--r-- | tests/ephy-history-test.c | 64 | ||||
-rw-r--r-- | tests/ephy-migration-test.c | 12 | ||||
-rw-r--r-- | tests/ephy-session-test.c | 308 | ||||
-rw-r--r-- | tests/ephy-shell-test.c | 48 | ||||
-rw-r--r-- | tests/ephy-snapshot-service-test.c | 27 | ||||
-rw-r--r-- | tests/ephy-sqlite-test.c | 14 | ||||
-rw-r--r-- | tests/ephy-test-utils.c | 11 | ||||
-rw-r--r-- | tests/ephy-uri-helpers-test.c | 3 | ||||
-rw-r--r-- | tests/ephy-web-view-test.c | 114 |
15 files changed, 362 insertions, 366 deletions
diff --git a/tests/ephy-bookmarks-test.c b/tests/ephy-bookmarks-test.c index ab76042c2..0c3353e31 100644 --- a/tests/ephy-bookmarks-test.c +++ b/tests/ephy-bookmarks-test.c @@ -25,7 +25,7 @@ #include "ephy-profile-utils.h" #include "ephy-shell.h" -const char* bookmarks_paths[] = { EPHY_BOOKMARKS_FILE, EPHY_BOOKMARKS_FILE_RDF }; +const char *bookmarks_paths[] = { EPHY_BOOKMARKS_FILE, EPHY_BOOKMARKS_FILE_RDF }; static void clear_bookmark_files (void) @@ -35,7 +35,6 @@ clear_bookmark_files (void) guint i; for (i = 0; i < G_N_ELEMENTS (bookmarks_paths); i++) { - path = g_build_filename (ephy_dot_dir (), bookmarks_paths[i], NULL); @@ -66,12 +65,12 @@ test_ephy_bookmarks_add (void) bookmarks = ephy_bookmarks_new (); g_assert (bookmarks); - + node = ephy_bookmarks_add (bookmarks, "GNOME", "http://www.gnome.org"); g_assert (node); result = ephy_bookmarks_find_bookmark (bookmarks, "http://www.gnome.org"); g_assert (node == result); - + g_object_unref (bookmarks); clear_bookmark_files (); diff --git a/tests/ephy-completion-model-test.c b/tests/ephy-completion-model-test.c index cb0db4853..f00653e3e 100644 --- a/tests/ephy-completion-model-test.c +++ b/tests/ephy-completion-model-test.c @@ -28,47 +28,47 @@ static void test_ephy_completion_model_create (void) { - EphyCompletionModel *model; - model = ephy_completion_model_new (EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ())), - ephy_shell_get_bookmarks (ephy_shell_get_default ())); - g_assert (model); - g_object_unref (model); + EphyCompletionModel *model; + model = ephy_completion_model_new (EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ())), + ephy_shell_get_bookmarks (ephy_shell_get_default ())); + g_assert (model); + g_object_unref (model); } static void update_empty_cb (EphyHistoryService *service, - gboolean success, - gpointer result_data, - GMainLoop *loop) + gboolean success, + gpointer result_data, + GMainLoop *loop) { - GList *results = (GList*)result_data; + GList *results = (GList *)result_data; - g_assert (success); - g_assert (results == NULL); + g_assert (success); + g_assert (results == NULL); - g_main_loop_quit (loop); + g_main_loop_quit (loop); } static void test_ephy_completion_model_update_empty (void) { - EphyCompletionModel *model; - GMainLoop *loop = NULL; + EphyCompletionModel *model; + GMainLoop *loop = NULL; - model = ephy_completion_model_new (EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ())), - ephy_shell_get_bookmarks (ephy_shell_get_default ())); - g_assert (model); + model = ephy_completion_model_new (EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ())), + ephy_shell_get_bookmarks (ephy_shell_get_default ())); + g_assert (model); - loop = g_main_loop_new (NULL, FALSE); + loop = g_main_loop_new (NULL, FALSE); - ephy_completion_model_update_for_string (model, "hello", - (EphyHistoryJobCallback)update_empty_cb, - loop); + ephy_completion_model_update_for_string (model, "hello", + (EphyHistoryJobCallback)update_empty_cb, + loop); - g_main_loop_run (loop); + g_main_loop_run (loop); - g_object_unref (model); - g_main_loop_unref (loop); + g_object_unref (model); + g_main_loop_unref (loop); } int diff --git a/tests/ephy-download-test.c b/tests/ephy-download-test.c index 4262245b5..74f103713 100644 --- a/tests/ephy-download-test.c +++ b/tests/ephy-download-test.c @@ -51,12 +51,12 @@ get_uri_for_path (const char *path) } static void -server_callback (SoupServer *server, - SoupMessage *msg, - const char *path, - GHashTable *query, +server_callback (SoupServer *server, + SoupMessage *msg, + const char *path, + GHashTable *query, SoupClientContext *context, - gpointer data) + gpointer data) { soup_message_set_status (msg, SOUP_STATUS_OK); @@ -124,7 +124,7 @@ test_file_was_downloaded (EphyDownload *download) static void completed_cb (EphyDownload *download, - Fixture *fixture) + Fixture *fixture) { g_assert (test_file_was_downloaded (download)); g_main_loop_quit (fixture->loop); @@ -142,7 +142,7 @@ test_ephy_download_new_for_uri (Fixture *fixture, gconstpointer data) WebKitDownload *download = ephy_download_get_webkit_download (fixture->download); WebKitURIRequest *request = webkit_download_get_request (download); - g_assert(request); + g_assert (request); g_assert_cmpstr (fixture->source, ==, webkit_uri_request_get_uri (request)); } @@ -160,7 +160,7 @@ int main (int argc, char *argv[]) { int ret; - GSList* uris; + GSList *uris; SoupServer *server; gtk_test_init (&argc, &argv); @@ -182,7 +182,7 @@ main (int argc, char *argv[]) SOUP_SERVER_LISTEN_IPV4_ONLY, NULL); uris = soup_server_get_uris (server); - base_uri = (SoupURI*)uris->data; + base_uri = (SoupURI *)uris->data; g_slist_free (uris); soup_server_add_handler (server, NULL, server_callback, NULL, NULL); diff --git a/tests/ephy-embed-shell-test.c b/tests/ephy-embed-shell-test.c index 1c607ccd2..19211b503 100644 --- a/tests/ephy-embed-shell-test.c +++ b/tests/ephy-embed-shell-test.c @@ -36,48 +36,48 @@ static void test_ephy_embed_shell_launch_handler (void) { - EphyEmbedShell *embed_shell; - gboolean ret; - GFile *file; + EphyEmbedShell *embed_shell; + gboolean ret; + GFile *file; - embed_shell = ephy_embed_shell_get_default (); + embed_shell = ephy_embed_shell_get_default (); - ret = ephy_embed_shell_launch_handler (embed_shell, NULL, "text/html", 0); - g_assert (ret == FALSE); + ret = ephy_embed_shell_launch_handler (embed_shell, NULL, "text/html", 0); + g_assert (ret == FALSE); - file = g_file_new_for_path (TEST_DIR"/data/test.html"); - g_assert (file); + file = g_file_new_for_path (TEST_DIR "/data/test.html"); + g_assert (file); - ret = ephy_embed_shell_launch_handler (embed_shell, file, NULL, 0); - g_assert (ret == FALSE); + ret = ephy_embed_shell_launch_handler (embed_shell, file, NULL, 0); + g_assert (ret == FALSE); - ret = ephy_embed_shell_launch_handler (embed_shell, file, "text/html", 0); - g_assert (ret == FALSE); + ret = ephy_embed_shell_launch_handler (embed_shell, file, "text/html", 0); + g_assert (ret == FALSE); - g_object_unref (file); + g_object_unref (file); } static void web_view_created_cb (EphyEmbedShell *shell, EphyWebView *view, gpointer user_data) { - gboolean *web_view_created = (gboolean*)user_data; - *web_view_created = TRUE; + gboolean *web_view_created = (gboolean *)user_data; + *web_view_created = TRUE; } static void test_ephy_embed_shell_web_view_created (void) { - EphyEmbedShell *embed_shell; - GtkWidget *view; - gboolean web_view_created = FALSE; + EphyEmbedShell *embed_shell; + GtkWidget *view; + gboolean web_view_created = FALSE; - embed_shell = ephy_embed_shell_get_default (); - g_signal_connect (embed_shell, "web-view-created", - G_CALLBACK (web_view_created_cb), &web_view_created); + embed_shell = ephy_embed_shell_get_default (); + g_signal_connect (embed_shell, "web-view-created", + G_CALLBACK (web_view_created_cb), &web_view_created); - view = ephy_web_view_new (); - g_assert (web_view_created); - gtk_widget_destroy (view); + view = ephy_web_view_new (); + g_assert (web_view_created); + gtk_widget_destroy (view); } int diff --git a/tests/ephy-embed-utils-test.c b/tests/ephy-embed-utils-test.c index 5d42032db..572fb9d54 100644 --- a/tests/ephy-embed-utils-test.c +++ b/tests/ephy-embed-utils-test.c @@ -138,7 +138,7 @@ main (int argc, char *argv[]) test.name, NULL); g_test_add_data_func (test_name, test.test, - (GTestDataFunc) test_address_has_web_scheme); + (GTestDataFunc)test_address_has_web_scheme); g_free (test_name); } @@ -152,7 +152,7 @@ main (int argc, char *argv[]) test.name, NULL); g_test_add_data_func (test_name, test.test, - (GTestDataFunc) test_address_no_web_scheme); + (GTestDataFunc)test_address_no_web_scheme); g_free (test_name); } diff --git a/tests/ephy-file-helpers-test.c b/tests/ephy-file-helpers-test.c index 0ec310e04..7368b59bf 100644 --- a/tests/ephy-file-helpers-test.c +++ b/tests/ephy-file-helpers-test.c @@ -190,7 +190,7 @@ test_ephy_file_create_delete_dir (void) g_assert (ephy_file_delete_dir_recursively (test.dir, &error) == test.can_delete); if (error) - g_error_free (error); + g_error_free (error); if (test.exists) g_assert (g_file_test (test.dir, G_FILE_TEST_EXISTS) != test.can_delete); diff --git a/tests/ephy-history-test.c b/tests/ephy-history-test.c index 9b0777985..ade796c0d 100644 --- a/tests/ephy-history-test.c +++ b/tests/ephy-history-test.c @@ -27,7 +27,7 @@ #include <gtk/gtk.h> static EphyHistoryService * -ensure_empty_history (const char* filename, gboolean readonly) +ensure_empty_history (const char *filename, gboolean readonly) { if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) g_unlink (filename); @@ -71,7 +71,7 @@ test_create_history_service_and_destroy_later (void) gchar *temporary_file = g_build_filename (g_get_tmp_dir (), "epiphany-history-test.db", NULL); EphyHistoryService *service = ensure_empty_history (temporary_file, FALSE); g_free (temporary_file); - g_timeout_add (100, (GSourceFunc) destroy_history_service_and_end_main_loop, service); + g_timeout_add (100, (GSourceFunc)destroy_history_service_and_end_main_loop, service); gtk_main (); } @@ -117,7 +117,7 @@ create_test_page_visit_list (void) static void verify_create_history_entry_cb (EphyHistoryService *service, gboolean success, gpointer result_data, gpointer user_data) { - GList *visits = (GList *) result_data; + GList *visits = (GList *)result_data; GList *baseline_visits = create_test_page_visit_list (); GList *current = visits; GList *current_baseline = baseline_visits; @@ -131,8 +131,8 @@ verify_create_history_entry_cb (EphyHistoryService *service, gboolean success, g EphyHistoryPageVisit *visit, *baseline_visit; g_assert (current); - visit = (EphyHistoryPageVisit *) current->data; - baseline_visit = (EphyHistoryPageVisit *) current_baseline->data; + visit = (EphyHistoryPageVisit *)current->data; + baseline_visit = (EphyHistoryPageVisit *)current_baseline->data; g_assert_cmpstr (visit->url->url, ==, baseline_visit->url->url); g_assert_cmpstr (visit->url->title, ==, baseline_visit->url->title); @@ -154,7 +154,7 @@ static void verify_create_history_entry (EphyHistoryService *service, gboolean success, gpointer result_data, gpointer user_data) { g_assert (result_data == NULL); - g_assert_cmpint (42, ==, GPOINTER_TO_INT(user_data)); + g_assert_cmpint (42, ==, GPOINTER_TO_INT (user_data)); g_assert (success); ephy_history_service_find_visits_in_time (service, 0, 8, NULL, verify_create_history_entry_cb, NULL); } @@ -168,7 +168,7 @@ test_create_history_entries (void) GList *visits = create_test_page_visit_list (); /* We use 42 here just to verify that user_data is passed properly to the callback */ - ephy_history_service_add_visits (service, visits, NULL, verify_create_history_entry, GINT_TO_POINTER(42)); + ephy_history_service_add_visits (service, visits, NULL, verify_create_history_entry, GINT_TO_POINTER (42)); ephy_history_page_visit_list_free (visits); g_free (temporary_file); @@ -178,7 +178,7 @@ test_create_history_entries (void) static void get_url (EphyHistoryService *service, gboolean success, gpointer result_data, gpointer user_data) { - EphyHistoryURL *url = (EphyHistoryURL *) result_data; + EphyHistoryURL *url = (EphyHistoryURL *)result_data; g_assert (success == TRUE); g_assert (url != NULL); @@ -186,7 +186,7 @@ get_url (EphyHistoryService *service, gboolean success, gpointer result_data, gp ephy_history_url_free (url); g_object_unref (service); - gtk_main_quit(); + gtk_main_quit (); } static void @@ -251,7 +251,7 @@ test_set_url_title_url_not_existent (void) ephy_history_service_set_url_title (service, "http://www.gnome.org", "GNOME", NULL, set_url_title_url_not_existent, NULL); - gtk_main(); + gtk_main (); } static void @@ -298,7 +298,7 @@ test_get_url_helper (gboolean add_entry) } else ephy_history_service_get_url (service, "http://www.gnome.org", NULL, test_get_url_done, GINT_TO_POINTER (add_entry)); - gtk_main(); + gtk_main (); } static void @@ -335,32 +335,32 @@ create_visits_for_complex_tests (void) static void verify_complex_url_query (EphyHistoryService *service, - gboolean success, - gpointer result_data, - gpointer user_data) + gboolean success, + gpointer result_data, + gpointer user_data) { EphyHistoryURL *url, *baseline; - GList *urls = (GList*) result_data; + GList *urls = (GList *)result_data; /* Only one result expected. */ g_assert_cmpint (g_list_length (urls), ==, 1); - url = (EphyHistoryURL *) urls->data; - baseline = (EphyHistoryURL *) user_data; + url = (EphyHistoryURL *)urls->data; + baseline = (EphyHistoryURL *)user_data; g_assert_cmpstr (url->url, ==, baseline->url); g_assert_cmpuint (url->visit_count, ==, baseline->visit_count); g_object_unref (service); - gtk_main_quit(); + gtk_main_quit (); } static void perform_complex_url_query (EphyHistoryService *service, - gboolean success, - gpointer result_data, - gpointer user_data) + gboolean success, + gpointer result_data, + gpointer user_data) { EphyHistoryQuery *query; EphyHistoryURL *url; @@ -397,9 +397,9 @@ test_complex_url_query (void) static void perform_complex_url_query_with_time_range (EphyHistoryService *service, - gboolean success, - gpointer result_data, - gpointer user_data) + gboolean success, + gpointer result_data, + gpointer user_data) { EphyHistoryQuery *query; EphyHistoryURL *url; @@ -437,25 +437,25 @@ test_complex_url_query_with_time_range (void) static void verify_query_after_clear (EphyHistoryService *service, - gboolean success, - gpointer result_data, - gpointer user_data) + gboolean success, + gpointer result_data, + gpointer user_data) { - GList *urls = (GList*)result_data; + GList *urls = (GList *)result_data; /* No results expected. */ g_assert_cmpint (g_list_length (urls), ==, 0); g_object_unref (service); - gtk_main_quit(); + gtk_main_quit (); } static void perform_query_after_clear (EphyHistoryService *service, - gboolean success, - gpointer result_data, - gpointer user_data) + gboolean success, + gpointer result_data, + gpointer user_data) { EphyHistoryQuery *query; diff --git a/tests/ephy-migration-test.c b/tests/ephy-migration-test.c index 375f533aa..91c24cc87 100644 --- a/tests/ephy-migration-test.c +++ b/tests/ephy-migration-test.c @@ -32,19 +32,19 @@ static void test_do_migration_simple (void) { - gboolean ret; + gboolean ret; - ret = ephy_profile_utils_do_migration (NULL, -1, TRUE); - g_assert (ret); + ret = ephy_profile_utils_do_migration (NULL, -1, TRUE); + g_assert (ret); } static void test_do_migration_invalid (void) { - gboolean ret; + gboolean ret; - ret = ephy_profile_utils_do_migration (NULL, EPHY_PROFILE_MIGRATION_VERSION + 1, TRUE); - g_assert (ret == FALSE); + ret = ephy_profile_utils_do_migration (NULL, EPHY_PROFILE_MIGRATION_VERSION + 1, TRUE); + g_assert (ret == FALSE); } int diff --git a/tests/ephy-session-test.c b/tests/ephy-session-test.c index 5c02cd77b..b0c15f60b 100644 --- a/tests/ephy-session-test.c +++ b/tests/ephy-session-test.c @@ -35,20 +35,20 @@ #include <gtk/gtk.h> #include <string.h> -const char *session_data = -"<?xml version=\"1.0\"?>" -"<session>" - "<window x=\"94\" y=\"48\" width=\"1132\" height=\"684\" active-tab=\"0\" role=\"epiphany-window-67c6e8a5\">" - "<embed url=\"about:memory\" title=\"Memory usage\"/>" - "</window>" -"</session>"; +const char *session_data = + "<?xml version=\"1.0\"?>" + "<session>" + "<window x=\"94\" y=\"48\" width=\"1132\" height=\"684\" active-tab=\"0\" role=\"epiphany-window-67c6e8a5\">" + "<embed url=\"about:memory\" title=\"Memory usage\"/>" + "</window>" + "</session>"; static gboolean load_stream_retval; static void -load_from_stream_cb (GObject *object, +load_from_stream_cb (GObject *object, GAsyncResult *result, - gpointer user_data) + gpointer user_data) { GMainLoop *loop = (GMainLoop *)user_data; @@ -58,7 +58,7 @@ load_from_stream_cb (GObject *object, static gboolean load_session_from_string (EphySession *session, - const char *data) + const char *data) { GMainLoop *loop; GInputStream *stream; @@ -91,50 +91,50 @@ disable_delayed_loading (void) static void test_ephy_session_load (void) { - EphySession *session; - gboolean ret; - GList *l; - EphyEmbed *embed; - EphyWebView *view; - GMainLoop *loop; + EphySession *session; + gboolean ret; + GList *l; + EphyEmbed *embed; + EphyWebView *view; + GMainLoop *loop; - disable_delayed_loading (); + disable_delayed_loading (); - session = ephy_shell_get_session (ephy_shell_get_default ()); - g_assert (session); + session = ephy_shell_get_session (ephy_shell_get_default ()); + g_assert (session); - loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); + loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); - ret = load_session_from_string (session, session_data); - g_assert (ret); + ret = load_session_from_string (session, session_data); + g_assert (ret); - ephy_test_utils_ensure_web_views_are_loaded (loop); + ephy_test_utils_ensure_web_views_are_loaded (loop); - l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); - g_assert (l); - g_assert_cmpint (g_list_length (l), ==, 1); + l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); + g_assert (l); + g_assert_cmpint (g_list_length (l), ==, 1); - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (l->data)); - g_assert (embed); - view = ephy_embed_get_web_view (embed); - g_assert (view); - ephy_test_utils_check_ephy_web_view_address (view, "ephy-about:memory"); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (l->data)); + g_assert (embed); + view = ephy_embed_get_web_view (embed); + g_assert (view); + ephy_test_utils_check_ephy_web_view_address (view, "ephy-about:memory"); - ephy_session_clear (session); + ephy_session_clear (session); - enable_delayed_loading (); + enable_delayed_loading (); } const char *session_data_many_windows = -"<?xml version=\"1.0\"?>" -"<session>" - "<window x=\"100\" y=\"26\" width=\"1067\" height=\"740\" active-tab=\"0\" role=\"epiphany-window-7da420dd\">" - "<embed url=\"about:epiphany\" title=\"Epiphany\"/>" - "</window>" - "<window x=\"73\" y=\"26\" width=\"1067\" height=\"740\" active-tab=\"0\" role=\"epiphany-window-1261c786\">" - "<embed url=\"about:config\" title=\"Epiphany\"/>" - "</window>" -"</session>"; + "<?xml version=\"1.0\"?>" + "<session>" + "<window x=\"100\" y=\"26\" width=\"1067\" height=\"740\" active-tab=\"0\" role=\"epiphany-window-7da420dd\">" + "<embed url=\"about:epiphany\" title=\"Epiphany\"/>" + "</window>" + "<window x=\"73\" y=\"26\" width=\"1067\" height=\"740\" active-tab=\"0\" role=\"epiphany-window-1261c786\">" + "<embed url=\"about:config\" title=\"Epiphany\"/>" + "</window>" + "</session>"; static void test_ephy_session_clear (void) @@ -162,178 +162,178 @@ test_ephy_session_clear (void) g_assert (ephy_session_get_can_undo_tab_closed (session) == FALSE); } -const char *session_data_empty = -""; +const char *session_data_empty = + ""; #if 0 static void test_ephy_session_load_empty_session (void) { - EphySession *session; - gboolean ret; - GList *l; - EphyEmbed *embed; - EphyWebView *view; - GMainLoop *loop; + EphySession *session; + gboolean ret; + GList *l; + EphyEmbed *embed; + EphyWebView *view; + GMainLoop *loop; - disable_delayed_loading (); + disable_delayed_loading (); - session = ephy_shell_get_session (ephy_shell_get_default ()); - g_assert (session); + session = ephy_shell_get_session (ephy_shell_get_default ()); + g_assert (session); - loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); + loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); - ret = load_session_from_string (session, session_data_empty); - g_assert (ret == FALSE); + ret = load_session_from_string (session, session_data_empty); + g_assert (ret == FALSE); - /* Loading the session should have failed, but we should still get - * the default empty window. Got to spin the mainloop though, - * since the fallback is done by queueing another session - * command. */ - ephy_test_utils_ensure_web_views_are_loaded (loop); + /* Loading the session should have failed, but we should still get + * the default empty window. Got to spin the mainloop though, + * since the fallback is done by queueing another session + * command. */ + ephy_test_utils_ensure_web_views_are_loaded (loop); - l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); - g_assert (l); - g_assert_cmpint (g_list_length (l), ==, 1); + l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); + g_assert (l); + g_assert_cmpint (g_list_length (l), ==, 1); - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (l->data)); - g_assert (embed); - view = ephy_embed_get_web_view (embed); - g_assert (view); - ephy_test_utils_check_ephy_web_view_address (view, "ephy-about:overview"); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (l->data)); + g_assert (embed); + view = ephy_embed_get_web_view (embed); + g_assert (view); + ephy_test_utils_check_ephy_web_view_address (view, "ephy-about:overview"); - enable_delayed_loading (); - ephy_session_clear (session); + enable_delayed_loading (); + ephy_session_clear (session); } #endif static void test_ephy_session_load_many_windows (void) { - EphySession *session; - gboolean ret; - GList *l, *p; - EphyEmbed *embed; - EphyWebView *view; - GMainLoop *loop; + EphySession *session; + gboolean ret; + GList *l, *p; + EphyEmbed *embed; + EphyWebView *view; + GMainLoop *loop; - disable_delayed_loading (); + disable_delayed_loading (); - session = ephy_shell_get_session (ephy_shell_get_default ()); - g_assert (session); + session = ephy_shell_get_session (ephy_shell_get_default ()); + g_assert (session); - loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); + loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); - ret = load_session_from_string (session, session_data_many_windows); - g_assert (ret); - g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), >=, 0); - g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), <=, 2); + ret = load_session_from_string (session, session_data_many_windows); + g_assert (ret); + g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), >=, 0); + g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), <=, 2); - ephy_test_utils_ensure_web_views_are_loaded (loop); + ephy_test_utils_ensure_web_views_are_loaded (loop); - l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); - g_assert (l); - g_assert_cmpint (g_list_length (l), ==, 2); + l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); + g_assert (l); + g_assert_cmpint (g_list_length (l), ==, 2); - for (p = l; p; p = p->next) { - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->data)); - g_assert (embed); - view = ephy_embed_get_web_view (embed); - g_assert (view); - } + for (p = l; p; p = p->next) { + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->data)); + g_assert (embed); + view = ephy_embed_get_web_view (embed); + g_assert (view); + } - enable_delayed_loading (); - ephy_session_clear (session); + enable_delayed_loading (); + ephy_session_clear (session); } static void -open_uris_after_loading_session (const char** uris, int final_num_windows) +open_uris_after_loading_session (const char **uris, int final_num_windows) { - EphySession *session; - gboolean ret; - GList *l, *p; - EphyEmbed *embed; - EphyWebView *view; - guint32 user_time; - GMainLoop *loop; + EphySession *session; + gboolean ret; + GList *l, *p; + EphyEmbed *embed; + EphyWebView *view; + guint32 user_time; + GMainLoop *loop; - disable_delayed_loading (); + disable_delayed_loading (); - session = ephy_shell_get_session (ephy_shell_get_default ()); - g_assert (session); + session = ephy_shell_get_session (ephy_shell_get_default ()); + g_assert (session); - loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); + loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); - user_time = gdk_x11_display_get_user_time (gdk_display_get_default ()); + user_time = gdk_x11_display_get_user_time (gdk_display_get_default ()); - ret = load_session_from_string (session, session_data_many_windows); - g_assert (ret); - g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), >=, 0); - g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), <=, 2); + ret = load_session_from_string (session, session_data_many_windows); + g_assert (ret); + g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), >=, 0); + g_assert_cmpint (ephy_test_utils_get_web_view_ready_counter (), <=, 2); - ephy_test_utils_ensure_web_views_are_loaded (loop); + ephy_test_utils_ensure_web_views_are_loaded (loop); - l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); + l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); - g_assert (l); - g_assert_cmpint (g_list_length (l), ==, 2); + g_assert (l); + g_assert_cmpint (g_list_length (l), ==, 2); - for (p = l; p; p = p->next) { - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->data)); - g_assert (embed); - view = ephy_embed_get_web_view (embed); - g_assert (view); - } + for (p = l; p; p = p->next) { + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->data)); + g_assert (embed); + view = ephy_embed_get_web_view (embed); + g_assert (view); + } - /* Causing a session load here should not create new windows, since we - * already have some. - */ - ephy_session_save (session); + /* Causing a session load here should not create new windows, since we + * already have some. + */ + ephy_session_save (session); - ephy_session_resume (session, user_time, NULL, NULL, NULL); + ephy_session_resume (session, user_time, NULL, NULL, NULL); - /* Ensure the queue is processed. */ - while (gtk_events_pending ()) - gtk_main_iteration_do (FALSE); + /* Ensure the queue is processed. */ + while (gtk_events_pending ()) + gtk_main_iteration_do (FALSE); - l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); - g_assert (l); - g_assert_cmpint (g_list_length (l), ==, 2); + l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); + g_assert (l); + g_assert_cmpint (g_list_length (l), ==, 2); - /* We should still have only 2 windows after the session load - * command - it should bail after noticing there are windows - * already. - */ - ephy_shell_open_uris (ephy_shell_get_default (), uris, 0, user_time); + /* We should still have only 2 windows after the session load + * command - it should bail after noticing there are windows + * already. + */ + ephy_shell_open_uris (ephy_shell_get_default (), uris, 0, user_time); - while (gtk_events_pending ()) - gtk_main_iteration_do (FALSE); + while (gtk_events_pending ()) + gtk_main_iteration_do (FALSE); - /* We should still have 2 windows here, since the new URI should be - * in a new tab of an existing window. - */ - l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); - g_assert (l); - g_assert_cmpint (g_list_length (l), ==, final_num_windows); + /* We should still have 2 windows here, since the new URI should be + * in a new tab of an existing window. + */ + l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ())); + g_assert (l); + g_assert_cmpint (g_list_length (l), ==, final_num_windows); - enable_delayed_loading (); - ephy_session_clear (session); + enable_delayed_loading (); + ephy_session_clear (session); } static void test_ephy_session_open_uri_after_loading_session (void) { - const char* uris[] = { "ephy-about:epiphany", NULL }; + const char *uris[] = { "ephy-about:epiphany", NULL }; - open_uris_after_loading_session (uris, 2); + open_uris_after_loading_session (uris, 2); } static void test_ephy_session_open_empty_uri_forces_new_window (void) { - const char* uris[] = { "", NULL }; + const char *uris[] = { "", NULL }; - open_uris_after_loading_session (uris, 3); + open_uris_after_loading_session (uris, 3); } int diff --git a/tests/ephy-shell-test.c b/tests/ephy-shell-test.c index cf94462f6..4ccdbc436 100644 --- a/tests/ephy-shell-test.c +++ b/tests/ephy-shell-test.c @@ -54,13 +54,13 @@ test_ephy_shell_basic_embeds (void) /* Embed should be created. */ embed1 = ephy_shell_new_tab_full - (ephy_shell, - NULL, /* title */ - NULL, /* related view */ - window, - NULL, /* embed */ - EPHY_NEW_TAB_DONT_SHOW_WINDOW, /* flags */ - gtk_get_current_event_time ()); + (ephy_shell, + NULL, /* title */ + NULL, /* related view */ + window, + NULL, /* embed */ + EPHY_NEW_TAB_DONT_SHOW_WINDOW, /* flags */ + gtk_get_current_event_time ()); g_assert (EPHY_IS_EMBED (embed1)); g_assert (gtk_widget_get_toplevel (GTK_WIDGET (embed1)) == GTK_WIDGET (window)); @@ -71,13 +71,13 @@ test_ephy_shell_basic_embeds (void) /* Another embed should be created */ embed2 = ephy_shell_new_tab_full - (ephy_shell, - NULL, /* title */ - NULL, /* related view */ - window, /* window */ - NULL, /* embed */ - EPHY_NEW_TAB_DONT_SHOW_WINDOW, /* flags */ - gtk_get_current_event_time ()); + (ephy_shell, + NULL, /* title */ + NULL, /* related view */ + window, /* window */ + NULL, /* embed */ + EPHY_NEW_TAB_DONT_SHOW_WINDOW, /* flags */ + gtk_get_current_event_time ()); g_assert (EPHY_IS_EMBED (embed2)); /* A second children should exist now. */ @@ -101,8 +101,8 @@ test_ephy_shell_parent_windows (void) /* parent-window provided */ embed = ephy_shell_new_tab - (ephy_shell, EPHY_WINDOW (window), NULL, - EPHY_NEW_TAB_DONT_SHOW_WINDOW); + (ephy_shell, EPHY_WINDOW (window), NULL, + EPHY_NEW_TAB_DONT_SHOW_WINDOW); g_assert (EPHY_IS_EMBED (embed)); g_assert (gtk_widget_get_toplevel (GTK_WIDGET (embed)) == window); @@ -112,8 +112,8 @@ test_ephy_shell_parent_windows (void) /* Another new-window */ window2 = GTK_WIDGET (ephy_window_new ()); embed = ephy_shell_new_tab - (ephy_shell, EPHY_WINDOW (window2), NULL, - EPHY_NEW_TAB_DONT_SHOW_WINDOW); + (ephy_shell, EPHY_WINDOW (window2), NULL, + EPHY_NEW_TAB_DONT_SHOW_WINDOW); /* The parent window should be a completely new one. */ g_assert (EPHY_IS_EMBED (embed)); @@ -140,8 +140,8 @@ test_ephy_shell_tab_load (void) /* homepage is "about:blank" for now, see embed/ephy-web-view.c */ embed = ephy_shell_new_tab - (ephy_shell, EPHY_WINDOW (window), NULL, - EPHY_NEW_TAB_DONT_SHOW_WINDOW); + (ephy_shell, EPHY_WINDOW (window), NULL, + EPHY_NEW_TAB_DONT_SHOW_WINDOW); ephy_web_view_load_homepage (ephy_embed_get_web_view (embed)); g_assert (EPHY_IS_EMBED (embed)); @@ -159,8 +159,8 @@ test_ephy_shell_tab_load (void) /* open-page "about:epiphany" for testing. */ embed = ephy_shell_new_tab - (ephy_shell, EPHY_WINDOW (window), NULL, - EPHY_NEW_TAB_DONT_SHOW_WINDOW); + (ephy_shell, EPHY_WINDOW (window), NULL, + EPHY_NEW_TAB_DONT_SHOW_WINDOW); ephy_web_view_load_url (ephy_embed_get_web_view (embed), "about:epiphany"); g_assert (EPHY_IS_EMBED (embed)); @@ -248,7 +248,7 @@ test_ephy_shell_tab_from_external (void) loop = ephy_test_utils_setup_ensure_web_views_are_loaded (); embed = ephy_shell_new_tab (ephy_shell, NULL, NULL, "about:epiphany", - EPHY_NEW_TAB_DONT_SHOW_WINDOW | EPHY_NEW_TAB_OPEN_PAGE); + EPHY_NEW_TAB_DONT_SHOW_WINDOW | EPHY_NEW_TAB_OPEN_PAGE); window = gtk_widget_get_toplevel (GTK_WIDGET (embed)); notebook = ephy_window_get_notebook (EPHY_WINDOW (window)); @@ -289,7 +289,7 @@ test_ephy_shell_tab_from_external (void) /* This should work */ ephy_test_utils_check_ephy_embed_address (embed2, "ephy-about:overview"); g_assert_cmpint (gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)), ==, 1); - + loop = ephy_test_utils_setup_wait_until_load_is_committed (ephy_embed_get_web_view (embed2)); embed5 = ephy_shell_new_tab (ephy_shell, EPHY_WINDOW (window), NULL, "about:applications", diff --git a/tests/ephy-snapshot-service-test.c b/tests/ephy-snapshot-service-test.c index 8974a3f17..a442a38d5 100644 --- a/tests/ephy-snapshot-service-test.c +++ b/tests/ephy-snapshot-service-test.c @@ -29,8 +29,8 @@ SoupServer *server; static gboolean quit_when_test_done (GtkWidget *w, - GdkEvent *event, - gint *tests) + GdkEvent *event, + gint *tests) { if (--(*tests) == 0) gtk_main_quit (); @@ -39,13 +39,13 @@ quit_when_test_done (GtkWidget *w, } static void -on_snapshot_ready (GObject *source, +on_snapshot_ready (GObject *source, GAsyncResult *res, - gint *tests) + gint *tests) { GdkPixbuf *pixbuf; #if 0 - GtkWidget *w,*i; + GtkWidget *w, *i; #endif GError *error = NULL; @@ -61,14 +61,14 @@ on_snapshot_ready (GObject *source, } else #if 0 - w = gtk_window_new (GTK_WINDOW_TOPLEVEL); + w = gtk_window_new (GTK_WINDOW_TOPLEVEL); i = gtk_image_new_from_pixbuf (pixbuf); gtk_container_add (GTK_CONTAINER (w), i); gtk_widget_show_all (w); g_signal_connect (w, "delete-event", G_CALLBACK (quit_when_test_done), tests); #else - quit_when_test_done (NULL, NULL, tests); + quit_when_test_done (NULL, NULL, tests); #endif } @@ -213,12 +213,11 @@ server_callback (SoupServer *s, SoupMessage *msg, const char *response = "<html><h1>This is a header</h1></html>"; if (msg->method == SOUP_METHOD_GET) { - soup_message_set_status (msg, SOUP_STATUS_OK); - soup_message_body_append (msg->response_body, SOUP_MEMORY_STATIC, + soup_message_set_status (msg, SOUP_STATUS_OK); + soup_message_body_append (msg->response_body, SOUP_MEMORY_STATIC, response, strlen (response)); - soup_message_body_complete (msg->response_body); - } - else + soup_message_body_complete (msg->response_body); + } else soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED); } @@ -230,12 +229,12 @@ main (int argc, char *argv[]) server = soup_server_new (SOUP_SERVER_SERVER_HEADER, "snapshot-service-test-server", NULL); - soup_server_add_handler (server, NULL, + soup_server_add_handler (server, NULL, server_callback, NULL, NULL); soup_server_listen_local (server, 45716, SOUP_SERVER_LISTEN_IPV4_ONLY, NULL); - mtime = time(NULL); + mtime = time (NULL); g_test_add_func ("/lib/ephy-snapshot-service/test_snapshot", test_snapshot); diff --git a/tests/ephy-sqlite-test.c b/tests/ephy-sqlite-test.c index d97ece1cf..8ca8a36ba 100644 --- a/tests/ephy-sqlite-test.c +++ b/tests/ephy-sqlite-test.c @@ -27,7 +27,7 @@ #include <gtk/gtk.h> static EphySQLiteConnection * -ensure_empty_database (const char* filename) +ensure_empty_database (const char *filename) { EphySQLiteConnection *connection = ephy_sqlite_connection_new (); GError *error = NULL; @@ -49,9 +49,9 @@ test_create_connection (void) EphySQLiteConnection *connection = ensure_empty_database (temporary_file); ephy_sqlite_connection_close (connection); - g_assert ( g_file_test (temporary_file, G_FILE_TEST_IS_REGULAR)); + g_assert (g_file_test (temporary_file, G_FILE_TEST_IS_REGULAR)); g_unlink (temporary_file); - g_assert ( !g_file_test (temporary_file, G_FILE_TEST_IS_REGULAR)); + g_assert (!g_file_test (temporary_file, G_FILE_TEST_IS_REGULAR)); g_free (temporary_file); temporary_file = g_build_filename (g_get_tmp_dir (), "directory-that-does-not-exist", "epiphany_sqlite_test.db", NULL); @@ -66,7 +66,7 @@ static void test_create_statement (void) { gchar *temporary_file = g_build_filename (g_get_tmp_dir (), "epiphany-sqlite-test.db", NULL); - EphySQLiteConnection* connection = ensure_empty_database (temporary_file); + EphySQLiteConnection *connection = ensure_empty_database (temporary_file); GError *error = NULL; EphySQLiteStatement *statement = NULL; @@ -132,7 +132,7 @@ static void test_create_table_and_insert_row (void) { gchar *temporary_file = g_build_filename (g_get_tmp_dir (), "epiphany-sqlite-test.db", NULL); - EphySQLiteConnection* connection = ensure_empty_database (temporary_file); + EphySQLiteConnection *connection = ensure_empty_database (temporary_file); create_table_and_insert_row (connection); @@ -145,7 +145,7 @@ static void test_bind_data (void) { gchar *temporary_file = g_build_filename (g_get_tmp_dir (), "epiphany-sqlite-test.db", NULL); - EphySQLiteConnection* connection = ensure_empty_database (temporary_file); + EphySQLiteConnection *connection = ensure_empty_database (temporary_file); GError *error = NULL; EphySQLiteStatement *statement = NULL; @@ -183,7 +183,7 @@ static void test_table_exists (void) { gchar *temporary_file = g_build_filename (g_get_tmp_dir (), "epiphany-sqlite-test.db", NULL); - EphySQLiteConnection* connection = ensure_empty_database (temporary_file); + EphySQLiteConnection *connection = ensure_empty_database (temporary_file); g_assert (!ephy_sqlite_connection_table_exists (connection, "test")); g_assert (!ephy_sqlite_connection_table_exists (connection, "something_fakey")); diff --git a/tests/ephy-test-utils.c b/tests/ephy-test-utils.c index a6e1383f2..af6cbb40d 100644 --- a/tests/ephy-test-utils.c +++ b/tests/ephy-test-utils.c @@ -40,16 +40,16 @@ ephy_test_utils_check_ephy_web_view_address (EphyWebView *view, } void -ephy_test_utils_check_ephy_embed_address (EphyEmbed *embed, +ephy_test_utils_check_ephy_embed_address (EphyEmbed *embed, const gchar *address) { ephy_test_utils_check_ephy_web_view_address (ephy_embed_get_web_view (embed), address); } static void -load_changed_cb (WebKitWebView *web_view, +load_changed_cb (WebKitWebView *web_view, WebKitLoadEvent status, - GMainLoop *loop) + GMainLoop *loop) { if (status == WEBKIT_LOAD_COMMITTED) { web_view_ready_counter--; @@ -58,7 +58,6 @@ load_changed_cb (WebKitWebView *web_view, if (web_view_ready_counter == 0) g_main_loop_quit (loop); } - } static void @@ -74,7 +73,7 @@ web_view_created_cb (EphyEmbedShell *shell, EphyWebView *view, GMainLoop *loop) wait_until_load_is_committed (WEBKIT_WEB_VIEW (view), loop); } -GMainLoop* +GMainLoop * ephy_test_utils_setup_ensure_web_views_are_loaded (void) { GMainLoop *loop; @@ -99,7 +98,7 @@ ephy_test_utils_ensure_web_views_are_loaded (GMainLoop *loop) g_main_loop_unref (loop); } -GMainLoop* +GMainLoop * ephy_test_utils_setup_wait_until_load_is_committed (EphyWebView *view) { GMainLoop *loop; diff --git a/tests/ephy-uri-helpers-test.c b/tests/ephy-uri-helpers-test.c index a3ae24e94..b7beaa129 100644 --- a/tests/ephy-uri-helpers-test.c +++ b/tests/ephy-uri-helpers-test.c @@ -44,14 +44,13 @@ test_ephy_uri_helpers_remove_tracking (void) { "http://foo.youtube.com/?feature=foo", "http://foo.youtube.com/" }, /* https://bugzilla.gnome.org/show_bug.cgi?id=724724 */ { "http://git.savannah.gnu.org/gitweb/?p=grep.git;a=commit;h=97318f5e59a1ef6feb8a378434a00932a3fc1e0b", - "http://git.savannah.gnu.org/gitweb/?p=grep.git;a=commit;h=97318f5e59a1ef6feb8a378434a00932a3fc1e0b"}, + "http://git.savannah.gnu.org/gitweb/?p=grep.git;a=commit;h=97318f5e59a1ef6feb8a378434a00932a3fc1e0b" }, /* https://bugzilla.gnome.org/show_bug.cgi?id=730464 */ { "https://mail.google.com/mail/u/0/?ui=2&ik=37373eb942&rid=7cea..&auto=1&view=lno&_reqid=1168127&pcd=1&mb=0&rt=j", "https://mail.google.com/mail/u/0/?ui=2&ik=37373eb942&rid=7cea..&auto=1&view=lno&_reqid=1168127&pcd=1&mb=0&rt=j" }, { "http://www.test.com/?utm_source=feedburner&view=lno&_reqid=1234", "http://www.test.com/?view=lno&_reqid=1234" }, { "http://www.test.com/?some&valid&query", "http://www.test.com/?some&valid&query" }, { "http://www.test.com/?utm_source=feedburner&some&valid&query", "http://www.test.com/?some&valid&query" }, - }; guint i; diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c index cc0b78935..0f3d3d66e 100644 --- a/tests/ephy-web-view-test.c +++ b/tests/ephy-web-view-test.c @@ -42,12 +42,12 @@ #define SERVER_PORT 12321 static void -server_callback (SoupServer *server, - SoupMessage *msg, - const char *path, - GHashTable *query, +server_callback (SoupServer *server, + SoupMessage *msg, + const char *path, + GHashTable *query, SoupClientContext *context, - gpointer data) + gpointer data) { if (g_str_equal (path, "/cancelled")) soup_message_set_status (msg, SOUP_STATUS_CANT_CONNECT); @@ -271,9 +271,9 @@ normalize_or_autosearch_t normalize_or_autosearch_test_google[] = { }; static void -verify_normalize_or_autosearch_urls (EphyWebView *view, +verify_normalize_or_autosearch_urls (EphyWebView *view, normalize_or_autosearch_t *test, - gint n_tests) + gint n_tests) { int i; @@ -295,7 +295,7 @@ test_ephy_web_view_normalize_or_autosearch (void) { char *default_engine_url; EphyWebView *view; - + view = EPHY_WEB_VIEW (ephy_web_view_new ()); default_engine_url = g_settings_get_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_KEYWORD_SEARCH_URL); @@ -333,10 +333,10 @@ quit_main_loop_when_load_finished (WebKitWebView *view, WebKitLoadEvent load_eve static guint back_forward_list_counter = 0; static void -back_forward_list_changed (WebKitBackForwardList *list, +back_forward_list_changed (WebKitBackForwardList *list, WebKitBackForwardListItem *added_item, - GList *removed_items, - GMainLoop *loop) + GList *removed_items, + GMainLoop *loop) { back_forward_list_counter--; @@ -346,13 +346,13 @@ back_forward_list_changed (WebKitBackForwardList *list, static void wait_until_back_forward_list_changes (WebKitWebView *view, - GMainLoop *loop) + GMainLoop *loop) { - WebKitBackForwardList *back_forward_list = webkit_web_view_get_back_forward_list (view); - g_signal_connect (back_forward_list, "changed", G_CALLBACK (back_forward_list_changed), loop); + WebKitBackForwardList *back_forward_list = webkit_web_view_get_back_forward_list (view); + g_signal_connect (back_forward_list, "changed", G_CALLBACK (back_forward_list_changed), loop); } -static GMainLoop* +static GMainLoop * setup_ensure_back_forward_list_changes (EphyWebView *view) { GMainLoop *loop; @@ -378,70 +378,70 @@ ensure_back_forward_list_changes (GMainLoop *loop) static void test_ephy_web_view_provisional_load_failure_updates_back_forward_list (void) { - GMainLoop *loop; - EphyWebView *view; - const char *bad_url; + GMainLoop *loop; + EphyWebView *view; + const char *bad_url; - view = EPHY_WEB_VIEW (ephy_web_view_new ()); + view = EPHY_WEB_VIEW (ephy_web_view_new ()); - loop = setup_ensure_back_forward_list_changes (view); - bad_url = "http://localhost:2984375932/"; + loop = setup_ensure_back_forward_list_changes (view); + bad_url = "http://localhost:2984375932/"; - ephy_web_view_load_url (view, bad_url); + ephy_web_view_load_url (view, bad_url); - ensure_back_forward_list_changes (loop); + ensure_back_forward_list_changes (loop); - g_assert (webkit_back_forward_list_get_current_item ( - webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)))); + g_assert (webkit_back_forward_list_get_current_item ( + webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)))); - g_assert_cmpstr (bad_url, ==, webkit_back_forward_list_item_get_uri ( - webkit_back_forward_list_get_current_item ( - webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view))))); + g_assert_cmpstr (bad_url, ==, webkit_back_forward_list_item_get_uri ( + webkit_back_forward_list_get_current_item ( + webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view))))); - g_object_unref (g_object_ref_sink (view)); + g_object_unref (g_object_ref_sink (view)); } static gboolean -visit_url_cb (EphyHistoryService *service, - const char *url, +visit_url_cb (EphyHistoryService *service, + const char *url, EphyHistoryPageVisit visit_type, - gpointer user_data) + gpointer user_data) { - /* We are only loading an error page, this code should never be - * reached. */ - g_assert_not_reached (); + /* We are only loading an error page, this code should never be + * reached. */ + g_assert_not_reached (); - return FALSE; + return FALSE; } static void test_ephy_web_view_error_pages_not_stored_in_history (void) { - GMainLoop *loop; - EphyWebView *view; - const char *bad_url; - EphyHistoryService *history_service; - EphyEmbedShell *embed_shell = ephy_embed_shell_get_default (); + GMainLoop *loop; + EphyWebView *view; + const char *bad_url; + EphyHistoryService *history_service; + EphyEmbedShell *embed_shell = ephy_embed_shell_get_default (); - view = EPHY_WEB_VIEW (ephy_web_view_new ()); - loop = g_main_loop_new (NULL, FALSE); - bad_url = "http://localhost:2984375932/"; + view = EPHY_WEB_VIEW (ephy_web_view_new ()); + loop = g_main_loop_new (NULL, FALSE); + bad_url = "http://localhost:2984375932/"; - history_service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (embed_shell)); - g_assert (history_service); - g_signal_connect (history_service, "visit-url", - G_CALLBACK (visit_url_cb), NULL); - - ephy_web_view_load_url (view, bad_url); + history_service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (embed_shell)); + g_assert (history_service); + g_signal_connect (history_service, "visit-url", + G_CALLBACK (visit_url_cb), NULL); - g_signal_connect (view, "load-changed", - G_CALLBACK (quit_main_loop_when_load_finished), loop); + ephy_web_view_load_url (view, bad_url); - g_main_loop_run (loop); - g_main_loop_unref (loop); - g_signal_handlers_disconnect_by_func (history_service, G_CALLBACK (visit_url_cb), NULL); + g_signal_connect (view, "load-changed", + G_CALLBACK (quit_main_loop_when_load_finished), loop); - g_object_unref (g_object_ref_sink (view)); + g_main_loop_run (loop); + g_main_loop_unref (loop); + g_signal_handlers_disconnect_by_func (history_service, G_CALLBACK (visit_url_cb), NULL); + + g_object_unref (g_object_ref_sink (view)); } int @@ -466,7 +466,7 @@ main (int argc, char *argv[]) server = soup_server_new (NULL, NULL); soup_server_add_handler (server, NULL, server_callback, NULL, NULL); soup_server_listen_local (server, SERVER_PORT, - SOUP_SERVER_LISTEN_IPV4_ONLY, NULL); + SOUP_SERVER_LISTEN_IPV4_ONLY, NULL); g_test_add_func ("/embed/ephy-web-view/non_search_regex", test_ephy_web_view_non_search_regex); |