diff options
author | husky@google.com <husky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 14:25:04 +0000 |
---|---|---|
committer | husky@google.com <husky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 14:25:04 +0000 |
commit | cbbb641e6283e2f68ebc4f68da8191a342fa8838 (patch) | |
tree | 896de49d81d567491ff12afb1fea68c648ebaacc /chrome/browser/safe_browsing | |
parent | fb8f976cb2b5ce1a8e078852c67e049987edf81f (diff) | |
download | chromium_src-cbbb641e6283e2f68ebc4f68da8191a342fa8838.zip chromium_src-cbbb641e6283e2f68ebc4f68da8191a342fa8838.tar.gz chromium_src-cbbb641e6283e2f68ebc4f68da8191a342fa8838.tar.bz2 |
Replace all usage of FileAutoDeleter with ScopedTempDir.
Review URL: http://codereview.chromium.org/7056011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc index 39fe53a..1eb540e 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc @@ -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,19 +20,10 @@ class SafeBrowsingStoreFileTest : public PlatformTest { 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 @@ class SafeBrowsingStoreFileTest : public PlatformTest { if (store_.get()) store_->Delete(); store_.reset(); - file_deleter_.reset(); PlatformTest::TearDown(); } @@ -50,7 +40,7 @@ class SafeBrowsingStoreFileTest : public PlatformTest { 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_STORE(SafeBrowsingStoreFileTest, store_.get(), filename_); // 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)); |