Index: chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc |
=================================================================== |
--- chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc (revision 86049) |
+++ chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc (working copy) |
@@ -5,8 +5,8 @@ |
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
#include "base/callback.h" |
+#include "base/scoped_temp_dir.h" |
#include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" |
-#include "chrome/test/file_test_utils.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "testing/platform_test.h" |
@@ -20,20 +20,12 @@ |
virtual void SetUp() { |
PlatformTest::SetUp(); |
- FilePath temp_dir; |
- ASSERT_TRUE(file_util::CreateNewTempDirectory(kFolderPrefix, &temp_dir)); |
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
- file_deleter_.reset(new FileAutoDeleter(temp_dir)); |
- |
- filename_ = temp_dir; |
+ filename_ = temp_dir_.path(); |
filename_ = filename_.AppendASCII("SafeBrowsingTestStore"); |
- file_util::Delete(filename_, false); |
+ ASSERT_FALSE(file_util::PathExists(filename_)); |
Paweł Hajdan Jr.
2011/05/20 13:48:58
nit: Not needed, please remove.
lain Merrick
2011/05/20 14:23:32
Done.
|
- // Make sure an old temporary file isn't hanging around. |
- const FilePath temp_file = |
- SafeBrowsingStoreFile::TemporaryFileForFilename(filename_); |
- file_util::Delete(temp_file, false); |
- |
store_.reset(new SafeBrowsingStoreFile()); |
store_->Init(filename_, NULL); |
} |
@@ -41,7 +33,6 @@ |
if (store_.get()) |
store_->Delete(); |
store_.reset(); |
- file_deleter_.reset(); |
PlatformTest::TearDown(); |
} |
@@ -50,7 +41,7 @@ |
corruption_detected_ = true; |
} |
- scoped_ptr<FileAutoDeleter> file_deleter_; |
+ ScopedTempDir temp_dir_; |
FilePath filename_; |
scoped_ptr<SafeBrowsingStoreFile> store_; |
bool corruption_detected_; |
@@ -60,8 +51,8 @@ |
// Test that Delete() deletes the temporary store, if present. |
TEST_F(SafeBrowsingStoreFileTest, DeleteTemp) { |
- const FilePath temp_file = |
- SafeBrowsingStoreFile::TemporaryFileForFilename(filename_); |
+ const FilePath temp_file = |
+ SafeBrowsingStoreFile::TemporaryFileForFilename(filename_); |
EXPECT_FALSE(file_util::PathExists(filename_)); |
EXPECT_FALSE(file_util::PathExists(temp_file)); |