aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-08-01 00:09:00 +0800
committerXan Lopez <xan@igalia.com>2012-08-01 00:09:00 +0800
commit38e02f6d3aeac853cf14e6edcc84d9e588207d94 (patch)
tree264681048661538f6e0d11cb0b574939930a57d3 /tests
parentee276bcbe7ce834b0e20bf9141a1155c3f472d6b (diff)
downloadgsoc2013-epiphany-38e02f6d3aeac853cf14e6edcc84d9e588207d94.tar
gsoc2013-epiphany-38e02f6d3aeac853cf14e6edcc84d9e588207d94.tar.gz
gsoc2013-epiphany-38e02f6d3aeac853cf14e6edcc84d9e588207d94.tar.bz2
gsoc2013-epiphany-38e02f6d3aeac853cf14e6edcc84d9e588207d94.tar.lz
gsoc2013-epiphany-38e02f6d3aeac853cf14e6edcc84d9e588207d94.tar.xz
gsoc2013-epiphany-38e02f6d3aeac853cf14e6edcc84d9e588207d94.tar.zst
gsoc2013-epiphany-38e02f6d3aeac853cf14e6edcc84d9e588207d94.zip
ephy-session: spawn the default window if the session state file is broken
https://bugzilla.gnome.org/show_bug.cgi?id=680590
Diffstat (limited to 'tests')
-rw-r--r--tests/ephy-session-test.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/ephy-session-test.c b/tests/ephy-session-test.c
index 06b8d624c..57b29fd2b 100644
--- a/tests/ephy-session-test.c
+++ b/tests/ephy-session-test.c
@@ -73,6 +73,48 @@ test_ephy_session_load ()
gtk_widget_destroy (GTK_WIDGET (l->data));
}
+const char *session_data_empty =
+"";
+
+static void
+test_ephy_session_load_empty_session ()
+{
+ EphySession *session;
+ gboolean ret;
+ GList *l;
+ EphyEmbed *embed;
+ EphyWebView *view;
+
+ session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+ g_assert (session);
+
+ ret = ephy_session_load_from_string (session, session_data_empty, -1, 0);
+ 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. */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
+ l = ephy_session_get_windows (session);
+ 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);
+ g_assert_cmpstr (ephy_web_view_get_address (view), ==, "about:blank");
+
+ /* FIXME: Destroy the window. I think ideally we'd like something
+ * like 'ephy_session_clear ()' to reset everything to its initial
+ * state here. That or allow EphyShell to be created more than
+ * once and do it once per test. */
+ gtk_widget_destroy (GTK_WIDGET (l->data));
+}
+
const char *session_data_many_windows =
"<?xml version=\"1.0\"?>"
"<session>"
@@ -135,6 +177,9 @@ main (int argc, char *argv[])
g_test_add_func ("/src/ephy-session/load",
test_ephy_session_load);
+ g_test_add_func ("/src/ephy-session/load-empty-session",
+ test_ephy_session_load_empty_session);
+
g_test_add_func ("/src/ephy-session/load-many-windows",
test_ephy_session_load_many_windows);