From 2541eed4d1dfda432e6663fdaab48081c9fef38c Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Tue, 12 Mar 2013 14:18:43 +0100 Subject: Fix EphyShell tests in WK2 waiting until views are loaded /src/ephy-shell/tab_load and /src/ephy-shell/tab_from_external tests were failing because of the same issue than session tests. We were not waiting till the views reach the committed load status in order to check the address. https://bugzilla.gnome.org/show_bug.cgi?id=695646 --- tests/ephy-test-utils.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/ephy-test-utils.c') diff --git a/tests/ephy-test-utils.c b/tests/ephy-test-utils.c index 95a90ec2a..83272de44 100644 --- a/tests/ephy-test-utils.c +++ b/tests/ephy-test-utils.c @@ -41,6 +41,13 @@ ephy_test_utils_check_ephy_web_view_address (EphyWebView *view, g_assert_cmpstr (ephy_web_view_get_address (view), ==, address); } +void +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, #ifdef HAVE_WEBKIT2 @@ -105,3 +112,26 @@ ephy_test_utils_ensure_web_views_are_loaded (GMainLoop *loop) g_assert_cmpint (web_view_ready_counter, ==, 0); g_main_loop_unref (loop); } + +GMainLoop* +ephy_test_utils_setup_wait_until_load_is_committed (EphyWebView *view) +{ + GMainLoop *loop; + + web_view_ready_counter = 1; + + loop = g_main_loop_new (NULL, FALSE); + wait_until_load_is_committed (WEBKIT_WEB_VIEW (view), loop); + + return loop; +} + +void +ephy_test_utils_wait_until_load_is_committed (GMainLoop *loop) +{ + if (web_view_ready_counter != 0) + g_main_loop_run (loop); + + g_assert_cmpint (web_view_ready_counter, ==, 0); + g_main_loop_unref (loop); +} -- cgit v1.2.3