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

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 86426)
+++ chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc (working copy)
@@ -1,12 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#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,11 @@
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);
- // 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 +32,6 @@
if (store_.get())
store_->Delete();
store_.reset();
- file_deleter_.reset();
PlatformTest::TearDown();
}
@@ -50,7 +40,7 @@
corruption_detected_ = true;
}
- scoped_ptr<FileAutoDeleter> file_deleter_;
+ ScopedTempDir temp_dir_;
FilePath filename_;
scoped_ptr<SafeBrowsingStoreFile> store_;
bool corruption_detected_;
@@ -60,8 +50,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));
« no previous file with comments | « chrome/browser/importer/safari_importer_unittest.mm ('k') | chrome/browser/sessions/session_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698