Ejemplo n.º 1
0
ephy_web_extension_shutdown (void)
{
  if (extension)
    g_object_unref (extension);

  ephy_settings_shutdown ();
  ephy_file_helpers_shutdown ();
}
Ejemplo n.º 2
0
int
main (int argc, char *argv[])
{
    int ret;
    const char *xdg_data_dirs;
    char *new_xdg_data_dirs;
    char **dirs = NULL;
    char *schemas_dir;

    /* Save XDG_DATA_DIRS to set GSETTINGS_SCHEMA_DIR, otherwise we
     * won't find the sytem schemas. */
    xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
    if (!xdg_data_dirs)
        xdg_data_dirs = "/usr/local/share/:/usr/share/";

    dirs = g_strsplit (xdg_data_dirs, ":", -1);

    /* We can only use one directory, so use the first one or the system default. */
    schemas_dir = g_build_filename (dirs[0], "glib-2.0", "schemas", NULL);
    g_setenv ("GSETTINGS_SCHEMA_DIR", schemas_dir, TRUE);
    g_strfreev (dirs);
    g_free (schemas_dir);

    /* We need to make sure that XDG_DATA_DIRS includes a sensible
       directory where to find the mimetype database, otherwise bad
       stuff will happen. Prefix TEST_DIR for the test purposes. */
    new_xdg_data_dirs = g_strconcat (TEST_DIR, ":", xdg_data_dirs, NULL);
    g_setenv ("XDG_DATA_DIRS", new_xdg_data_dirs, TRUE);
    g_setenv ("XDG_DATA_HOME", TEST_DIR, TRUE);
    g_free (new_xdg_data_dirs);

    gtk_test_init (&argc, &argv);

    ephy_debug_init ();

    if (!ephy_file_helpers_init (NULL, EPHY_FILE_HELPERS_PRIVATE_PROFILE | EPHY_FILE_HELPERS_ENSURE_EXISTS, NULL)) {
        g_debug ("Something wrong happened with ephy_file_helpers_init()");
        return -1;
    }

    _ephy_shell_create_instance (EPHY_EMBED_SHELL_MODE_TEST);
    g_application_register (G_APPLICATION (ephy_embed_shell_get_default ()), NULL, NULL);

    g_test_add_func ("/embed/ephy-embed-shell/launch_handler",
                     test_ephy_embed_shell_launch_handler);

    g_test_add_func ("/embed/ephy-embed-shell/web-view-created",
                     test_ephy_embed_shell_web_view_created);

    ret = g_test_run ();

    g_object_unref (ephy_embed_shell_get_default ());
    ephy_file_helpers_shutdown ();

    return ret;
}