aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ephy-file-helpers-test.c
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2013-01-28 00:02:53 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2013-01-28 00:02:53 +0800
commit9483e9e52af9b36ad41215063b616e960928d78a (patch)
tree7f8eb94758808f74871dd9ff9833434a1685ce49 /tests/ephy-file-helpers-test.c
parent213b032a24ac9286af1f5ab3a4087d64eef12f52 (diff)
downloadgsoc2013-epiphany-9483e9e52af9b36ad41215063b616e960928d78a.tar
gsoc2013-epiphany-9483e9e52af9b36ad41215063b616e960928d78a.tar.gz
gsoc2013-epiphany-9483e9e52af9b36ad41215063b616e960928d78a.tar.bz2
gsoc2013-epiphany-9483e9e52af9b36ad41215063b616e960928d78a.tar.lz
gsoc2013-epiphany-9483e9e52af9b36ad41215063b616e960928d78a.tar.xz
gsoc2013-epiphany-9483e9e52af9b36ad41215063b616e960928d78a.tar.zst
gsoc2013-epiphany-9483e9e52af9b36ad41215063b616e960928d78a.zip
ephy-file-helpers: remove ephy_file_switch_temp_file()
It is racy and it is unnecessary as we've replaced all its instances with g_file_set_contents().
Diffstat (limited to 'tests/ephy-file-helpers-test.c')
-rw-r--r--tests/ephy-file-helpers-test.c73
1 files changed, 0 insertions, 73 deletions
diff --git a/tests/ephy-file-helpers-test.c b/tests/ephy-file-helpers-test.c
index dcb6cc539..c33c1da82 100644
--- a/tests/ephy-file-helpers-test.c
+++ b/tests/ephy-file-helpers-test.c
@@ -290,76 +290,6 @@ test_ephy_file_create_delete_tmp (void)
ephy_file_helpers_shutdown ();
}
-static void
-test_ephy_file_switch_temp_file (void)
-{
- char *tmp_file;
-
- GFile *orig;
- char *orig_path;
-
- GFile *dest;
- char *dest_path;
- char *file_cont = NULL;
-
- ephy_file_helpers_init (NULL, EPHY_FILE_HELPERS_PRIVATE_PROFILE, NULL);
-
- /* Empty dest */
- tmp_file = ephy_file_tmp_filename ("test-dest-XXXXXX", NULL);
- dest_path = g_build_filename (ephy_file_tmp_dir (), tmp_file, NULL);
- g_free (tmp_file);
-
- g_assert (g_file_test (dest_path, G_FILE_TEST_EXISTS) == FALSE);
- dest = g_file_new_for_path (dest_path);
-
- tmp_file = ephy_file_tmp_filename ("test-orig-XXXXXX", NULL);
- orig_path = g_build_filename (ephy_file_tmp_dir (), tmp_file, NULL);
- g_free (tmp_file);
-
- g_assert (g_file_test (orig_path, G_FILE_TEST_EXISTS) == FALSE);
- orig = g_file_new_for_path (orig_path);
-
- g_file_set_contents (orig_path, "orig", -1, NULL);
- g_assert (g_file_test (orig_path, G_FILE_TEST_EXISTS));
-
- g_test_message ("SWITCH: %s to %s", orig_path, dest_path);
-
- g_assert (ephy_file_switch_temp_file (dest, orig));
- g_assert (g_file_test (orig_path, G_FILE_TEST_EXISTS) == FALSE);
- g_assert (g_file_test (dest_path, G_FILE_TEST_EXISTS));
-
- g_assert (g_file_get_contents (dest_path, &file_cont, NULL, NULL));
- g_assert_cmpstr ("orig", ==, file_cont);
- g_free (file_cont);
-
- ephy_file_delete_uri (g_file_get_uri (dest));
- g_assert (g_file_test (dest_path, G_FILE_TEST_EXISTS) == FALSE);
-
- /* Full replace */
- g_file_set_contents (dest_path, "dest", -1, NULL);
- g_assert (g_file_test (dest_path, G_FILE_TEST_EXISTS));
-
- g_file_set_contents (orig_path, "orig", -1, NULL);
- g_assert (g_file_test (orig_path, G_FILE_TEST_EXISTS));
-
- g_test_message ("SWITCH REPLACE: %s to %s", orig_path, dest_path);
- g_assert (ephy_file_switch_temp_file (dest, orig));
- g_assert (g_file_test (dest_path, G_FILE_TEST_EXISTS));
- g_assert (g_file_test (orig_path, G_FILE_TEST_EXISTS) == FALSE);
-
- g_assert (g_file_get_contents (dest_path, &file_cont, NULL, NULL));
- g_assert_cmpstr ("orig", ==, file_cont);
- g_free (file_cont);
-
- g_free (orig_path);
- g_free (dest_path);
-
- g_object_unref (orig);
- g_object_unref (dest);
-
- ephy_file_helpers_shutdown ();
-}
-
typedef struct {
const char *filename;
const char *expected;
@@ -425,9 +355,6 @@ main (int argc, char *argv[])
g_test_add_func ("/lib/ephy-file-helpers/create_delete_tmp",
test_ephy_file_create_delete_tmp);
- g_test_add_func ("/lib/ephy-file-helpers/switch_temp_file",
- test_ephy_file_switch_temp_file);
-
g_test_add_func ("/lib/ephy-file-helpers/sanitize_filename",
test_ephy_sanitize_filename);