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

Unified Diff: net/disk_cache/disk_cache_test_util.cc

Issue 6793008: Replacing base::DIR_TEMP with ScopedTempDir when appropriate. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: I obviously need a Windows test machine. 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: net/disk_cache/disk_cache_test_util.cc
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc
index ed16db0170473845f41c653529769283d0d51d03..225f61da8f84db657ced067b74815af720df5e8f 100644
--- a/net/disk_cache/disk_cache_test_util.cc
+++ b/net/disk_cache/disk_cache_test_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-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.
@@ -8,19 +8,25 @@
#include "base/file_util.h"
#include "base/message_loop_proxy.h"
#include "base/path_service.h"
+#include "base/memory/scoped_temp_dir.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/backend_impl.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/file.h"
+#include "testing/gtest/include/gtest/gtest.h"
using base::Time;
using base::TimeDelta;
namespace {
+ScopedTempDir temp_dir_;
+
FilePath BuildCachePath(const std::string& name) {
- FilePath path;
- PathService::Get(base::DIR_TEMP, &path); // Ignore return value;
+ if (!temp_dir_.IsValid())
Paweł Hajdan Jr. 2011/04/11 18:16:53 Oh, let's leave this one as-is. I know Ricardo Var
Mike West 2011/04/12 07:04:04 Great, this is exactly why I'm thrilled you're rev
+ DCHECK(temp_dir_.CreateUniqueTempDir());
+
+ FilePath path = temp_dir_.path();
path = path.AppendASCII(name);
if (!file_util::PathExists(path))
file_util::CreateDirectory(path);
« chrome/browser/ui/tests/browser_uitest.cc ('K') | « chrome/installer/util/work_item_list_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698