diff options
author | Gustavo Noronha Silva <gns@gnome.org> | 2012-12-11 01:13:27 +0800 |
---|---|---|
committer | Gustavo Noronha Silva <gns@gnome.org> | 2012-12-11 20:34:37 +0800 |
commit | b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64 (patch) | |
tree | f1047567ac13933d429f948cb18509fa543849f7 /tests | |
parent | c968c68cabc319896ad4d2096940c9a34d4c13cd (diff) | |
download | gsoc2013-epiphany-b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64.tar gsoc2013-epiphany-b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64.tar.gz gsoc2013-epiphany-b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64.tar.bz2 gsoc2013-epiphany-b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64.tar.lz gsoc2013-epiphany-b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64.tar.xz gsoc2013-epiphany-b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64.tar.zst gsoc2013-epiphany-b7f88ee85c61fee4f8059e7fc2456c3ca83ccb64.zip |
Open new windows when called with no URIs to open
GNOME Shell tries to open new windows by calling the application with no
parameters. This strategy is also used by the 'Launch web browser' keybinding,
that can be interpreted as the user requesting a new window, so open a new
window when called with no URIs, unless --new-tag is given explicitly.
Partially fixes https://bugzilla.gnome.org/show_bug.cgi?id=685976
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ephy-session-test.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/ephy-session-test.c b/tests/ephy-session-test.c index 4923f2779..b69403f85 100644 --- a/tests/ephy-session-test.c +++ b/tests/ephy-session-test.c @@ -160,7 +160,7 @@ test_ephy_session_load_many_windows (void) } static void -test_ephy_session_open_uri_after_loading_session (void) +open_uris_after_loading_session (const char** uris, int final_num_windows) { EphySession *session; gboolean ret; @@ -168,7 +168,6 @@ test_ephy_session_open_uri_after_loading_session (void) EphyEmbed *embed; EphyWebView *view; guint32 user_time; - const char* uris[] = { "ephy-about:epiphany", NULL }; session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ())); g_assert (session); @@ -229,7 +228,27 @@ test_ephy_session_open_uri_after_loading_session (void) */ l = ephy_shell_get_windows (ephy_shell_get_default ()); g_assert (l); - g_assert_cmpint (g_list_length (l), ==, 2); + g_assert_cmpint (g_list_length (l), ==, final_num_windows); + + /* FIXME: See comments above. */ + for (p = l; p; p = p->next) + gtk_widget_destroy (GTK_WIDGET (p->data)); +} + +static void +test_ephy_session_open_uri_after_loading_session (void) +{ + const char* uris[] = { "ephy-about:epiphany", NULL }; + + open_uris_after_loading_session (uris, 2); +} + +static void +test_ephy_session_open_empty_uri_forces_new_window (void) +{ + const char* uris[] = { "", NULL }; + + open_uris_after_loading_session (uris, 3); } int @@ -266,6 +285,9 @@ main (int argc, char *argv[]) g_test_add_func ("/src/ephy-session/open-uri-after-loading_session", test_ephy_session_open_uri_after_loading_session); + g_test_add_func ("/src/ephy-session/open-empty-uri-forces-new-window", + test_ephy_session_open_empty_uri_forces_new_window); + ret = g_test_run (); g_object_unref (ephy_shell_get_default ()); |