Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc

Issue 7056011: Replace all usage of FileAutoDeleter with ScopedTempDir. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));

Powered by Google App Engine
This is Rietveld 408576698