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

Unified Diff: chrome/browser/importer/firefox_profile_lock_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/importer/firefox_profile_lock_unittest.cc
===================================================================
--- chrome/browser/importer/firefox_profile_lock_unittest.cc (revision 86049)
+++ chrome/browser/importer/firefox_profile_lock_unittest.cc (working copy)
@@ -10,7 +10,6 @@
#include "build/build_config.h"
#include "chrome/browser/importer/firefox_profile_lock.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/test/file_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
class FirefoxProfileLockTest : public testing::Test {
@@ -34,12 +33,8 @@
// Tests basic functionality and verifies that the lock file is deleted after
// use.
TEST_F(FirefoxProfileLockTest, ProfileLock) {
- FilePath test_path;
- ASSERT_TRUE(file_util::CreateNewTempDirectory(
- FILE_PATH_LITERAL("firefox_profile"), &test_path));
- FilePath lock_file_path = test_path;
- FileAutoDeleter deleter(lock_file_path);
- lock_file_path = lock_file_path.Append(FirefoxProfileLock::kLockFileName);
+ FilePath test_path = temp_dir_.path();
+ FilePath lock_file_path = test_path.Append(FirefoxProfileLock::kLockFileName);
scoped_ptr<FirefoxProfileLock> lock;
EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock.get());
@@ -70,12 +65,8 @@
// If for some reason the lock file is left behind by the previous owner, we
// should still be able to lock it, at least in the Windows implementation.
TEST_F(FirefoxProfileLockTest, ProfileLockOrphaned) {
- FilePath test_path;
- ASSERT_TRUE(file_util::CreateNewTempDirectory(
- FILE_PATH_LITERAL("firefox_profile"), &test_path));
- FilePath lock_file_path = test_path;
- FileAutoDeleter deleter(lock_file_path);
- lock_file_path = lock_file_path.Append(FirefoxProfileLock::kLockFileName);
+ FilePath test_path = temp_dir_.path();
+ FilePath lock_file_path = test_path.Append(FirefoxProfileLock::kLockFileName);
// Create the orphaned lock file.
FILE* lock_file = file_util::OpenFile(lock_file_path, "w");
@@ -96,10 +87,7 @@
#if !defined(OS_POSIX)
// Tests two locks contending for the same lock file.
TEST_F(FirefoxProfileLockTest, ProfileLockContention) {
- FilePath test_path;
- ASSERT_TRUE(file_util::CreateNewTempDirectory(
- FILE_PATH_LITERAL("firefox_profile"), &test_path));
- FileAutoDeleter deleter(test_path);
+ FilePath test_path = temp_dir_.path();
scoped_ptr<FirefoxProfileLock> lock1;
EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock1.get());

Powered by Google App Engine
This is Rietveld 408576698