aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ephy-session-test.c
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2013-02-23 02:38:01 +0800
committerGustavo Noronha Silva <gns@gnome.org>2013-02-24 04:41:13 +0800
commitb45047739e9ebc02200267a52295f24adf4ca668 (patch)
tree743bfd4c0aa63703286947707252b3f366d4a7cb /tests/ephy-session-test.c
parent1bf2e792d47a41ee9117ffae1c699419d211644a (diff)
downloadgsoc2013-epiphany-b45047739e9ebc02200267a52295f24adf4ca668.tar
gsoc2013-epiphany-b45047739e9ebc02200267a52295f24adf4ca668.tar.gz
gsoc2013-epiphany-b45047739e9ebc02200267a52295f24adf4ca668.tar.bz2
gsoc2013-epiphany-b45047739e9ebc02200267a52295f24adf4ca668.tar.lz
gsoc2013-epiphany-b45047739e9ebc02200267a52295f24adf4ca668.tar.xz
gsoc2013-epiphany-b45047739e9ebc02200267a52295f24adf4ca668.tar.zst
gsoc2013-epiphany-b45047739e9ebc02200267a52295f24adf4ca668.zip
Add setting for delayed tab loading, and use it to fix the session tests
The session tests were broken by the delayed tab loading feature - the restored embeds would not finish loading and thus the expectations for the URIs were not met. This change adds a setting that is now used by those tests to disable the feature temporarily. Also revert "ephy-session-test: make tests pass", which is no longer necessary. This reverts commit 75da5fff3f4489dacf4ded6f012daa06af306709. https://bugzilla.gnome.org/show_bug.cgi?id=694470
Diffstat (limited to 'tests/ephy-session-test.c')
-rw-r--r--tests/ephy-session-test.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/tests/ephy-session-test.c b/tests/ephy-session-test.c
index 01d10aa62..eda9ab497 100644
--- a/tests/ephy-session-test.c
+++ b/tests/ephy-session-test.c
@@ -25,6 +25,7 @@
#include "ephy-embed-private.h"
#include "ephy-file-helpers.h"
#include "ephy-private.h"
+#include "ephy-settings.h"
#include "ephy-shell.h"
#include "ephy-session.h"
@@ -72,6 +73,22 @@ load_session_from_string (EphySession *session,
}
static void
+enable_delayed_loading (void)
+{
+ g_settings_set_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_RESTORE_SESSION_DELAYING_LOADS,
+ TRUE);
+}
+
+static void
+disable_delayed_loading (void)
+{
+ g_settings_set_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_RESTORE_SESSION_DELAYING_LOADS,
+ FALSE);
+}
+
+static void
test_ephy_session_load (void)
{
EphySession *session;
@@ -80,6 +97,8 @@ test_ephy_session_load (void)
EphyEmbed *embed;
EphyWebView *view;
+ disable_delayed_loading ();
+
session = ephy_shell_get_session (ephy_shell_get_default ());
g_assert (session);
@@ -94,9 +113,11 @@ test_ephy_session_load (void)
g_assert (embed);
view = ephy_embed_get_web_view (embed);
g_assert (view);
- g_assert_cmpstr (ephy_web_view_get_address (view), ==, "about:memory");
+ g_assert_cmpstr (ephy_web_view_get_address (view), ==, "ephy-about:memory");
ephy_session_clear (session);
+
+ enable_delayed_loading ();
}
const char *session_data_many_windows =
@@ -116,6 +137,8 @@ test_ephy_session_clear (void)
EphySession *session;
GList *l;
+ disable_delayed_loading ();
+
session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ()));
load_session_from_string (session, session_data_many_windows);
@@ -140,6 +163,8 @@ test_ephy_session_load_empty_session (void)
EphyEmbed *embed;
EphyWebView *view;
+ disable_delayed_loading ();
+
session = ephy_shell_get_session (ephy_shell_get_default ());
g_assert (session);
@@ -163,6 +188,7 @@ test_ephy_session_load_empty_session (void)
g_assert (view);
g_assert_cmpstr (ephy_web_view_get_address (view), ==, "ephy-about:overview");
+ enable_delayed_loading ();
ephy_session_clear (session);
}
@@ -175,6 +201,8 @@ test_ephy_session_load_many_windows (void)
EphyEmbed *embed;
EphyWebView *view;
+ disable_delayed_loading ();
+
session = ephy_shell_get_session (ephy_shell_get_default ());
g_assert (session);
@@ -190,9 +218,10 @@ test_ephy_session_load_many_windows (void)
g_assert (embed);
view = ephy_embed_get_web_view (embed);
g_assert (view);
- g_assert_cmpstr (ephy_web_view_get_address (view), ==, "about:epiphany");
+ g_assert_cmpstr (ephy_web_view_get_address (view), ==, "ephy-about:epiphany");
}
+ enable_delayed_loading ();
ephy_session_clear (session);
}
@@ -206,6 +235,8 @@ open_uris_after_loading_session (const char** uris, int final_num_windows)
EphyWebView *view;
guint32 user_time;
+ disable_delayed_loading ();
+
session = ephy_shell_get_session (ephy_shell_get_default ());
g_assert (session);
@@ -224,7 +255,7 @@ open_uris_after_loading_session (const char** uris, int final_num_windows)
g_assert (embed);
view = ephy_embed_get_web_view (embed);
g_assert (view);
- g_assert_cmpstr (ephy_web_view_get_address (view), ==, "about:epiphany");
+ g_assert_cmpstr (ephy_web_view_get_address (view), ==, "ephy-about:epiphany");
}
/* Causing a session load here should not create new windows, since we
@@ -258,6 +289,7 @@ open_uris_after_loading_session (const char** uris, int final_num_windows)
g_assert (l);
g_assert_cmpint (g_list_length (l), ==, final_num_windows);
+ enable_delayed_loading ();
ephy_session_clear (session);
}
@@ -289,6 +321,8 @@ test_ephy_session_restore_tabs (void)
int n_windows;
EphyEmbed *embed;
+ disable_delayed_loading ();
+
/* Nothing to restore. */
g_assert (ephy_session_get_can_undo_tab_closed (session) == FALSE);
@@ -340,6 +374,7 @@ test_ephy_session_restore_tabs (void)
/* We have the same amount of windows than before destroying one. */
g_assert_cmpint (n_windows, ==, g_list_length (gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default()))));
+ enable_delayed_loading ();
ephy_session_clear (session);
}
@@ -348,6 +383,8 @@ main (int argc, char *argv[])
{
int ret;
+ setenv ("GSETTINGS_BACKEND", "memory", TRUE);
+
gtk_test_init (&argc, &argv);
ephy_debug_init ();