int
main (int argc, char *argv[])
{
  gboolean ret;

  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_test_add_func ("/src/ephy-completion-model/create",
                   test_ephy_completion_model_create);

  g_test_add_func ("/src/ephy-completion-model/update_empty",
                   test_ephy_completion_model_update_empty);

  ret = g_test_run ();

  return ret;
}
Example #2
0
int
main (int argc, char *argv[])
{
  gboolean ret;

  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_test_add_func ("/src/bookmarks/ephy-bookmarks/create",
                   test_ephy_bookmarks_create);

  g_test_add_func ("/src/bookmarks/ephy-bookmarks/add",
                   test_ephy_bookmarks_add);

  g_test_add_func ("/src/bookmarks/ephy-bookmarks/set_address",
                   test_ephy_bookmarks_set_address);

  ret = g_test_run ();

  return ret;
}
G_MODULE_EXPORT void
webkit_web_extension_initialize_with_user_data (WebKitWebExtension *extension,
                                                GVariant *user_data)
{
  EphyWebExtension *web_extension;
  char *service_name;
  const char *extension_id;
  const char *dot_dir;
  gboolean private_profile;
  GError *error = NULL;

  g_variant_get (user_data, "(&s&sb)", &extension_id, &dot_dir, &private_profile);

  if (!ephy_file_helpers_init (dot_dir, 0, &error)) {
    g_printerr ("Failed to initialize file helpers: %s\n", error->message);
    g_error_free (error);
  }

  ephy_debug_init ();

  web_extension = ephy_web_extension_get ();
  ephy_web_extension_initialize (web_extension, extension, dot_dir, private_profile);

  service_name = g_strdup_printf ("%s-%s", EPHY_WEB_EXTENSION_SERVICE_NAME, extension_id);
  g_bus_own_name (G_BUS_TYPE_SESSION,
                  service_name,
                  G_BUS_NAME_OWNER_FLAGS_NONE,
                  NULL,
                  (GBusNameAcquiredCallback)name_acquired_cb,
                  NULL,
                  web_extension, NULL);
  g_free (service_name);
}
G_MODULE_EXPORT void
webkit_web_extension_initialize_with_user_data (WebKitWebExtension *webkit_extension,
                                                GVariant           *user_data)
{
  const char *server_address;
  const char *dot_dir;
  const char *adblock_data_dir;
  gboolean private_profile;
  gboolean browser_mode;
  GError *error = NULL;

  g_variant_get (user_data, "(m&s&s&sbb)", &server_address, &dot_dir, &adblock_data_dir, &private_profile, &browser_mode);

  if (!server_address) {
    g_warning ("UI process did not start D-Bus server, giving up.");
    return;
  }

  if (!ephy_file_helpers_init (dot_dir, 0, &error)) {
    g_warning ("Failed to initialize file helpers: %s", error->message);
    g_error_free (error);
  }

  ephy_debug_init ();

  extension = ephy_web_extension_get ();

  ephy_web_extension_initialize (extension,
                                 webkit_extension,
                                 server_address,
                                 adblock_data_dir,
                                 private_profile,
                                 browser_mode);
}
Example #5
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;
}
int
main (int argc, char *argv[])
{
  g_type_init ();

  ephy_debug_init ();

  if (!ephy_file_helpers_init (NULL, FALSE, FALSE, NULL)) {
    LOG ("Something wrong happened with ephy_file_helpers_init()");
    return -1;
  }

  ephy_migrator ();

  return 0;
}
Example #7
0
int
main (int argc, char *argv[])
{
  GOptionContext *option_context;
  GOptionGroup *option_group;
  GError *error = NULL;

  g_type_init ();

  option_group = g_option_group_new ("ephy-profile-migrator",
                                     N_("Epiphany profile migrator"),
                                     N_("Epiphany profile migrator options"),
                                     NULL, NULL);

  g_option_group_set_translation_domain (option_group, GETTEXT_PACKAGE);
  g_option_group_add_entries (option_group, option_entries);

  option_context = g_option_context_new ("");
  g_option_context_set_main_group (option_context, option_group);

  if (!g_option_context_parse (option_context, &argc, &argv, &error)) {
    g_print ("Failed to parse arguments: %s\n", error->message);
    g_error_free (error);
    g_option_context_free (option_context);

    return 1;
  }
        
  g_option_context_free (option_context);

  ephy_debug_init ();

  if (!ephy_file_helpers_init (NULL, EPHY_FILE_HELPERS_NONE, NULL)) {
    LOG ("Something wrong happened with ephy_file_helpers_init()");
    return -1;
  }

  return ephy_migrator () ? 0 : 1;
}