Remove utils::MakeTempDirectory().
In favor of base::ScopedTempDir, except for PostinstallRunnerAction,
where the temp directory needs to be removed for every partition.
ScopedDirRemover is also removed because it's no longer used.
Test: ./update_engine_unittests
Test: cros_workon_make update_engine --test
Bug: 26955860
Change-Id: I954e6e892aff0cf9f8434a77408dc3c9eb64c1b5
diff --git a/common/prefs_unittest.cc b/common/prefs_unittest.cc
index d94623a..1000131 100644
--- a/common/prefs_unittest.cc
+++ b/common/prefs_unittest.cc
@@ -21,6 +21,7 @@
#include <string>
#include <base/files/file_util.h>
+#include <base/files/scoped_temp_dir.h>
#include <base/macros.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
@@ -41,19 +42,17 @@
class PrefsTest : public ::testing::Test {
protected:
void SetUp() override {
- ASSERT_TRUE(base::CreateNewTempDirectory("auprefs", &prefs_dir_));
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ prefs_dir_ = temp_dir_.path();
ASSERT_TRUE(prefs_.Init(prefs_dir_));
}
- void TearDown() override {
- base::DeleteFile(prefs_dir_, true); // recursive
- }
-
bool SetValue(const string& key, const string& value) {
return base::WriteFile(prefs_dir_.Append(key), value.data(),
value.length()) == static_cast<int>(value.length());
}
+ base::ScopedTempDir temp_dir_;
base::FilePath prefs_dir_;
Prefs prefs_;
};