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

Unified Diff: chrome/browser/safe_browsing/bloom_filter_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: Paweł's comments on Round 2. 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/browser/safe_browsing/bloom_filter_unittest.cc
diff --git a/chrome/browser/safe_browsing/bloom_filter_unittest.cc b/chrome/browser/safe_browsing/bloom_filter_unittest.cc
index f0d74c050456cff6c23a87dbe5816d694845f66c..3a883da9b3beb754556f2e868f6ed639bcd08261 100644
--- a/chrome/browser/safe_browsing/bloom_filter_unittest.cc
+++ b/chrome/browser/safe_browsing/bloom_filter_unittest.cc
@@ -15,6 +15,7 @@
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/string_util.h"
+#include "base/memory/scoped_temp_dir.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -89,9 +90,9 @@ TEST(SafeBrowsingBloomFilter, BloomFilterFile) {
filter_write->Insert(GenHash());
// Remove any left over test filters and serialize.
- FilePath filter_path;
- PathService::Get(base::DIR_TEMP, &filter_path);
- filter_path = filter_path.AppendASCII("SafeBrowsingTestFilter");
+ ScopedTempDir temp_dir;
+ ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+ FilePath filter_path = temp_dir.path().AppendASCII("SafeBrowsingTestFilter");
file_util::Delete(filter_path, false);
Paweł Hajdan Jr. 2011/04/12 08:32:02 This line shouldn't be needed.
Mike West 2011/04/12 12:00:05 Done.
ASSERT_FALSE(file_util::PathExists(filter_path));
Paweł Hajdan Jr. 2011/04/12 08:32:02 This too.
Mike West 2011/04/12 12:00:05 Done.
ASSERT_TRUE(filter_write->WriteFile(filter_path));
@@ -111,6 +112,4 @@ TEST(SafeBrowsingBloomFilter, BloomFilterFile) {
EXPECT_EQ(0,
memcmp(filter_write->data(), filter_read->data(), filter_read->size()));
-
- file_util::Delete(filter_path, false);
}

Powered by Google App Engine
This is Rietveld 408576698