AU: shift to use new TMPDIR-enabled temp file

The main change here is that delta generator will now create all
temporary files in TMPDIR, if set. Other than that, we're converting all
other temporary file/directory creation to use the new functions.

- All temps of the form "/tmp/foo" are converted to "foo": this
  preserves the behavior in the default case (where TMPDIR is not set),
  yet will do the right thing if run with a different TMPDIR.

- A few other cases (for example, temp file created relative to the
  current working directory) will now be created in TMPDIR or /tmp.
  These are all in unit tests and the transition makes sense anyway.

Note that two temp file/directory creation calls in actual UE code were
using "/tmp/..." and were not changed. This will ensure that they are
resilient to TMPDIR changes and will always be allocated in the same
(hard-coded) location.

BUG=chromium:253622
TEST=Unit tests.

Change-Id: Ia1208963a0e2fcd43b8d6f92bb3d1b7459e930a2
Reviewed-on: https://chromium-review.googlesource.com/182247
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/delta_diff_generator_unittest.cc b/delta_diff_generator_unittest.cc
index 510d1ed..7d9095e 100644
--- a/delta_diff_generator_unittest.cc
+++ b/delta_diff_generator_unittest.cc
@@ -697,7 +697,7 @@
 
   // Prepare the filesystem with the minimum required for this to work
   string temp_dir;
-  EXPECT_TRUE(utils::MakeTempDirectory("/tmp/AssignTempBlocksTest.XXXXXX",
+  EXPECT_TRUE(utils::MakeTempDirectory("AssignTempBlocksTest.XXXXXX",
                                        &temp_dir));
   ScopedDirRemover temp_dir_remover(temp_dir);
 
@@ -708,7 +708,7 @@
   ScopedPathUnlinker filename_unlinker(temp_dir + kFilename);
 
   int fd;
-  EXPECT_TRUE(utils::MakeTempFile("/tmp/AssignTempBlocksTestData.XXXXXX",
+  EXPECT_TRUE(utils::MakeTempFile("AssignTempBlocksTestData.XXXXXX",
                                   NULL,
                                   &fd));
   ScopedFdCloser fd_closer(&fd);
@@ -814,7 +814,7 @@
 
   // Prepare the filesystem with the minimum required for this to work.
   string temp_dir;
-  EXPECT_TRUE(utils::MakeTempDirectory("/tmp/NoSparseAsTempTest.XXXXXX",
+  EXPECT_TRUE(utils::MakeTempDirectory("NoSparseAsTempTest.XXXXXX",
                                        &temp_dir));
   ScopedDirRemover temp_dir_remover(temp_dir);
 
@@ -825,7 +825,7 @@
   ScopedPathUnlinker filename_unlinker(temp_dir + kFilename);
 
   int fd = -1;
-  EXPECT_TRUE(utils::MakeTempFile("/tmp/NoSparseAsTempTestData.XXXXXX",
+  EXPECT_TRUE(utils::MakeTempFile("NoSparseAsTempTestData.XXXXXX",
                                   NULL,
                                   &fd));
   ScopedFdCloser fd_closer(&fd);
@@ -1075,7 +1075,7 @@
 
   // Prepare the filesystem with the minimum required for this to work
   string temp_dir;
-  EXPECT_TRUE(utils::MakeTempDirectory("/tmp/AssignTempBlocksReuseTest.XXXXXX",
+  EXPECT_TRUE(utils::MakeTempDirectory("AssignTempBlocksReuseTest.XXXXXX",
                                        &temp_dir));
   ScopedDirRemover temp_dir_remover(temp_dir);
 
@@ -1086,7 +1086,7 @@
   ScopedPathUnlinker filename_unlinker(temp_dir + kFilename);
 
   int fd;
-  EXPECT_TRUE(utils::MakeTempFile("/tmp/AssignTempBlocksReuseTest.XXXXXX",
+  EXPECT_TRUE(utils::MakeTempFile("AssignTempBlocksReuseTest.XXXXXX",
                                   NULL,
                                   &fd));
   ScopedFdCloser fd_closer(&fd);