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

Unified Diff: chrome/common/extensions/extension_unpacker_unittest.cc

Issue 6793008: Replacing base::DIR_TEMP with ScopedTempDir when appropriate. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: About a third of the way done. Created 9 years, 8 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/common/extensions/extension_unpacker_unittest.cc
diff --git a/chrome/common/extensions/extension_unpacker_unittest.cc b/chrome/common/extensions/extension_unpacker_unittest.cc
index 930c2719465680c1b1bbb470cd74689a81d49b54..8213575d0184c9dc6ea32b12c8803406c2be962a 100644
--- a/chrome/common/extensions/extension_unpacker_unittest.cc
+++ b/chrome/common/extensions/extension_unpacker_unittest.cc
@@ -1,4 +1,4 @@
-// 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.
@@ -6,6 +6,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/values.h"
+#include "base/memory/scoped_temp_dir.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_unpacker.h"
@@ -27,12 +28,9 @@ public:
// Try bots won't let us write into DIR_TEST_DATA, so we have to create
// a temp folder to play in.
- ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &install_dir_));
- install_dir_ = install_dir_.AppendASCII("extension_unpacker_test");
- file_util::Delete(install_dir_, true);
- file_util::CreateDirectory(install_dir_);
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- FilePath crx_path = install_dir_.AppendASCII(crx_name);
+ FilePath crx_path = temp_dir_.path().AppendASCII(crx_name);
ASSERT_TRUE(file_util::CopyFile(original_path, crx_path)) <<
"Original path " << original_path.value() <<
", Crx path " << crx_path.value();
@@ -41,12 +39,10 @@ public:
}
virtual void TearDown() {
Paweł Hajdan Jr. 2011/04/08 15:58:17 An empty TearDown can be removed.
Mike West 2011/04/11 14:47:04 Done.
- ASSERT_TRUE(file_util::Delete(install_dir_, true)) <<
- install_dir_.value();
}
protected:
- FilePath install_dir_;
+ ScopedTempDir temp_dir_;
scoped_ptr<ExtensionUnpacker> unpacker_;
};

Powered by Google App Engine
This is Rietveld 408576698