| Index: chrome/installer/util/lzma_util_unittest.cc
|
| diff --git a/chrome/installer/util/lzma_util_unittest.cc b/chrome/installer/util/lzma_util_unittest.cc
|
| index b1c63637e9cef816afe8b129da2b226c2d97098c..e82d8bf11705dc32e2918c9677485630f15a9d08 100644
|
| --- a/chrome/installer/util/lzma_util_unittest.cc
|
| +++ b/chrome/installer/util/lzma_util_unittest.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2009 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.
|
|
|
| @@ -7,6 +7,7 @@
|
| #include "base/file_util.h"
|
| #include "base/path_service.h"
|
| #include "base/process_util.h"
|
| +#include "base/memory/scoped_temp_dir.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/installer/util/lzma_util.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -19,24 +20,10 @@ class LzmaUtilTest : public testing::Test {
|
| data_dir_ = data_dir_.AppendASCII("installer");
|
| ASSERT_TRUE(file_util::PathExists(data_dir_));
|
|
|
| - // Name a subdirectory of the user temp directory.
|
| - ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_));
|
| - test_dir_ = test_dir_.AppendASCII("LzmaUtilTest");
|
| -
|
| - // Create a fresh, empty copy of this test directory.
|
| - file_util::Delete(test_dir_, true);
|
| - file_util::CreateDirectoryW(test_dir_);
|
| - ASSERT_TRUE(file_util::PathExists(test_dir_));
|
| - }
|
| -
|
| - virtual void TearDown() {
|
| - // Clean up test directory
|
| - ASSERT_TRUE(file_util::Delete(test_dir_, true));
|
| - ASSERT_FALSE(file_util::PathExists(test_dir_));
|
| + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| }
|
|
|
| - // The path to temporary directory used to contain the test operations.
|
| - FilePath test_dir_;
|
| + ScopedTempDir temp_dir_;
|
|
|
| // The path to input data used in tests.
|
| FilePath data_dir_;
|
| @@ -66,7 +53,7 @@ TEST_F(LzmaUtilTest, OpenArchiveTest) {
|
|
|
| // Test that we can extract archives successfully.
|
| TEST_F(LzmaUtilTest, UnPackTest) {
|
| - FilePath extract_dir(test_dir_);
|
| + FilePath extract_dir(temp_dir_.path());
|
| extract_dir = extract_dir.AppendASCII("UnPackTest");
|
| ASSERT_FALSE(file_util::PathExists(extract_dir));
|
| EXPECT_TRUE(file_util::CreateDirectory(extract_dir));
|
| @@ -107,7 +94,7 @@ TEST_F(LzmaUtilTest, UnPackTest) {
|
|
|
| // Test the static method that can be used to unpack archives.
|
| TEST_F(LzmaUtilTest, UnPackArchiveTest) {
|
| - FilePath extract_dir(test_dir_);
|
| + FilePath extract_dir(temp_dir_.path());
|
| extract_dir = extract_dir.AppendASCII("UnPackArchiveTest");
|
| ASSERT_FALSE(file_util::PathExists(extract_dir));
|
| EXPECT_TRUE(file_util::CreateDirectory(extract_dir));
|
|
|