From 6652006561a09e58a50b8f9003bc2c1baf7c8a4c Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 21 Jun 2012 17:27:10 +0200 Subject: Port web view loading progress and feedback to WebKit2 https://bugzilla.gnome.org/show_bug.cgi?id=678532 --- tests/ephy-web-view-test.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c index 31b6f78f8..0d5f627bd 100644 --- a/tests/ephy-web-view-test.c +++ b/tests/ephy-web-view-test.c @@ -64,7 +64,26 @@ server_callback (SoupServer *server, } #ifdef HAVE_WEBKIT2 -/* TODO: loader */ +static void +load_changed_cb (WebKitWebView *view, WebKitLoadEvent load_event, GMainLoop *loop) +{ + char *expected_url; + const char *loaded_url; + + if (load_event != WEBKIT_LOAD_FINISHED) + return; + + expected_url = g_object_get_data (G_OBJECT (view), "test.expected_url"); + g_assert (expected_url != NULL); + + loaded_url = webkit_web_view_get_uri (view); + g_assert_cmpstr (loaded_url, ==, expected_url); + + g_signal_handlers_disconnect_by_func (view, load_changed_cb, loop); + + g_free (expected_url); + g_main_loop_quit (loop); +} #else static void notify_load_status_cb (WebKitWebView *view, GParamSpec *spec, GMainLoop *loop) @@ -162,7 +181,8 @@ test_ephy_web_view_load_url () g_test_message ("[%s] \t-> %s", test.url, test.expected_url); #ifdef HAVE_WEBKIT2 - /* TODO: loader */ + g_signal_connect (view, "load-changed", + G_CALLBACK (load_changed_cb), loop); #else g_signal_connect (view, "notify::load-status", G_CALLBACK (notify_load_status_cb), loop); -- cgit v1.2.3